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;
void GenerateStaticPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a static public key from a private key in this domain.
MQV_Domain(T1 v1, T2 v2)
Construct a MQV domain.
virtual Integer GetCofactor() const
Retrieves the cofactor.
const Integer & Divide(const Integer &a, const Integer &b) const
Divides elements in the ring.
Utility functions for the Crypto++ library.
static const Integer & One()
Integer representing 1.
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.
Interface for Discrete Log (DL) group parameters.
MQV_Domain(T1 v1, T2 v2, T3 v3, T4 v4)
Construct a MQV domain.
Abstract base classes that provide a uniform interface to this library.
virtual Integer ConvertElementToInteger(const Element &element) const =0
Converts an element to an Integer.
Ring of congruence classes modulo n.
Interface for random number generators.
MQV_Domain(BufferedTransformation &bt)
Construct a MQV domain.
Classes for performing mathematics over different fields.
virtual Element ExponentiateBase(const Integer &exponent) const
Exponentiates the base.
MQV_Domain< DL_GroupParameters_GFP_DefaultSafePrime > MQV
Menezes-Qu-Vanstone in GF(p) with key validation, AKA MQV
Cofactor multiplication compatible with ordinary Diffie-Hellman.
MQV domain for performing authenticated key agreement.
No cofactor multiplication applied.
virtual void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const =0
Exponentiates a base to multiple exponents.
Multiple precision integer with arithmetic operations.
unsigned int EphemeralPublicKeyLength() const
Provides the size of the ephemeral public key.
unsigned int StaticPrivateKeyLength() const
Provides the size of the static private key.
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
virtual Element DecodeElement(const byte *encoded, bool checkForGroupMembership) const =0
Decodes the element.
void GenerateEphemeralPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
Generate ephemeral private key in this domain.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
Exception thrown when an invalid group element is encountered.
void GenerateEphemeralPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate ephemeral public key from a private key in this domain.
unsigned int BitCount() const
Determines the number of bits required to represent the Integer.
void GenerateStaticPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
Generate static private key in this domain.
unsigned char byte
8-bit unsigned datatype
unsigned int StaticPublicKeyLength() const
Provides the size of the static public key.
MQV_Domain(const GroupParameters ¶ms)
Construct a MQV domain.
virtual void EncodeElement(bool reversible, const Element &element, byte *encoded) const =0
Encodes the element.
Multiple precision integer with arithmetic operations.
MQV_Domain(T1 v1, T2 v2, T3 v3)
Construct a MQV domain.
MQV_Domain()
Construct a MQV domain.
Interface for crypto prameters.
virtual Integer GetMaxExponent() const =0
Retrieves the maximum exponent for the group.
CryptoParameters & AccessCryptoParameters()
Retrieves the crypto parameters for this domain.
unsigned int EphemeralPrivateKeyLength() const
Provides the size of the ephemeral private key.
Class file for performing modular arithmetic.
Crypto++ library namespace.
unsigned int AgreedValueLength() const
Provides the size of the agreed value.
Interface for domains of authenticated key agreement protocols.
GroupParameters & AccessGroupParameters()
Retrieves the group parameters for this domain.
const GroupParameters & GetGroupParameters() const
Retrieves the group parameters for this domain.
virtual Element ExponentiateElement(const Element &base, const Integer &exponent) const
Exponentiates an element.
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.