13NAMESPACE_BEGIN(CryptoPP)
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);}
139 if (FIPS_140_2_ComplianceEnabled())
148 bool agreed1 = this->
Agree(agreedValue, privateKey, publicKey2);
149 bool agreed2 = this->
Agree(agreedValue2, privateKey2, publicKey);
151 if (!agreed1 || !agreed2 || agreedValue != agreedValue2)
156 static std::string CRYPTOPP_API StaticAlgorithmName()
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;
227 DH(
const GroupParameters ¶ms) :
DH_Domain(params) {}
253 {AccessGroupParameters().Initialize(rng, modulusBits);}
259 {AccessGroupParameters().Initialize(p, g);}
266 {AccessGroupParameters().Initialize(p, q, g);}
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.
Restricts the instantiation of a class to one static object without locks.
CRYPTOPP_NOINLINE const T & Ref(CRYPTOPP_NOINLINE_DOTDOTDOT) const
Return a reference to the inner Singleton object.
Abstract base classes that provide a uniform interface to this library.
DH_Domain< DL_GroupParameters_GFP_DefaultSafePrime > DH
Diffie-Hellman in GF(p)
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)