Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

dh2.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_DH2_H
00002 #define CRYPTOPP_DH2_H
00003 
00007 #include "cryptlib.h"
00008 
00009 NAMESPACE_BEGIN(CryptoPP)
00010 
00012 class DH2 : public PK_AuthenticatedKeyAgreementDomain
00013 {
00014 public:
00015         DH2(const PK_SimpleKeyAgreementDomain &domain)
00016                 : d1(domain), d2(domain) {}
00017         DH2(const PK_SimpleKeyAgreementDomain &staticDomain, const PK_SimpleKeyAgreementDomain &ephemeralDomain)
00018                 : d1(staticDomain), d2(ephemeralDomain) {}
00019 
00020         bool ValidateDomainParameters(RandomNumberGenerator &rng) const
00021                 {return d1.ValidateDomainParameters(rng) && d2.ValidateDomainParameters(rng);}
00022         unsigned int AgreedValueLength() const
00023                 {return d1.AgreedValueLength() + d2.AgreedValueLength();}
00024 
00025         unsigned int StaticPrivateKeyLength() const
00026                 {return d1.PrivateKeyLength();}
00027         unsigned int StaticPublicKeyLength() const
00028                 {return d1.PublicKeyLength();}
00029         void GenerateStaticKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
00030                 {d1.GenerateKeyPair(rng, privateKey, publicKey);}
00031 
00032         unsigned int EphemeralPrivateKeyLength() const
00033                 {return d2.PrivateKeyLength();}
00034         unsigned int EphemeralPublicKeyLength() const
00035                 {return d2.PublicKeyLength();}
00036         void GenerateEphemeralKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
00037                 {d2.GenerateKeyPair(rng, privateKey, publicKey);}
00038 
00039         bool Agree(byte *agreedValue,
00040                 const byte *staticPrivateKey, const byte *ephemeralPrivateKey, 
00041                 const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
00042                 bool validateStaticOtherPublicKey=true) const;
00043 
00044 protected:
00045         const PK_SimpleKeyAgreementDomain &d1, &d2;
00046 };
00047 
00048 NAMESPACE_END
00049 
00050 #endif

Generated at Mon Jan 15 01:16:31 2001 for Crypto++ by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000