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