diff options
-rw-r--r-- | src/pubkey/dl_algo/dl_algo.cpp | 30 | ||||
-rw-r--r-- | src/pubkey/dl_algo/dl_algo.h | 7 | ||||
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.cpp | 42 | ||||
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.h | 7 | ||||
-rw-r--r-- | src/pubkey/if_algo/if_algo.cpp | 43 | ||||
-rw-r--r-- | src/pubkey/if_algo/if_algo.h | 1 | ||||
-rw-r--r-- | src/pubkey/pk_keys.h | 7 | ||||
-rw-r--r-- | src/pubkey/pkcs8.h | 21 |
8 files changed, 0 insertions, 158 deletions
diff --git a/src/pubkey/dl_algo/dl_algo.cpp b/src/pubkey/dl_algo/dl_algo.cpp index 185e62cef..8e326ef6a 100644 --- a/src/pubkey/dl_algo/dl_algo.cpp +++ b/src/pubkey/dl_algo/dl_algo.cpp @@ -49,36 +49,6 @@ DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(const AlgorithmIdentifier& alg_id, } /* -* Return the PKCS #8 private key decoder -*/ -PKCS8_Decoder* DL_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) - { - class DL_Scheme_Decoder : public PKCS8_Decoder - { - public: - void alg_id(const AlgorithmIdentifier& alg_id) - { - DataSource_Memory source(alg_id.parameters); - key->group.BER_decode(source, key->group_format()); - } - - void key_bits(const MemoryRegion<byte>& bits) - { - BER_Decoder(bits).decode(key->x); - key->PKCS8_load_hook(rng); - } - - DL_Scheme_Decoder(DL_Scheme_PrivateKey* k, RandomNumberGenerator& r) : - key(k), rng(r) {} - private: - DL_Scheme_PrivateKey* key; - RandomNumberGenerator& rng; - }; - - return new DL_Scheme_Decoder(this, rng); - } - -/* * Check Public DL Parameters */ bool DL_Scheme_PublicKey::check_key(RandomNumberGenerator& rng, diff --git a/src/pubkey/dl_algo/dl_algo.h b/src/pubkey/dl_algo/dl_algo.h index 59690a33a..efd25c995 100644 --- a/src/pubkey/dl_algo/dl_algo.h +++ b/src/pubkey/dl_algo/dl_algo.h @@ -95,13 +95,6 @@ class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey, const MemoryRegion<byte>& key_bits, DL_Group::Format group_format); - /** - * Get an PKCS#8 decoder for this key. - * @param rng the rng to use - * @return an decoder usable to decode a DL key and store the - * values in this instance. - */ - PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator& rng); protected: DL_Scheme_PrivateKey() {} BigInt x; diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp index 4c91672d3..081649de3 100644 --- a/src/pubkey/ecc_key/ecc_key.cpp +++ b/src/pubkey/ecc_key/ecc_key.cpp @@ -162,48 +162,6 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id, public_key = domain().get_base_point() * private_key; } -/** -* Return the PKCS #8 public key decoder -*/ -PKCS8_Decoder* EC_PrivateKey::pkcs8_decoder(RandomNumberGenerator&) - { - class EC_Key_Decoder : public PKCS8_Decoder - { - public: - void alg_id(const AlgorithmIdentifier& alg_id) - { - key->domain_params = EC_Domain_Params(alg_id.parameters); - } - - void key_bits(const MemoryRegion<byte>& bits) - { - u32bit version; - SecureVector<byte> octstr_secret; - - BER_Decoder(bits) - .start_cons(SEQUENCE) - .decode(version) - .decode(octstr_secret, OCTET_STRING) - .verify_end() - .end_cons(); - - if(version != 1) - throw Decoding_Error("Wrong key format version for EC key"); - - key->private_key = BigInt::decode(octstr_secret, - octstr_secret.size()); - - key->PKCS8_load_hook(); - } - - EC_Key_Decoder(EC_PrivateKey* k): key(k) {} - private: - EC_PrivateKey* key; - }; - - return new EC_Key_Decoder(this); - } - void EC_PrivateKey::PKCS8_load_hook(bool) { public_key = domain().get_base_point() * private_key; diff --git a/src/pubkey/ecc_key/ecc_key.h b/src/pubkey/ecc_key/ecc_key.h index 283813236..e9cd7f68b 100644 --- a/src/pubkey/ecc_key/ecc_key.h +++ b/src/pubkey/ecc_key/ecc_key.h @@ -110,13 +110,6 @@ class BOTAN_DLL EC_PrivateKey : public virtual EC_PublicKey, MemoryVector<byte> pkcs8_private_key() 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 - */ - PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&); - - /** * Get the private key value of this key object. * @result the private key value of this key object */ diff --git a/src/pubkey/if_algo/if_algo.cpp b/src/pubkey/if_algo/if_algo.cpp index e31f6011f..a68a38ce7 100644 --- a/src/pubkey/if_algo/if_algo.cpp +++ b/src/pubkey/if_algo/if_algo.cpp @@ -79,49 +79,6 @@ IF_Scheme_PrivateKey::IF_Scheme_PrivateKey(const AlgorithmIdentifier&, } /* -* Return the PKCS #8 public key decoder -*/ -PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) - { - class IF_Scheme_Decoder : public PKCS8_Decoder - { - public: - void alg_id(const AlgorithmIdentifier&) {} - - void key_bits(const MemoryRegion<byte>& bits) - { - u32bit version; - - BER_Decoder(bits) - .start_cons(SEQUENCE) - .decode(version) - .decode(key->n) - .decode(key->e) - .decode(key->d) - .decode(key->p) - .decode(key->q) - .decode(key->d1) - .decode(key->d2) - .decode(key->c) - .end_cons(); - - if(version != 0) - throw Decoding_Error("Unknown PKCS #1 key format version"); - - key->PKCS8_load_hook(rng); - } - - IF_Scheme_Decoder(IF_Scheme_PrivateKey* k, RandomNumberGenerator& r) : - key(k), rng(r) {} - private: - IF_Scheme_PrivateKey* key; - RandomNumberGenerator& rng; - }; - - return new IF_Scheme_Decoder(this, rng); - } - -/* * Algorithm Specific X.509 Initialization Code */ void IF_Scheme_PublicKey::X509_load_hook() diff --git a/src/pubkey/if_algo/if_algo.h b/src/pubkey/if_algo/if_algo.h index c16627e73..d2fb7809d 100644 --- a/src/pubkey/if_algo/if_algo.h +++ b/src/pubkey/if_algo/if_algo.h @@ -85,7 +85,6 @@ class BOTAN_DLL IF_Scheme_PrivateKey : public virtual IF_Scheme_PublicKey, MemoryVector<byte> pkcs8_private_key() const; - PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&); protected: IF_Scheme_PrivateKey() {} diff --git a/src/pubkey/pk_keys.h b/src/pubkey/pk_keys.h index c6f652117..4e0f58b38 100644 --- a/src/pubkey/pk_keys.h +++ b/src/pubkey/pk_keys.h @@ -87,13 +87,6 @@ class BOTAN_DLL Private_Key : public virtual Public_Key */ virtual MemoryVector<byte> pkcs8_private_key() const = 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 - */ - virtual class PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&) - { return 0; } protected: void load_check(RandomNumberGenerator&) const; void gen_check(RandomNumberGenerator&) const; diff --git a/src/pubkey/pkcs8.h b/src/pubkey/pkcs8.h index 9488c2c0b..920f8c24a 100644 --- a/src/pubkey/pkcs8.h +++ b/src/pubkey/pkcs8.h @@ -13,27 +13,6 @@ namespace Botan { -/* -* PKCS #8 Private Key Decoder -*/ -class BOTAN_DLL PKCS8_Decoder - { - public: - /** - * Set the algorithm identifier associated with the scheme - * this decoders key is part of. - * @param alg_id the algorithm identifier - */ - virtual void alg_id(const AlgorithmIdentifier&) = 0; - - /** - * Set the DER encoded key. - * @param key the DER encoded key - */ - virtual void key_bits(const MemoryRegion<byte>&) = 0; - virtual ~PKCS8_Decoder() {} - }; - /** * PKCS #8 General Exception */ |