diff options
author | lloyd <[email protected]> | 2008-09-28 20:41:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 20:41:59 +0000 |
commit | 062e7a3dc98af064792967cfac44f61b0e7b0d8a (patch) | |
tree | d8902fae073fd8268424ab804ae9d26b1fd3339d /include | |
parent | 25995ac07f9630b3e1da2c503054b9307b3fd788 (diff) |
Modularize the public key algorithms, though currently a great deal of
the underlying implementation goop remains in the core library instead of
being shunted off, due to various dependencies it has (most of which it
shouldn't).
Diffstat (limited to 'include')
-rw-r--r-- | include/dh.h | 57 | ||||
-rw-r--r-- | include/dsa.h | 60 | ||||
-rw-r--r-- | include/elgamal.h | 57 | ||||
-rw-r--r-- | include/nr.h | 61 | ||||
-rw-r--r-- | include/rsa.h | 63 | ||||
-rw-r--r-- | include/rw.h | 54 |
6 files changed, 0 insertions, 352 deletions
diff --git a/include/dh.h b/include/dh.h deleted file mode 100644 index 17a3fcae1..000000000 --- a/include/dh.h +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************* -* Diffie-Hellman Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_DIFFIE_HELLMAN_H__ -#define BOTAN_DIFFIE_HELLMAN_H__ - -#include <botan/dl_algo.h> -#include <botan/pk_core.h> - -namespace Botan { - -/************************************************* -* Diffie-Hellman Public Key * -*************************************************/ -class BOTAN_DLL DH_PublicKey : public virtual DL_Scheme_PublicKey - { - public: - std::string algo_name() const { return "DH"; } - - MemoryVector<byte> public_value() const; - u32bit max_input_bits() const; - - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_42; } - - DH_PublicKey() {} - DH_PublicKey(const DL_Group&, const BigInt&); - private: - void X509_load_hook(); - }; - -/************************************************* -* Diffie-Hellman Private Key * -*************************************************/ -class BOTAN_DLL DH_PrivateKey : public DH_PublicKey, - public PK_Key_Agreement_Key, - public virtual DL_Scheme_PrivateKey - { - public: - SecureVector<byte> derive_key(const byte[], u32bit) const; - SecureVector<byte> derive_key(const DH_PublicKey&) const; - SecureVector<byte> derive_key(const BigInt&) const; - - MemoryVector<byte> public_value() const; - - DH_PrivateKey() {} - DH_PrivateKey(RandomNumberGenerator&, const DL_Group&, - const BigInt& = 0); - private: - void PKCS8_load_hook(RandomNumberGenerator&, bool = false); - DH_Core core; - }; - -} - -#endif diff --git a/include/dsa.h b/include/dsa.h deleted file mode 100644 index 59776147b..000000000 --- a/include/dsa.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************* -* DSA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_DSA_H__ -#define BOTAN_DSA_H__ - -#include <botan/dl_algo.h> -#include <botan/pk_core.h> - -namespace Botan { - -/************************************************* -* DSA Public Key * -*************************************************/ -class BOTAN_DLL DSA_PublicKey : public PK_Verifying_wo_MR_Key, - public virtual DL_Scheme_PublicKey - { - public: - std::string algo_name() const { return "DSA"; } - - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_57; } - u32bit message_parts() const { return 2; } - u32bit message_part_size() const; - - bool verify(const byte[], u32bit, const byte[], u32bit) const; - u32bit max_input_bits() const; - - DSA_PublicKey() {} - DSA_PublicKey(const DL_Group&, const BigInt&); - protected: - DSA_Core core; - private: - void X509_load_hook(); - }; - -/************************************************* -* DSA Private Key * -*************************************************/ -class BOTAN_DLL DSA_PrivateKey : public DSA_PublicKey, - public PK_Signing_Key, - public virtual DL_Scheme_PrivateKey - { - public: - SecureVector<byte> sign(const byte[], u32bit, - RandomNumberGenerator& rng) const; - - bool check_key(RandomNumberGenerator& rng, bool) const; - - DSA_PrivateKey() {} - DSA_PrivateKey(RandomNumberGenerator&, const DL_Group&, - const BigInt& = 0); - private: - void PKCS8_load_hook(RandomNumberGenerator& rng, bool = false); - }; - -} - -#endif diff --git a/include/elgamal.h b/include/elgamal.h deleted file mode 100644 index feeeb3953..000000000 --- a/include/elgamal.h +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************* -* ElGamal Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_ELGAMAL_H__ -#define BOTAN_ELGAMAL_H__ - -#include <botan/dl_algo.h> -#include <botan/pk_core.h> - -namespace Botan { - -/************************************************* -* ElGamal Public Key * -*************************************************/ -class BOTAN_DLL ElGamal_PublicKey : public PK_Encrypting_Key, - public virtual DL_Scheme_PublicKey - { - public: - std::string algo_name() const { return "ElGamal"; } - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_42; } - - SecureVector<byte> encrypt(const byte[], u32bit, - RandomNumberGenerator& rng) const; - u32bit max_input_bits() const; - - ElGamal_PublicKey() {} - ElGamal_PublicKey(const DL_Group&, const BigInt&); - protected: - ELG_Core core; - private: - void X509_load_hook(); - }; - -/************************************************* -* ElGamal Private Key * -*************************************************/ -class BOTAN_DLL ElGamal_PrivateKey : public ElGamal_PublicKey, - public PK_Decrypting_Key, - public virtual DL_Scheme_PrivateKey - { - public: - SecureVector<byte> decrypt(const byte[], u32bit) const; - - bool check_key(RandomNumberGenerator& rng, bool) const; - - ElGamal_PrivateKey() {} - ElGamal_PrivateKey(RandomNumberGenerator&, const DL_Group&, - const BigInt& = 0); - private: - void PKCS8_load_hook(RandomNumberGenerator&, bool = false); - }; - -} - -#endif diff --git a/include/nr.h b/include/nr.h deleted file mode 100644 index 0b68340d6..000000000 --- a/include/nr.h +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************* -* Nyberg-Rueppel Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_NYBERG_RUEPPEL_H__ -#define BOTAN_NYBERG_RUEPPEL_H__ - -#include <botan/dl_algo.h> -#include <botan/pk_core.h> - -namespace Botan { - -/************************************************* -* Nyberg-Rueppel Public Key * -*************************************************/ -class BOTAN_DLL NR_PublicKey : public PK_Verifying_with_MR_Key, - public virtual DL_Scheme_PublicKey - { - public: - std::string algo_name() const { return "NR"; } - - SecureVector<byte> verify(const byte[], u32bit) const; - u32bit max_input_bits() const; - - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_57; } - u32bit message_parts() const { return 2; } - u32bit message_part_size() const; - - NR_PublicKey() {} - NR_PublicKey(const DL_Group&, const BigInt&); - protected: - NR_Core core; - private: - void X509_load_hook(); - }; - -/************************************************* -* Nyberg-Rueppel Private Key * -*************************************************/ -class BOTAN_DLL NR_PrivateKey : public NR_PublicKey, - public PK_Signing_Key, - public virtual DL_Scheme_PrivateKey - { - public: - SecureVector<byte> sign(const byte[], u32bit, - RandomNumberGenerator& rng) const; - - bool check_key(RandomNumberGenerator& rng, bool) const; - - NR_PrivateKey() {} - - NR_PrivateKey(RandomNumberGenerator&, const DL_Group&, - const BigInt& = 0); - private: - void PKCS8_load_hook(RandomNumberGenerator&, bool = false); - }; - -} - -#endif diff --git a/include/rsa.h b/include/rsa.h deleted file mode 100644 index 445902a6f..000000000 --- a/include/rsa.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************* -* RSA Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_RSA_H__ -#define BOTAN_RSA_H__ - -#include <botan/if_algo.h> - -namespace Botan { - -/************************************************* -* RSA Public Key * -*************************************************/ -class BOTAN_DLL RSA_PublicKey : public PK_Encrypting_Key, - public PK_Verifying_with_MR_Key, - public virtual IF_Scheme_PublicKey - { - public: - std::string algo_name() const { return "RSA"; } - - SecureVector<byte> encrypt(const byte[], u32bit, - RandomNumberGenerator& rng) const; - - SecureVector<byte> verify(const byte[], u32bit) const; - - RSA_PublicKey() {} - RSA_PublicKey(const BigInt&, const BigInt&); - protected: - BigInt public_op(const BigInt&) const; - }; - -/************************************************* -* RSA Private Key * -*************************************************/ -class BOTAN_DLL RSA_PrivateKey : public RSA_PublicKey, - public PK_Decrypting_Key, - public PK_Signing_Key, - public IF_Scheme_PrivateKey - { - public: - SecureVector<byte> sign(const byte[], u32bit, - RandomNumberGenerator&) const; - - SecureVector<byte> decrypt(const byte[], u32bit) const; - - bool check_key(RandomNumberGenerator& rng, bool) const; - - RSA_PrivateKey() {} - - RSA_PrivateKey(RandomNumberGenerator&, - const BigInt& p, const BigInt& q, const BigInt& e, - const BigInt& d = 0, const BigInt& n = 0); - - RSA_PrivateKey(RandomNumberGenerator&, u32bit bits, u32bit = 65537); - private: - BigInt private_op(const byte[], u32bit) const; - }; - -} - -#endif diff --git a/include/rw.h b/include/rw.h deleted file mode 100644 index d9f95eaa9..000000000 --- a/include/rw.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************* -* Rabin-Williams Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_RW_H__ -#define BOTAN_RW_H__ - -#include <botan/if_algo.h> - -namespace Botan { - -/************************************************* -* Rabin-Williams Public Key * -*************************************************/ -class BOTAN_DLL RW_PublicKey : public PK_Verifying_with_MR_Key, - public virtual IF_Scheme_PublicKey - { - public: - std::string algo_name() const { return "RW"; } - - SecureVector<byte> verify(const byte[], u32bit) const; - - RW_PublicKey() {} - RW_PublicKey(const BigInt&, const BigInt&); - protected: - BigInt public_op(const BigInt&) const; - }; - -/************************************************* -* Rabin-Williams Private Key * -*************************************************/ -class BOTAN_DLL RW_PrivateKey : public RW_PublicKey, - public PK_Signing_Key, - public IF_Scheme_PrivateKey - { - public: - SecureVector<byte> sign(const byte[], u32bit, - RandomNumberGenerator& rng) const; - - bool check_key(RandomNumberGenerator& rng, bool) const; - - RW_PrivateKey() {} - - RW_PrivateKey(RandomNumberGenerator&, - const BigInt&, const BigInt&, const BigInt&, - const BigInt& = 0, const BigInt& = 0); - - RW_PrivateKey(RandomNumberGenerator& rng, u32bit bits, u32bit = 2); - }; - -} - -#endif |