15 : m_p(p), m_q(q), m_g(g)
29 m_g.c1.BERDecode(seq);
30 m_g.c2.BERDecode(seq);
39 m_g.c1.DEREncode(seq);
40 m_g.c2.DEREncode(seq);
53 pass = pass && !(m_g.c1.IsNegative() || m_g.c2.IsNegative() || m_g.c1 >= m_p || m_g.c2 >= m_p || m_g == three);
57 pass = pass && ((m_p.Squared()-m_p+1)%m_q).IsZero();
64 pass = pass && XTR_Exponentiate(m_g, (m_p.Squared()-m_p+1)/m_q, m_p) != three;
66 pass = pass && XTR_Exponentiate(m_g, m_q, m_p) == three;
74 return GetValueHelper(
this, name, valueType, pValue).Assignable()
75 CRYPTOPP_GET_FUNCTION_ENTRY(
Modulus)
83 AssignFromHelper(
this, source)
84 CRYPTOPP_SET_FUNCTION_ENTRY(
Modulus)
93 x.
Encode(privateKey, PrivateKeyLength());
99 Integer x(privateKey, PrivateKeyLength());
101 y.Encode(publicKey, PublicKeyLength());
104 bool 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)
116 Integer s(privateKey, PrivateKeyLength());
118 z.Encode(agreedValue, AgreedValueLength());
bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const
Derive agreed value.
Standard names for retrieving values by name when working with NameValuePairs.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
bool IsNegative() const
Determines if the Integer is negative.
Interface for random number generators.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
static const Integer & One()
Integer representing 1.
bool VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level=1)
Verifies a number is probably prime.
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.
void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
Generate private key in this domain.
const char * SubgroupGenerator()
Integer, ECP::Point, or EC2N::Point.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Classes and functions for working with ANS.1 objects.
Classes and functions for number theoretic operations.
void Encode(byte *output, size_t outputLen, Signedness sign=UNSIGNED) const
Encode in big-endian format.
const char * Modulus()
Integer.
Multiple precision integer with arithmetic operations.
static const Integer & Zero()
Integer representing 0.
Class file for performing modular arithmetic.
Crypto++ library namespace.
GF(p^2), optimal normal basis.
const char * SubgroupOrder()
Integer.
void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer &q, GFP2Element &g, unsigned int pbits, unsigned int qbits)
Creates primes p,q and generator g for XTR.
bool IsOdd() const
Determines if the Integer is odd parity.
Interface for retrieving values given their names.