15 : m_p(p), m_q(q), m_g(g)
21 XTR_FindPrimesAndGenerator(rng, m_p, m_q, m_g, pbits, qbits);
50 pass = pass && !(m_g.c1.IsNegative() || m_g.c2.IsNegative() || m_g.c1 >= m_p || m_g.c2 >= m_p || m_g == three);
52 pass = pass && ((m_p.
Squared()-m_p+1)%m_q).IsZero();
56 pass = pass && XTR_Exponentiate(m_g, (m_p.
Squared()-m_p+1)/m_q, m_p) != three;
57 pass = pass && XTR_Exponentiate(m_g, m_q, m_p) == three;
64 return GetValueHelper(
this, name, valueType, pValue).Assignable()
65 CRYPTOPP_GET_FUNCTION_ENTRY(
Modulus)
73 AssignFromHelper(
this, source)
74 CRYPTOPP_SET_FUNCTION_ENTRY(
Modulus)
94 bool XTR_DH::Agree(byte *agreedValue,
const byte *privateKey,
const byte *otherPublicKey,
bool validateOtherPublicKey)
const 97 if (validateOtherPublicKey)
101 if (w.c1.IsNegative() || w.c2.IsNegative() || w.c1 >= m_p || w.c2 >= m_p || w == three)
103 if (XTR_Exponentiate(w, m_q, m_p) != three)
unsigned int PublicKeyLength() const
return length of public keys in this domain
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 Encode(byte *output, size_t outputLen, Signedness sign=UNSIGNED) const
Encode in big-endian format.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Interface for random number generators.
static const Integer & One()
Integer representing 1.
bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const
derive agreed value from your private key and couterparty's public key, return false in case of failu...
void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
generate public key
void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
generate private key
XTR-DH with key validation.
bool VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level=1)
Verifies a prime number.
unsigned int AgreedValueLength() const
return length of agreed value produced
Multiple precision integer with arithmetic operations.
const char * SubgroupGenerator()
Integer, ECP::Point, or EC2N::Point.
Classes and functions for working with ANS.1 objects.
Classes and functions for number theoretic operations.
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
"The XTR public key system" by Arjen K.
const char * Modulus()
Integer.
static const Integer & Zero()
Integer representing 0.
void BERDecode(const byte *input, size_t inputLen)
Decode from BER format.
Class file for performing modular arithmetic.
Crypto++ library namespace.
GF(p^2), optimal normal basis.
const char * SubgroupOrder()
Integer.
unsigned int PrivateKeyLength() const
return length of private keys in this domain
Interface for retrieving values given their names.