9 NAMESPACE_BEGIN(CryptoPP)
12 : m_p(p), m_q(q), m_g(g)
18 XTR_FindPrimesAndGenerator(rng, m_p, m_q, m_g, pbits, qbits);
26 m_g.c1.BERDecode(seq);
27 m_g.c2.BERDecode(seq);
47 pass = pass && !(m_g.c1.IsNegative() || m_g.c2.IsNegative() || m_g.c1 >= m_p || m_g.c2 >= m_p || m_g == three);
49 pass = pass && ((m_p.Squared()-m_p+1)%m_q).IsZero();
52 pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2);
53 pass = pass && XTR_Exponentiate(m_g, (m_p.Squared()-m_p+1)/m_q, m_p) != three;
54 pass = pass && XTR_Exponentiate(m_g, m_q, m_p) == three;
61 return GetValueHelper(
this, name, valueType, pValue).Assignable()
62 CRYPTOPP_GET_FUNCTION_ENTRY(Modulus)
63 CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupOrder)
64 CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupGenerator)
70 AssignFromHelper(
this, source)
71 CRYPTOPP_SET_FUNCTION_ENTRY(Modulus)
72 CRYPTOPP_SET_FUNCTION_ENTRY(SubgroupOrder)
73 CRYPTOPP_SET_FUNCTION_ENTRY(SubgroupGenerator)
90 bool XTR_DH::Agree(byte *agreedValue,
const byte *privateKey,
const byte *otherPublicKey,
bool validateOtherPublicKey)
const
93 if (validateOtherPublicKey)
97 if (w.c1.IsNegative() || w.c2.IsNegative() || w.c1 >= m_p || w.c2 >= m_p || w == three)
99 if (XTR_Exponentiate(w, m_q, m_p) != three)