00001 #ifndef CRYPTOPP_BLUMGOLD_H
00002 #define CRYPTOPP_BLUMGOLD_H
00003
00007 #include "cryptlib.h"
00008 #include "integer.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00013 class BlumGoldwasserPublicKey : public PK_Encryptor
00014 {
00015 public:
00016
00017
00018 BlumGoldwasserPublicKey(const Integer &n);
00019 BlumGoldwasserPublicKey(BufferedTransformation &bt);
00020
00021 void DEREncode(BufferedTransformation &bt) const;
00022
00023 void Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText);
00024
00025 unsigned int MaxPlainTextLength(unsigned int cipherTextLength) const;
00026 unsigned int CipherTextLength(unsigned int plainTextLength) const;
00027
00028 protected:
00029 BlumGoldwasserPublicKey() {}
00030
00031 Integer n;
00032 unsigned int modulusLen;
00033 };
00034
00036 class BlumGoldwasserPrivateKey : public BlumGoldwasserPublicKey, public PK_Decryptor
00037 {
00038 public:
00039 BlumGoldwasserPrivateKey(const Integer &n, const Integer &p, const Integer &q, const Integer &u);
00040
00041 BlumGoldwasserPrivateKey(RandomNumberGenerator &rng, unsigned int keybits);
00042 BlumGoldwasserPrivateKey(BufferedTransformation &bt);
00043
00044 void DEREncode(BufferedTransformation &bt) const;
00045
00046 unsigned int Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText);
00047
00048 protected:
00049 Integer p, q, u;
00050 };
00051
00052 NAMESPACE_END
00053
00054 #endif