12NAMESPACE_BEGIN(CryptoPP)
15 : m_p(p), m_q(q), m_g(g)
21 XTR_FindPrimesAndGenerator(rng, m_p, m_q, m_g, pbits, qbits);
48 CRYPTOPP_ASSERT(pass);
50 CRYPTOPP_ASSERT(pass);
52 CRYPTOPP_ASSERT(pass);
53 pass = pass && !(m_g.c1.
IsNegative() || m_g.c2.
IsNegative() || m_g.c1 >= m_p || m_g.c2 >= m_p || m_g == three);
54 CRYPTOPP_ASSERT(pass);
57 pass = pass && ((m_p.
Squared()-m_p+1)%m_q).IsZero();
58 CRYPTOPP_ASSERT(pass);
62 pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2);
63 CRYPTOPP_ASSERT(pass);
64 pass = pass && XTR_Exponentiate(m_g, (m_p.
Squared()-m_p+1)/m_q, m_p) != three;
65 CRYPTOPP_ASSERT(pass);
66 pass = pass && XTR_Exponentiate(m_g, m_q, m_p) == three;
67 CRYPTOPP_ASSERT(pass);
74 return GetValueHelper(
this, name, valueType, pValue).Assignable()
75 CRYPTOPP_GET_FUNCTION_ENTRY(Modulus)
76 CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupOrder)
77 CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupGenerator)
83 AssignFromHelper(
this, source)
84 CRYPTOPP_SET_FUNCTION_ENTRY(Modulus)
85 CRYPTOPP_SET_FUNCTION_ENTRY(SubgroupOrder)
86 CRYPTOPP_SET_FUNCTION_ENTRY(SubgroupGenerator)
104bool XTR_DH::Agree(
byte *agreedValue,
const byte *privateKey,
const byte *otherPublicKey,
bool validateOtherPublicKey)
const
107 if (validateOtherPublicKey)
113 if (XTR_Exponentiate(w, m_q, m_p) != three)
Standard names for retrieving values by name when working with NameValuePairs.
Classes and functions for working with ANS.1 objects.
GF(p^2), optimal normal basis.
Multiple precision integer with arithmetic operations.
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
static const Integer &CRYPTOPP_API Zero()
Integer representing 0.
Integer Squared() const
Multiply this integer by itself.
void BERDecode(const byte *input, size_t inputLen)
Decode from BER format.
static const Integer &CRYPTOPP_API One()
Integer representing 1.
bool IsNegative() const
Determines if the Integer is negative.
bool IsOdd() const
Determines if the Integer is odd parity.
Interface for retrieving values given their names.
Interface for random number generators.
bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const
Derive agreed value.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
unsigned int AgreedValueLength() const
Provides the size of the agreed value.
unsigned int PublicKeyLength() const
Provides the size of the public key.
unsigned int PrivateKeyLength() const
Provides the size of the private key.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
Generate private key in this domain.
void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a public key from a private key in this domain.
Multiple precision integer with arithmetic operations.
Class file for performing modular arithmetic.
Classes and functions for number theoretic operations.