aboutsummaryrefslogtreecommitdiffstats
path: root/src/cert/x509/x509self.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cert/x509/x509self.cpp')
-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 d87c5e060..6e570d3b6 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::unique_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::unique_ptr<PK_Signer> signer(choose_sig_format(key, hash_fn, sig_algo));
load_info(opts, subject_dn, subject_alt);