24template <
class GROUP_PARAMETERS,
class COFACTOR_OPTION =
typename GROUP_PARAMETERS::DefaultCofactorOption>
30 typedef GROUP_PARAMETERS GroupParameters;
31 typedef typename GroupParameters::Element Element;
43 : m_groupParameters(params) {}
48 {m_groupParameters.BERDecode(bt);}
57 {m_groupParameters.Initialize(v1, v2);}
66 template <
class T2,
class T3>
68 {m_groupParameters.Initialize(v1, v2, v3);}
79 template <
class T2,
class T3,
class T4>
81 {m_groupParameters.Initialize(v1, v2, v3, v4);}
89 template <
class T1,
class T2>
91 {m_groupParameters.Initialize(v1, v2);}
101 template <
class T1,
class T2,
class T3>
103 {m_groupParameters.Initialize(v1, v2, v3);}
115 template <
class T1,
class T2,
class T3,
class T4>
116 DH_Domain(
const T1 &v1,
const T2 &v2,
const T3 &v3,
const T4 &v4)
117 {m_groupParameters.Initialize(v1, v2, v3, v4);}
148 bool agreed1 = this->
Agree(agreedValue, privateKey, publicKey2);
149 bool agreed2 = this->
Agree(agreedValue2, privateKey2, publicKey);
151 if (!agreed1 || !agreed2 || agreedValue != agreedValue2)
157 {
return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();}
164 {
return m_groupParameters;}
166 GroupParameters m_groupParameters;
210#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
211struct DH :
public DH_Domain<DL_GroupParameters_GFP_DefaultSafePrime>
214 typedef GroupParameters::Element Element;
Classes for performing mathematics over different fields.
const GroupParameters & GetGroupParameters() const
Retrieves the group parameters for this domain.
DH_Domain(BufferedTransformation &bt)
Construct a Diffie-Hellman domain.
DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3)
Create a Diffie-Hellman domain.
std::string AlgorithmName() const
Provides the name of this algorithm.
DH_Domain(const GroupParameters ¶ms)
Construct a Diffie-Hellman domain.
DH_Domain(RandomNumberGenerator &v1, const T2 &v2)
Create a Diffie-Hellman domain.
DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3, const T4 &v4)
Create a Diffie-Hellman domain.
void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a public key from a private key in this domain.
DH_Domain()
Construct a Diffie-Hellman domain.
DH_Domain(const T1 &v1, const T2 &v2)
Construct a Diffie-Hellman domain.
GroupParameters & AccessGroupParameters()
Retrieves the group parameters for this domain.
DH_Domain(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
Construct a Diffie-Hellman domain.
DH_Domain(const T1 &v1, const T2 &v2, const T3 &v3)
Construct a Diffie-Hellman domain.
Interface for Discrete Log (DL) group parameters.
Diffie-Hellman key agreement algorithm.
Interface for DL key agreement algorithms.
Discrete Log (DL) simple key agreement base implementation.
unsigned int AgreedValueLength() const
bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const
void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a public key from a private key in this domain.
unsigned int PrivateKeyLength() const
unsigned int PublicKeyLength() const
Multiple precision integer with arithmetic operations.
Interface for random number generators.
Exception thrown when a crypto algorithm is used after a self test fails.
Restricts the instantiation of a class to one static object without locks.
const T & Ref(...) const
Return a reference to the inner Singleton object.
#define CRYPTOPP_API
Win32 calling convention.
#define CRYPTOPP_DLL_TEMPLATE_CLASS
Instantiate templates in a dynamic library.
Abstract base classes that provide a uniform interface to this library.
CRYPTOPP_DLL bool FIPS_140_2_ComplianceEnabled()
Determines whether the library provides FIPS validated cryptography.
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
Crypto++ library namespace.
DH(BufferedTransformation &bt)
Initialize a Diffie-Hellman object.
DH(const Integer &p, const Integer &g)
Initialize a Diffie-Hellman object.
DH()
Create an uninitialized Diffie-Hellman object.
DH(RandomNumberGenerator &rng, unsigned int modulusBits)
Create a Diffie-Hellman object.
DH(const GroupParameters ¶ms)
Initialize a Diffie-Hellman object.
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
Creates a Diffie-Hellman object.
void Initialize(const Integer &p, const Integer &q, const Integer &g)
Initialize a Diffie-Hellman object.
void Initialize(const Integer &p, const Integer &g)
Initialize a Diffie-Hellman object.
DH(const Integer &p, const Integer &q, const Integer &g)
Initialize a Diffie-Hellman object.