15 template <class GROUP_PARAMETERS, class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
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>
117 {m_groupParameters.Initialize(v1, v2, v3, v4);}
137 Base::GeneratePublicKey(rng, privateKey, publicKey);
142 this->GeneratePrivateKey(rng, privateKey2);
145 Base::GeneratePublicKey(rng, privateKey2, publicKey2);
147 SecByteBlock agreedValue(this->AgreedValueLength()), agreedValue2(this->AgreedValueLength());
148 bool agreed1 = this->Agree(agreedValue, privateKey, publicKey2);
149 bool agreed2 = this->Agree(agreedValue2, privateKey2, publicKey);
151 if (!agreed1 || !agreed2 || agreedValue != agreedValue2)
152 throw SelfTestFailure(this->AlgorithmName() +
": pairwise consistency test failed");
157 {
return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();}
164 {
return m_groupParameters;}
210 #if defined(CRYPTOPP_DOXYGEN_PROCESSING) 211 struct DH :
public DH_Domain<DL_GroupParameters_GFP_DefaultSafePrime>
214 typedef GroupParameters::Element
Element;
227 DH(
const GroupParameters ¶ms) :
DH_Domain(params) {}
void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a public key from a private key in this domain.
GroupParameters m_groupParameters
Diffie-Hellman key agreement algorithm.
Restricts the instantiation of a class to one static object without locks.
GROUP_PARAMETERS GroupParameters
std::string AlgorithmName() const
Provides the name of this algorithm.
#define NAMESPACE_BEGIN(x)
bool FIPS_140_2_ComplianceEnabled()
Determines whether the library provides FIPS validated cryptography.
Interface for Discrete Log (DL) group parameters.
#define CRYPTOPP_DLL_TEMPLATE_CLASS
DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3, const T4 &v4)
Create a Diffie-Hellman domain.
DH_Domain(BufferedTransformation &bt)
Construct a Diffie-Hellman domain.
Abstract base classes that provide a uniform interface to this library.
DL_KeyAgreementAlgorithm_DH< Element, COFACTOR_OPTION > DH_Algorithm
Interface for random number generators.
const DL_KeyAgreementAlgorithm< Element > & GetKeyAgreementAlgorithm() const
DH_Domain< GROUP_PARAMETERS, COFACTOR_OPTION > Domain
Classes for performing mathematics over different fields.
DH_Domain(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
Construct a Diffie-Hellman domain.
DH_Domain(RandomNumberGenerator &v1, const T2 &v2)
Create a Diffie-Hellman domain.
Exception thrown when a crypto algorithm is used after a self test fails.
Multiple precision integer with arithmetic operations.
GroupParameters::Element Element
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
DH_Domain(const T1 &v1, const T2 &v2, const T3 &v3)
Construct a Diffie-Hellman domain.
DH_Domain(const GroupParameters ¶ms)
Construct a Diffie-Hellman domain.
DH_Domain< DL_GroupParameters_GFP_DefaultSafePrime > DH
Diffie-Hellman in GF(p)
const GroupParameters & GetGroupParameters() const
Retrieves the group parameters for this domain.
DH_Domain()
Construct a Diffie-Hellman domain.
DL_GroupParameters< Element > & AccessAbstractGroupParameters()
DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3)
Create a Diffie-Hellman domain.
static std::string CRYPTOPP_API StaticAlgorithmName()
GroupParameters & AccessGroupParameters()
Retrieves the group parameters for this domain.
Interface for DL key agreement algorithms.
Discrete Log (DL) simple key agreement base implementation.
DL_SimpleKeyAgreementDomainBase< typename GROUP_PARAMETERS::Element > Base
DH_Domain(const T1 &v1, const T2 &v2)
Construct a Diffie-Hellman domain.