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

dh.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_DH_H
00002 #define CRYPTOPP_DH_H
00003 
00007 #include "modexppc.h"
00008 
00009 NAMESPACE_BEGIN(CryptoPP)
00010 
00012 class DH : public PK_WithPrecomputation<PK_SimpleKeyAgreementDomain>
00013 {
00014 public:
00015         DH(const Integer &p, const Integer &g);
00016         DH(RandomNumberGenerator &rng, unsigned int pbits);
00017         DH(BufferedTransformation &domainParams);
00018 
00019         void DEREncode(BufferedTransformation &domainParams) const;
00020 
00021         void Precompute(unsigned int precomputationStorage=16);
00022         void LoadPrecomputation(BufferedTransformation &storedPrecomputation);
00023         void SavePrecomputation(BufferedTransformation &storedPrecomputation) const;
00024 
00025         bool ValidateDomainParameters(RandomNumberGenerator &rng) const;
00026         unsigned int AgreedValueLength() const {return p.ByteCount();}
00027         unsigned int PrivateKeyLength() const {return p.ByteCount();}
00028         unsigned int PublicKeyLength() const {return p.ByteCount();}
00029 
00030         void GenerateKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const;
00031         bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const;
00032 
00033         const Integer &GetPrime() const {return p;}
00034         const Integer &GetGenerator() const {return g;}
00035 
00036 private:
00037         unsigned int ExponentBitLength() const;
00038 
00039         Integer p, g;
00040         ModExpPrecomputation gpc;
00041 };
00042 
00043 NAMESPACE_END
00044 
00045 #endif

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