13 NAMESPACE_BEGIN(CryptoPP)
22 template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption>
28 typedef GROUP_PARAMETERS GroupParameters;
29 typedef typename GroupParameters::Element Element;
39 : m_groupParameters(params) {}
44 {m_groupParameters.BERDecode(bt);}
53 {m_groupParameters.Initialize(v1, v2);}
62 template <
class T2,
class T3>
64 {m_groupParameters.Initialize(v1, v2, v3);}
75 template <
class T2,
class T3,
class T4>
77 {m_groupParameters.Initialize(v1, v2, v3, v4);}
85 template <
class T1,
class T2>
87 {m_groupParameters.Initialize(v1, v2);}
97 template <
class T1,
class T2,
class T3>
99 {m_groupParameters.Initialize(v1, v2, v3);}
111 template <
class T1,
class T2,
class T3,
class T4>
112 DH_Domain(
const T1 &v1,
const T2 &v2,
const T3 &v3,
const T4 &v4)
113 {m_groupParameters.Initialize(v1, v2, v3, v4);}
133 Base::GeneratePublicKey(rng, privateKey, publicKey);
138 this->GeneratePrivateKey(rng, privateKey2);
141 Base::GeneratePublicKey(rng, privateKey2, publicKey2);
143 SecByteBlock agreedValue(this->AgreedValueLength()), agreedValue2(this->AgreedValueLength());
144 bool agreed1 = this->Agree(agreedValue, privateKey, publicKey2);
145 bool agreed2 = this->Agree(agreedValue2, privateKey2, publicKey);
147 if (!agreed1 || !agreed2 || agreedValue != agreedValue2)
148 throw SelfTestFailure(this->AlgorithmName() +
": pairwise consistency test failed");
152 static std::string CRYPTOPP_API StaticAlgorithmName()
153 {
return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();}
156 #ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
164 {
return m_groupParameters;}
166 GroupParameters m_groupParameters;
void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a public key from a private key in this domain.
Restricts the instantiation of a class to one static object without locks.
std::string AlgorithmName() const
Provides the name of this algorithm.
Interface for Discrete Log (DL) group parameters.
DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3, const T4 &v4)
Construct a Diffie-Hellman domain.
DH_Domain(BufferedTransformation &bt)
Construct a Diffie-Hellman domain.
Abstract base classes that provide a uniform interface to this library.
Interface for random number generators.
SecBlock<byte> typedef.
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.
bool FIPS_140_2_ComplianceEnabled()
Determines whether the library provides FIPS validated cryptography.
DH_Domain(RandomNumberGenerator &v1, const T2 &v2)
Construct a Diffie-Hellman domain.
Exception thrown when a crypto algorithm is used after a self test fails.
Implementation of schemes based on 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) with key validation
const GroupParameters & GetGroupParameters() const
Retrieves the group parameters for this domain.
DH_Domain()
Construct a Diffie-Hellman domain.
DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3)
Construct a Diffie-Hellman domain.
GroupParameters & AccessGroupParameters()
Retrieves the group parameters for this domain.
Interface for DL key agreement algorithms.
Discrete Log (DL) simple key agreement base implementation.
DH_Domain(const T1 &v1, const T2 &v2)
Construct a Diffie-Hellman domain.