aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/x509_key.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/x509_key.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/x509_key.cpp')
-rw-r--r--src/pubkey/x509_key.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/pubkey/x509_key.cpp b/src/pubkey/x509_key.cpp
index fdcfccf87..aaea8c943 100644
--- a/src/pubkey/x509_key.cpp
+++ b/src/pubkey/x509_key.cpp
@@ -10,7 +10,6 @@
#include <botan/asn1_obj.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
-#include <botan/oids.h>
#include <botan/pem.h>
#include <botan/internal/pk_algs.h>
#include <memory>
@@ -85,25 +84,7 @@ Public_Key* load_key(DataSource& source)
if(key_bits.empty())
throw Decoding_Error("X.509 public key decoding failed");
- const std::string alg_name = OIDS::lookup(alg_id.oid);
- if(alg_name == "")
- throw Decoding_Error("Unknown algorithm OID: " +
- alg_id.oid.as_string());
-
- std::auto_ptr<Public_Key> key_obj(get_public_key(alg_name));
- if(!key_obj.get())
- throw Decoding_Error("Unknown PK algorithm/OID: " + alg_name + ", " +
- alg_id.oid.as_string());
-
- std::auto_ptr<X509_Decoder> decoder(key_obj->x509_decoder());
-
- if(!decoder.get())
- throw Decoding_Error("Key does not support X.509 decoding");
-
- decoder->alg_id(alg_id);
- decoder->key_bits(key_bits);
-
- return key_obj.release();
+ return make_public_key(alg_id, key_bits);
}
catch(Decoding_Error)
{