diff options
author | lloyd <[email protected]> | 2006-09-06 07:06:27 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-06 07:06:27 +0000 |
commit | 7f176fd2259fcb395ca03751f19790eac15bd9ce (patch) | |
tree | 6c0c398a44cee6970a724c887eec15cdd8588b37 /include | |
parent | 747a5f4f1934c09e938315d4ae6fd0ff1cfcaa60 (diff) |
Implement codec objects for private keys as well.
Diffstat (limited to 'include')
-rw-r--r-- | include/dl_algo.h | 7 | ||||
-rw-r--r-- | include/if_algo.h | 6 | ||||
-rw-r--r-- | include/pkcs8.h | 28 |
3 files changed, 28 insertions, 13 deletions
diff --git a/include/dl_algo.h b/include/dl_algo.h index 8bcd704df..b72b3df42 100644 --- a/include/dl_algo.h +++ b/include/dl_algo.h @@ -54,11 +54,8 @@ class DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey, protected: BigInt x; private: - SecureVector<byte> DER_encode_priv() const; - void BER_decode_priv(DataSource&); - MemoryVector<byte> DER_encode_params() const; - void BER_decode_params(DataSource&); - + PKCS8_Encoder* pkcs8_encoder() const; + PKCS8_Decoder* pkcs8_decoder(); virtual void PKCS8_load_hook() {} }; diff --git a/include/if_algo.h b/include/if_algo.h index d8a0229fa..02f8763d8 100644 --- a/include/if_algo.h +++ b/include/if_algo.h @@ -53,10 +53,8 @@ class IF_Scheme_PrivateKey : public virtual IF_Scheme_PublicKey, virtual void PKCS8_load_hook(); BigInt d, p, q, d1, d2, c; private: - SecureVector<byte> DER_encode_priv() const; - void BER_decode_priv(DataSource&); - MemoryVector<byte> DER_encode_params() const; - void BER_decode_params(DataSource&); + PKCS8_Encoder* pkcs8_encoder() const; + PKCS8_Decoder* pkcs8_decoder(); }; } diff --git a/include/pkcs8.h b/include/pkcs8.h index b7ad9f344..5e3e1c097 100644 --- a/include/pkcs8.h +++ b/include/pkcs8.h @@ -12,15 +12,35 @@ namespace Botan { /************************************************* +* PKCS #8 Private Key Encoder * +*************************************************/ +class PKCS8_Encoder + { + public: + virtual AlgorithmIdentifier alg_id() const = 0; + virtual MemoryVector<byte> key_bits() const = 0; + virtual ~PKCS8_Encoder() {} + }; + +/************************************************* +* PKCS #8 Private Key Decoder * +*************************************************/ +class PKCS8_Decoder + { + public: + virtual void alg_id(const AlgorithmIdentifier&) = 0; + virtual void key_bits(const MemoryRegion<byte>&) = 0; + virtual ~PKCS8_Decoder() {} + }; + +/************************************************* * PKCS #8 Private Key * *************************************************/ 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_Encoder* pkcs8_encoder() const = 0; + virtual PKCS8_Decoder* pkcs8_decoder() = 0; virtual ~PKCS8_PrivateKey() {} }; |