diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/dl_algo.h | 10 | ||||
-rw-r--r-- | include/if_algo.h | 8 | ||||
-rw-r--r-- | include/pkcs8.h | 2 | ||||
-rw-r--r-- | include/x509_key.h | 30 |
4 files changed, 37 insertions, 13 deletions
diff --git a/include/dl_algo.h b/include/dl_algo.h index ccb8a05a0..8bcd704df 100644 --- a/include/dl_algo.h +++ b/include/dl_algo.h @@ -28,16 +28,14 @@ class DL_Scheme_PublicKey : public virtual X509_PublicKey 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; BigInt y; DL_Group group; private: - MemoryVector<byte> DER_encode_pub() const; - MemoryVector<byte> DER_encode_params() const; - void BER_decode_pub(DataSource&); - void BER_decode_params(DataSource&); + X509_Encoder* x509_encoder() const; + X509_Decoder* x509_decoder(); - virtual DL_Group::Format group_format() const = 0; virtual void X509_load_hook() {} }; @@ -58,6 +56,8 @@ class DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey, private: SecureVector<byte> DER_encode_priv() const; void BER_decode_priv(DataSource&); + MemoryVector<byte> DER_encode_params() const; + void BER_decode_params(DataSource&); virtual void PKCS8_load_hook() {} }; diff --git a/include/if_algo.h b/include/if_algo.h index 323d58256..d8a0229fa 100644 --- a/include/if_algo.h +++ b/include/if_algo.h @@ -31,10 +31,8 @@ class IF_Scheme_PublicKey : public virtual X509_PublicKey BigInt n, e; IF_Core core; private: - MemoryVector<byte> DER_encode_pub() const; - MemoryVector<byte> DER_encode_params() const; - void BER_decode_params(DataSource&); - void BER_decode_pub(DataSource&); + X509_Encoder* x509_encoder() const; + X509_Decoder* x509_decoder(); }; /************************************************* @@ -57,6 +55,8 @@ class IF_Scheme_PrivateKey : public virtual IF_Scheme_PublicKey, private: SecureVector<byte> DER_encode_priv() const; void BER_decode_priv(DataSource&); + MemoryVector<byte> DER_encode_params() const; + void BER_decode_params(DataSource&); }; } diff --git a/include/pkcs8.h b/include/pkcs8.h index dc70acbe4..b7ad9f344 100644 --- a/include/pkcs8.h +++ b/include/pkcs8.h @@ -19,6 +19,8 @@ class PKCS8_PrivateKey : public virtual X509_PublicKey public: virtual SecureVector<byte> DER_encode_priv() const = 0; virtual void BER_decode_priv(DataSource&) = 0; + virtual MemoryVector<byte> DER_encode_params() const = 0; + virtual void BER_decode_params(DataSource&) = 0; virtual ~PKCS8_PrivateKey() {} }; diff --git a/include/x509_key.h b/include/x509_key.h index b55ba69cc..330444097 100644 --- a/include/x509_key.h +++ b/include/x509_key.h @@ -8,20 +8,42 @@ #include <botan/pipe.h> #include <botan/pk_keys.h> +#include <botan/alg_id.h> namespace Botan { /************************************************* +* X.509 Public Key Encoder * +*************************************************/ +class X509_Encoder + { + public: + virtual AlgorithmIdentifier alg_id() const = 0; + virtual MemoryVector<byte> key_bits() const = 0; + virtual ~X509_Encoder() {} + }; + +/************************************************* +* X.509 Public Key Decoder * +*************************************************/ +class X509_Decoder + { + public: + virtual void alg_id(const AlgorithmIdentifier&) = 0; + virtual void key_bits(const MemoryRegion<byte>&) = 0; + virtual ~X509_Decoder() {} + }; + +/************************************************* * X.509 Public Key * *************************************************/ class X509_PublicKey : public virtual PK_Key { public: u64bit key_id() const; - virtual MemoryVector<byte> DER_encode_pub() const = 0; - virtual MemoryVector<byte> DER_encode_params() const = 0; - virtual void BER_decode_pub(DataSource&) = 0; - virtual void BER_decode_params(DataSource&) = 0; + + virtual X509_Encoder* x509_encoder() const = 0; + virtual X509_Decoder* x509_decoder() = 0; virtual ~X509_PublicKey() {} }; |