> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Amerson H Lin
> Sent: Thursday, November 27, 2003 2:03 AM
> To: [EMAIL PROTECTED]
> Subject: diffie hellman constructors
>
>
> Hi,
>
> i need some help with using diffie hellman constructors. I'm
> using crypto 5.1 on redhat 9.0.
>
> I use the following code to generate Alice's DH keys.
>
> AutoSeededRandomPool randPool = AutoSeededRandomPool();
> DH dh = DH((RandomNumberGenerator&)randPool, (unsigned)128);
>
> However, I need to generate Bob's DH class with the same
> generator. How can I do that? Is there any documentation on
> the DH constructors, if so, where can I find it?
>
> thanks
> amerson
>
>
Hi Amerson,
I've never used DH, but here are some references to Wei's use.
>From dh.h, Line 58:
void GeneratePublicKey(RandomNumberGenerator &rng, const byte
*privateKey, byte *publicKey) const
{
Base::GeneratePublicKey(rng, privateKey, publicKey);
if (FIPS_140_2_ComplianceEnabled())
{
SecByteBlock privateKey2(PrivateKeyLength());
GeneratePrivateKey(rng, privateKey2);
SecByteBlock publicKey2(PublicKeyLength());
Base::GeneratePublicKey(rng, privateKey2,
publicKey2);
SecByteBlock agreedValue(AgreedValueLength()),
agreedValue2(AgreedValueLength());
Agree(agreedValue, privateKey, publicKey2);
Agree(agreedValue2, privateKey2, publicKey);
if (agreedValue != agreedValue2)
throw SelfTestFailure(AlgorithmName() + ":
pairwise consistency test failed");
}
}
Agree( ) can be found in pubkey.h, Line 1427.
>From validat2.cpp, Line 338:
bool ValidateDH()
{
cout << "\nDH validation suite running...\n\n";
FileSource f("dh1024.dat", true, new HexDecoder());
DH dh(f);
return SimpleKeyAgreementValidate(dh);
}
Also from validate2.cpp:
SimpleKeyAgreementValidate( ) Line 181.
AuthenticatedKeyAgreementValidate( ) Line 217.
Jeff