aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-15 02:01:53 +0000
committerlloyd <[email protected]>2010-06-15 02:01:53 +0000
commit2e37a86957c222972811928696f874bc1284cbbf (patch)
tree936f64ca3c779207f3d8601ebd411588730561c3
parent4fd2d810e6cd72fdc3ddd9ae3a72b1fdc7ac9c60 (diff)
Use X509::BER_encode. Saves 12 lines. Nice
-rw-r--r--src/cert/x509/x509self.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/cert/x509/x509self.cpp b/src/cert/x509/x509self.cpp
index 68221cb4d..e420ca503 100644
--- a/src/cert/x509/x509self.cpp
+++ b/src/cert/x509/x509self.cpp
@@ -18,22 +18,6 @@ namespace Botan {
namespace {
/*
-* Shared setup for self-signed items
-*/
-MemoryVector<byte> shared_setup(const X509_Cert_Options& opts,
- const Private_Key& key)
- {
- opts.sanity_check();
-
- Pipe key_encoder;
- key_encoder.start_msg();
- X509::encode(key, key_encoder, RAW_BER);
- key_encoder.end_msg();
-
- return key_encoder.read_all();
- }
-
-/*
* Load information from the X509_Cert_Options
*/
void load_info(const X509_Cert_Options& opts, X509_DN& subject_dn,
@@ -67,7 +51,9 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts,
X509_DN subject_dn;
AlternativeName subject_alt;
- MemoryVector<byte> pub_key = shared_setup(opts, key);
+ opts.sanity_check();
+
+ MemoryVector<byte> pub_key = X509::BER_encode(key);
std::auto_ptr<PK_Signer> signer(choose_sig_format(key, hash_fn, sig_algo));
load_info(opts, subject_dn, subject_alt);
@@ -111,7 +97,9 @@ PKCS10_Request create_cert_req(const X509_Cert_Options& opts,
X509_DN subject_dn;
AlternativeName subject_alt;
- MemoryVector<byte> pub_key = shared_setup(opts, key);
+ opts.sanity_check();
+
+ MemoryVector<byte> pub_key = X509::BER_encode(key);
std::auto_ptr<PK_Signer> signer(choose_sig_format(key, hash_fn, sig_algo));
load_info(opts, subject_dn, subject_alt);