Crypto++
5.6.4
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
26 template <
class GROUP_PARAMETERS,
class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption>
30 typedef GROUP_PARAMETERS GroupParameters;
31 typedef typename GroupParameters::Element Element;
40 : m_groupParameters(params) {}
45 {m_groupParameters.BERDecode(bt);}
53 template <
class T1,
class T2>
55 {m_groupParameters.Initialize(v1, v2);}
65 template <
class T1,
class T2,
class T3>
67 {m_groupParameters.Initialize(v1, v2, v3);}
79 template <
class T1,
class T2,
class T3,
class T4>
81 {m_groupParameters.Initialize(v1, v2, v3, v4);}
100 unsigned int AgreedValueLength()
const {
return GetAbstractGroupParameters().GetEncodedElementSize(
false);}
134 CRYPTOPP_UNUSED(rng);
155 CRYPTOPP_UNUSED(rng);
160 const byte *staticPrivateKey,
const byte *ephemeralPrivateKey,
161 const byte *staticOtherPublicKey,
const byte *ephemeralOtherPublicKey,
162 bool validateStaticOtherPublicKey=
true)
const
167 Element WW = params.
DecodeElement(staticOtherPublicKey, validateStaticOtherPublicKey);
168 Element VV = params.
DecodeElement(ephemeralOtherPublicKey,
true);
182 P = m_groupParameters.MultiplyElements(P, VV);
195 Element P = m_groupParameters.CascadeExponentiate(VV, k*e, WW, k*(e*tt%r));
212 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.
Interface for crypto prameters.
virtual Integer GetCofactor() const
Retrieves the cofactor.
static const Integer & One()
Integer representing 1.
unsigned int AgreedValueLength() const
Provides the size of the agreed value.
Ring of congruence classes modulo n.
virtual Element ExponentiateBase(const Integer &exponent) const
Retrieves the subgroup generator.
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.
Implementation of schemes based on DL over GF(p)
MQV_Domain(BufferedTransformation &bt)
Construct a MQV domain.
Class file for performing modular arithmetic.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
@ 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.
MQV domain for performing authenticated key agreement.
void GenerateEphemeralPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate ephemeral public key.
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 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.
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.
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 ephemeral public key.
Multiple precision integer with arithmetic operations.
Multiple precision integer with arithmetic operations.