aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/pkcs8.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 03:22:35 +0000
committerlloyd <[email protected]>2010-03-04 03:22:35 +0000
commit76f39cc9fe4b2a3354db22f8beaf0c3788578b79 (patch)
treec25ddaf29f22dc29786487d606d68c2344c46f22 /src/pubkey/pkcs8.cpp
parentda09382f398dcf27a3ffdb82dd9f916ba96567ac (diff)
Add a new constructor to each public key algorithm (only the public
keys so far, private keys not changed) that takes an AlgorithmIdentifier and a MemoryRegion<byte>&. This performs the X.509 decoding. It is not possible anymore to create uninitialized PK objects.
Diffstat (limited to 'src/pubkey/pkcs8.cpp')
-rw-r--r--src/pubkey/pkcs8.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/pubkey/pkcs8.cpp b/src/pubkey/pkcs8.cpp
index 099d52ffa..c89431fca 100644
--- a/src/pubkey/pkcs8.cpp
+++ b/src/pubkey/pkcs8.cpp
@@ -1,6 +1,6 @@
/*
* PKCS #8
-* (C) 1999-2008 Jack Lloyd
+* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -240,21 +240,7 @@ Private_Key* load_key(DataSource& source,
throw PKCS8_Exception("Unknown algorithm OID: " +
alg_id.oid.as_string());
- std::auto_ptr<Private_Key> key(get_private_key(alg_name));
-
- if(!key.get())
- throw PKCS8_Exception("Unknown PK algorithm/OID: " + alg_name + ", " +
- alg_id.oid.as_string());
-
- std::auto_ptr<PKCS8_Decoder> decoder(key->pkcs8_decoder(rng));
-
- if(!decoder.get())
- throw Decoding_Error("Key does not support PKCS #8 decoding");
-
- decoder->alg_id(alg_id);
- decoder->key_bits(pkcs8_key);
-
- return key.release();
+ return make_private_key(alg_id, pkcs8_key, rng);
}
/*