diff options
author | lloyd <[email protected]> | 2006-09-07 03:15:11 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-07 03:15:11 +0000 |
commit | 3dd84dfbeb1fc7b3f4ca1385b9195efe210b8d05 (patch) | |
tree | 1b515342c8ede9e6d3612846f5ca02bbe10b3fb5 /include | |
parent | 34e84e5ba997949120e5c99011dbf4e770db1278 (diff) |
Make various member functions in the PK algorithms public, particularly
ones which were visible via base classes, and the empty constructors.
Diffstat (limited to 'include')
-rw-r--r-- | include/dh.h | 14 | ||||
-rw-r--r-- | include/dl_algo.h | 14 | ||||
-rw-r--r-- | include/dsa.h | 17 | ||||
-rw-r--r-- | include/elgamal.h | 13 | ||||
-rw-r--r-- | include/if_algo.h | 12 | ||||
-rw-r--r-- | include/nr.h | 17 | ||||
-rw-r--r-- | include/rsa.h | 10 | ||||
-rw-r--r-- | include/rw.h | 11 |
8 files changed, 45 insertions, 63 deletions
diff --git a/include/dh.h b/include/dh.h index 6ef519506..98890b62c 100644 --- a/include/dh.h +++ b/include/dh.h @@ -17,16 +17,16 @@ namespace Botan { class 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; - DH_PublicKey(const DL_Group&, const BigInt&); - protected: - std::string algo_name() const { return "DH"; } + DL_Group::Format group_format() const { return DL_Group::ANSI_X9_42; } + DH_PublicKey() {} + DH_PublicKey(const DL_Group&, const BigInt&); private: - friend Public_Key* get_public_key(const std::string&); - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_42; } void X509_load_hook(); }; @@ -44,13 +44,11 @@ class DH_PrivateKey : public DH_PublicKey, MemoryVector<byte> public_value() const; + DH_PrivateKey() {} DH_PrivateKey(const DL_Group&); DH_PrivateKey(const DL_Group&, const BigInt&, const BigInt& = 0); private: - friend Private_Key* get_private_key(const std::string&); void PKCS8_load_hook(bool = false); - DH_PrivateKey() {} - DH_Core core; }; diff --git a/include/dl_algo.h b/include/dl_algo.h index 5a12370f6..cd1486e13 100644 --- a/include/dl_algo.h +++ b/include/dl_algo.h @@ -22,20 +22,17 @@ class DL_Scheme_PublicKey : public virtual Public_Key const DL_Group& get_domain() const { return group; } const BigInt& get_y() const { return y; } - - virtual ~DL_Scheme_PublicKey() {} - protected: const BigInt& group_p() const { return group.get_p(); } const BigInt& group_q() const { return group.get_q(); } const BigInt& group_g() const { return group.get_g(); } virtual DL_Group::Format group_format() const = 0; + X509_Encoder* x509_encoder() const; + X509_Decoder* x509_decoder(); + protected: BigInt y; DL_Group group; private: - X509_Encoder* x509_encoder() const; - X509_Decoder* x509_decoder(); - virtual void X509_load_hook() {} }; @@ -50,12 +47,11 @@ class DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey, const BigInt& get_x() const { return x; } - virtual ~DL_Scheme_PrivateKey() {} + PKCS8_Encoder* pkcs8_encoder() const; + PKCS8_Decoder* pkcs8_decoder(); protected: BigInt x; private: - PKCS8_Encoder* pkcs8_encoder() const; - PKCS8_Decoder* pkcs8_decoder(); virtual void PKCS8_load_hook(bool = false) {} }; diff --git a/include/dsa.h b/include/dsa.h index f5aed4b9a..78fad6aae 100644 --- a/include/dsa.h +++ b/include/dsa.h @@ -18,20 +18,20 @@ class 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: - std::string algo_name() const { return "DSA"; } - DSA_PublicKey() {} - DSA_Core core; private: - friend Public_Key* get_public_key(const std::string&); - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_57; } - u32bit message_parts() const { return 2; } - u32bit message_part_size() const; void X509_load_hook(); }; @@ -47,12 +47,11 @@ class DSA_PrivateKey : public DSA_PublicKey, bool check_key(bool) const; + DSA_PrivateKey() {} DSA_PrivateKey(const DL_Group&); DSA_PrivateKey(const DL_Group&, const BigInt&, const BigInt& = 0); private: - friend Private_Key* get_private_key(const std::string&); void PKCS8_load_hook(bool = false); - DSA_PrivateKey() {} }; } diff --git a/include/elgamal.h b/include/elgamal.h index 9fb15b943..4d6a3f880 100644 --- a/include/elgamal.h +++ b/include/elgamal.h @@ -19,18 +19,18 @@ class ElGamal_PublicKey : public PK_Encrypting_Key, public virtual DL_Scheme_PublicKey { public: + std::string algo_name() const { return "ElGamal"; } + SecureVector<byte> encrypt(const byte[], u32bit) const; u32bit max_input_bits() const; + DL_Group::Format group_format() const { return DL_Group::ANSI_X9_42; } + + ElGamal_PublicKey() {} ElGamal_PublicKey(const DL_Group&, const BigInt&); protected: - std::string algo_name() const { return "ElGamal"; } - ElGamal_PublicKey() {} - ELG_Core core; private: - friend Public_Key* get_public_key(const std::string&); - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_42; } void X509_load_hook(); }; @@ -46,12 +46,11 @@ class ElGamal_PrivateKey : public ElGamal_PublicKey, bool check_key(bool) const; + ElGamal_PrivateKey() {} ElGamal_PrivateKey(const DL_Group&); ElGamal_PrivateKey(const DL_Group&, const BigInt&, const BigInt& = 0); private: - friend Private_Key* get_private_key(const std::string&); void PKCS8_load_hook(bool = false); - ElGamal_PrivateKey() {} }; } diff --git a/include/if_algo.h b/include/if_algo.h index fa60a9185..d67aa0311 100644 --- a/include/if_algo.h +++ b/include/if_algo.h @@ -25,14 +25,12 @@ class IF_Scheme_PublicKey : public virtual Public_Key u32bit max_input_bits() const { return (n.bits() - 1); } - virtual ~IF_Scheme_PublicKey() {} + X509_Encoder* x509_encoder() const; + X509_Decoder* x509_decoder(); protected: virtual void X509_load_hook(); BigInt n, e; IF_Core core; - private: - X509_Encoder* x509_encoder() const; - X509_Decoder* x509_decoder(); }; /************************************************* @@ -48,13 +46,11 @@ class IF_Scheme_PrivateKey : public virtual IF_Scheme_PublicKey, const BigInt& get_q() const { return q; } const BigInt& get_d() const { return d; } - virtual ~IF_Scheme_PrivateKey() {} + PKCS8_Encoder* pkcs8_encoder() const; + PKCS8_Decoder* pkcs8_decoder(); protected: virtual void PKCS8_load_hook(bool = false); BigInt d, p, q, d1, d2, c; - private: - PKCS8_Encoder* pkcs8_encoder() const; - PKCS8_Decoder* pkcs8_decoder(); }; } diff --git a/include/nr.h b/include/nr.h index a71d29f9f..490ae153c 100644 --- a/include/nr.h +++ b/include/nr.h @@ -18,20 +18,20 @@ class 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: - std::string algo_name() const { return "NR"; } - NR_PublicKey() {} - NR_Core core; private: - friend Public_Key* get_public_key(const std::string&); - DL_Group::Format group_format() const { return DL_Group::ANSI_X9_57; } - u32bit message_parts() const { return 2; } - u32bit message_part_size() const; void X509_load_hook(); }; @@ -47,12 +47,11 @@ class NR_PrivateKey : public NR_PublicKey, bool check_key(bool) const; + NR_PrivateKey() {} NR_PrivateKey(const DL_Group&); NR_PrivateKey(const DL_Group&, const BigInt&, const BigInt& = 0); private: - friend Private_Key* get_private_key(const std::string&); void PKCS8_load_hook(bool = false); - NR_PrivateKey() {} }; } diff --git a/include/rsa.h b/include/rsa.h index 776ddffec..ce1c9c988 100644 --- a/include/rsa.h +++ b/include/rsa.h @@ -18,16 +18,15 @@ class RSA_PublicKey : public PK_Encrypting_Key, public virtual IF_Scheme_PublicKey { public: + std::string algo_name() const { return "RSA"; } + SecureVector<byte> encrypt(const byte[], u32bit) const; SecureVector<byte> verify(const byte[], u32bit) const; + RSA_PublicKey() {} RSA_PublicKey(const BigInt&, const BigInt&); protected: BigInt public_op(const BigInt&) const; - std::string algo_name() const { return "RSA"; } - RSA_PublicKey() {} - private: - friend Public_Key* get_public_key(const std::string&); }; /************************************************* @@ -44,13 +43,12 @@ class RSA_PrivateKey : public RSA_PublicKey, bool check_key(bool) const; + RSA_PrivateKey() {} RSA_PrivateKey(const BigInt&, const BigInt&, const BigInt&, const BigInt& = 0, const BigInt& = 0); RSA_PrivateKey(u32bit, u32bit = 65537); private: - friend Private_Key* get_private_key(const std::string&); BigInt private_op(const byte[], u32bit) const; - RSA_PrivateKey() {} }; } diff --git a/include/rw.h b/include/rw.h index fb3378191..39992897a 100644 --- a/include/rw.h +++ b/include/rw.h @@ -17,15 +17,14 @@ class 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; - std::string algo_name() const { return "RW"; } - RW_PublicKey() {} - private: - friend Public_Key* get_public_key(const std::string&); }; /************************************************* @@ -40,12 +39,10 @@ class RW_PrivateKey : public RW_PublicKey, bool check_key(bool) const; + RW_PrivateKey() {} RW_PrivateKey(const BigInt&, const BigInt&, const BigInt&, const BigInt& = 0, const BigInt& = 0); RW_PrivateKey(u32bit, u32bit = 2); - private: - friend Private_Key* get_private_key(const std::string&); - RW_PrivateKey() {} }; } |