diff options
-rw-r--r-- | src/pubkey/dl_algo/dl_algo.cpp | 26 | ||||
-rw-r--r-- | src/pubkey/dl_algo/dl_algo.h | 6 | ||||
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.cpp | 33 | ||||
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.h | 6 | ||||
-rw-r--r-- | src/pubkey/if_algo/if_algo.cpp | 26 | ||||
-rw-r--r-- | src/pubkey/if_algo/if_algo.h | 1 | ||||
-rw-r--r-- | src/pubkey/pk_codecs/pkcs8.h | 22 | ||||
-rw-r--r-- | src/pubkey/pk_keys.h | 8 |
8 files changed, 4 insertions, 124 deletions
diff --git a/src/pubkey/dl_algo/dl_algo.cpp b/src/pubkey/dl_algo/dl_algo.cpp index bab535c69..f035f852f 100644 --- a/src/pubkey/dl_algo/dl_algo.cpp +++ b/src/pubkey/dl_algo/dl_algo.cpp @@ -57,32 +57,6 @@ MemoryVector<byte> DL_Scheme_PrivateKey::pkcs8_private_key() const } /* -* Return the PKCS #8 private key encoder -*/ -PKCS8_Encoder* DL_Scheme_PrivateKey::pkcs8_encoder() const - { - class DL_Scheme_Encoder : public PKCS8_Encoder - { - public: - AlgorithmIdentifier alg_id() const - { - return key->algorithm_identifier(); - } - - MemoryVector<byte> key_bits() const - { - return key->pkcs8_private_key(); - } - - DL_Scheme_Encoder(const DL_Scheme_PrivateKey* k) : key(k) {} - private: - const DL_Scheme_PrivateKey* key; - }; - - return new DL_Scheme_Encoder(this); - } - -/* * Return the PKCS #8 private key decoder */ PKCS8_Decoder* DL_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) diff --git a/src/pubkey/dl_algo/dl_algo.h b/src/pubkey/dl_algo/dl_algo.h index e06630011..9e5e46e2a 100644 --- a/src/pubkey/dl_algo/dl_algo.h +++ b/src/pubkey/dl_algo/dl_algo.h @@ -90,12 +90,6 @@ class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey, */ const BigInt& get_x() const { return x; } - /** - * Get an PKCS#8 encoder for this key. - * @return an encoder usable to encode this key. - */ - PKCS8_Encoder* pkcs8_encoder() const; - MemoryVector<byte> pkcs8_private_key() const; /** diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp index b09ddfdb7..2f98eb691 100644 --- a/src/pubkey/ecc_key/ecc_key.cpp +++ b/src/pubkey/ecc_key/ecc_key.cpp @@ -149,32 +149,6 @@ MemoryVector<byte> EC_PrivateKey::pkcs8_private_key() const } /** -* Return the PKCS #8 public key encoder -**/ -PKCS8_Encoder* EC_PrivateKey::pkcs8_encoder() const - { - class EC_Key_Encoder : public PKCS8_Encoder - { - public: - AlgorithmIdentifier alg_id() const - { - return key->algorithm_identifier(); - } - - MemoryVector<byte> key_bits() const - { - return key->pkcs8_private_key(); - } - - EC_Key_Encoder(const EC_PrivateKey* k): key(k) {} - private: - const EC_PrivateKey* key; - }; - - return new EC_Key_Encoder(this); - } - -/** * Return the PKCS #8 public key decoder */ PKCS8_Decoder* EC_PrivateKey::pkcs8_decoder(RandomNumberGenerator&) @@ -199,10 +173,11 @@ PKCS8_Decoder* EC_PrivateKey::pkcs8_decoder(RandomNumberGenerator&) .verify_end() .end_cons(); - key->private_key = BigInt::decode(octstr_secret, octstr_secret.size()); - if(version != 1) - throw Decoding_Error("Wrong PKCS #1 key format version for EC key"); + throw Decoding_Error("Wrong key format version for EC key"); + + key->private_key = BigInt::decode(octstr_secret, + octstr_secret.size()); key->PKCS8_load_hook(); } diff --git a/src/pubkey/ecc_key/ecc_key.h b/src/pubkey/ecc_key/ecc_key.h index 8fcb7454f..6f3ab6a01 100644 --- a/src/pubkey/ecc_key/ecc_key.h +++ b/src/pubkey/ecc_key/ecc_key.h @@ -113,12 +113,6 @@ class BOTAN_DLL EC_PrivateKey : public virtual EC_PublicKey, MemoryVector<byte> pkcs8_private_key() const; /** - * Get an PKCS#8 encoder that can be used to encoded this key. - * @result an PKCS#8 encoder for this key - */ - PKCS8_Encoder* pkcs8_encoder() const; - - /** * Get an PKCS#8 decoder that can be used to decoded a stored key into * this key. * @result an PKCS#8 decoder for this key diff --git a/src/pubkey/if_algo/if_algo.cpp b/src/pubkey/if_algo/if_algo.cpp index 1a1ade28e..201d7aa53 100644 --- a/src/pubkey/if_algo/if_algo.cpp +++ b/src/pubkey/if_algo/if_algo.cpp @@ -76,32 +76,6 @@ MemoryVector<byte> IF_Scheme_PrivateKey::pkcs8_private_key() const } /* -* Return the PKCS #8 public key encoder -*/ -PKCS8_Encoder* IF_Scheme_PrivateKey::pkcs8_encoder() const - { - class IF_Scheme_Encoder : public PKCS8_Encoder - { - public: - AlgorithmIdentifier alg_id() const - { - return key->algorithm_identifier(); - } - - MemoryVector<byte> key_bits() const - { - return key->pkcs8_private_key(); - } - - IF_Scheme_Encoder(const IF_Scheme_PrivateKey* k) : key(k) {} - private: - const IF_Scheme_PrivateKey* key; - }; - - return new IF_Scheme_Encoder(this); - } - -/* * Return the PKCS #8 public key decoder */ PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) diff --git a/src/pubkey/if_algo/if_algo.h b/src/pubkey/if_algo/if_algo.h index 254afc083..c58b693be 100644 --- a/src/pubkey/if_algo/if_algo.h +++ b/src/pubkey/if_algo/if_algo.h @@ -78,7 +78,6 @@ class BOTAN_DLL IF_Scheme_PrivateKey : public virtual IF_Scheme_PublicKey, MemoryVector<byte> pkcs8_private_key() const; - PKCS8_Encoder* pkcs8_encoder() const; PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&); protected: virtual void PKCS8_load_hook(RandomNumberGenerator&, bool = false); diff --git a/src/pubkey/pk_codecs/pkcs8.h b/src/pubkey/pk_codecs/pkcs8.h index adfad0e63..9488c2c0b 100644 --- a/src/pubkey/pk_codecs/pkcs8.h +++ b/src/pubkey/pk_codecs/pkcs8.h @@ -13,28 +13,6 @@ namespace Botan { -/** -* PKCS #8 Private Key Encoder. -*/ -class BOTAN_DLL PKCS8_Encoder - { - public: - /** - * Get the algorithm identifier associated with the scheme - * this encoders key is part of. - * @return the algorithm identifier - */ - virtual AlgorithmIdentifier alg_id() const = 0; - - /** - * Get the DER encoded key. - * @return the DER encoded key - */ - // FIXME: Why not SecureVector? - virtual MemoryVector<byte> key_bits() const = 0; - virtual ~PKCS8_Encoder() {} - }; - /* * PKCS #8 Private Key Decoder */ diff --git a/src/pubkey/pk_keys.h b/src/pubkey/pk_keys.h index 63302012c..f9448b8bd 100644 --- a/src/pubkey/pk_keys.h +++ b/src/pubkey/pk_keys.h @@ -95,14 +95,6 @@ class BOTAN_DLL Private_Key : public virtual Public_Key virtual MemoryVector<byte> pkcs8_private_key() const = 0; /** - * Get a PKCS#8 encoder that can be used to encode this key in - * PKCS#8 format. - * @return an PKCS#8 encoder for this key - */ - virtual class PKCS8_Encoder* pkcs8_encoder() const - { return 0; } - - /** * Get an PKCS#8 decoder that can be used to set the values of this key * based on an PKCS#8 encoded key object. * @return an PKCS#8 decoder for this key |