Crypto++
8.4
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
27 template <
class GROUP_PARAMETERS,
class COFACTOR_OPTION =
typename GROUP_PARAMETERS::DefaultCofactorOption>
31 typedef GROUP_PARAMETERS GroupParameters;
32 typedef typename GroupParameters::Element Element;
41 : m_groupParameters(params) {}
46 {m_groupParameters.BERDecode(bt);}
54 template <
class T1,
class T2>
56 {m_groupParameters.Initialize(v1, v2);}
66 template <
class T1,
class T2,
class T3>
68 {m_groupParameters.Initialize(v1, v2, v3);}
80 template <
class T1,
class T2,
class T3,
class T4>
82 {m_groupParameters.Initialize(v1, v2, v3, v4);}
102 unsigned int AgreedValueLength()
const {
return GetAbstractGroupParameters().GetEncodedElementSize(
false);}
139 CRYPTOPP_UNUSED(rng);
178 CRYPTOPP_UNUSED(rng);
206 const byte *staticPrivateKey,
const byte *ephemeralPrivateKey,
207 const byte *staticOtherPublicKey,
const byte *ephemeralOtherPublicKey,
208 bool validateStaticOtherPublicKey=
true)
const
213 Element WW = params.
DecodeElement(staticOtherPublicKey, validateStaticOtherPublicKey);
214 Element VV = params.
DecodeElement(ephemeralOtherPublicKey,
true);
228 P = m_groupParameters.MultiplyElements(P, VV);
241 Element P = m_groupParameters.CascadeExponentiate(VV, k*e, WW, k*(e*tt%r));
258 GroupParameters m_groupParameters;
CryptoParameters & AccessCryptoParameters()
Retrieves the crypto parameters for this domain.
MQV_Domain()
Construct a MQV domain.
void GenerateStaticPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a static public key from a private key in this domain.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
Interface for crypto prameters.
virtual Integer GetCofactor() const
Retrieves the cofactor.
unsigned int AgreedValueLength() const
Provides the size of the agreed value.
Ring of congruence classes modulo n.
virtual Element ExponentiateBase(const Integer &exponent) const
Exponentiates the base.
GroupParameters & AccessGroupParameters()
Retrieves the group parameters for this domain.
virtual Integer ConvertElementToInteger(const Element &element) const =0
Converts an element to an Integer.
void GenerateStaticPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
Generate static private key in this domain.
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
MQV_Domain(BufferedTransformation &bt)
Construct a MQV domain.
Class file for performing modular arithmetic.
@ NO_COFACTOR_MULTIPLICTION
No cofactor multiplication applied.
const GroupParameters & GetGroupParameters() const
Retrieves the group parameters for this domain.
Interface for domains of authenticated key agreement protocols.
Interface for random number generators.
MQV_Domain(T1 v1, T2 v2, T3 v3, T4 v4)
Construct a MQV domain.
MQV_Domain(T1 v1, T2 v2, T3 v3)
Construct a MQV domain.
Utility functions for the Crypto++ library.
bool Agree(byte *agreedValue, const byte *staticPrivateKey, const byte *ephemeralPrivateKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, bool validateStaticOtherPublicKey=true) const
Derive agreed value or shared secret.
MQV domain for performing authenticated key agreement.
void GenerateEphemeralPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate ephemeral public key from a private key in this domain.
virtual Element DecodeElement(const byte *encoded, bool checkForGroupMembership) const =0
Decodes the element.
virtual void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const =0
Exponentiates a base to multiple exponents.
MQV_Domain< DL_GroupParameters_GFP_DefaultSafePrime > MQV
Menezes-Qu-Vanstone in GF(p) with key validation, AKA MQV
unsigned int EphemeralPrivateKeyLength() const
Provides the size of the ephemeral private key.
MQV_Domain(const GroupParameters ¶ms)
Construct a MQV domain.
unsigned int BitCount() const
Determines the number of bits required to represent the Integer.
void GenerateEphemeralPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
Generate ephemeral private key in this domain.
virtual Integer GetMaxExponent() const =0
Retrieves the maximum exponent for the group.
virtual Element ExponentiateElement(const Element &base, const Integer &exponent) const
Exponentiates an element.
Classes for performing mathematics over different fields.
Crypto++ library namespace.
unsigned int StaticPublicKeyLength() const
Provides the size of the static public key.
virtual bool IsIdentity(const Element &element) const =0
Determines if an element is an identity.
virtual const Integer & GetSubgroupOrder() const =0
Retrieves the subgroup order.
@ COMPATIBLE_COFACTOR_MULTIPLICTION
Cofactor multiplication compatible with ordinary Diffie-Hellman.
Interface for Discrete Log (DL) group parameters.
MQV_Domain(T1 v1, T2 v2)
Construct a MQV domain.
Exception thrown when an invalid group element is encountered.
unsigned int StaticPrivateKeyLength() const
Provides the size of the static private key.
static const Integer & One()
Integer representing 1.
virtual void EncodeElement(bool reversible, const Element &element, byte *encoded) const =0
Encodes the element.
const Integer & Divide(const Integer &a, const Integer &b) const
Divides elements in the ring.
Abstract base classes that provide a uniform interface to this library.
unsigned int EphemeralPublicKeyLength() const
Provides the size of the ephemeral public key.
Multiple precision integer with arithmetic operations.
Multiple precision integer with arithmetic operations.