diff options
author | René Korthaus <[email protected]> | 2016-09-23 17:46:53 +0200 |
---|---|---|
committer | René Korthaus <[email protected]> | 2016-09-23 17:46:53 +0200 |
commit | 37f88b4884d0ee47946d55f24fce4a72dd06052c (patch) | |
tree | db4ef1c33608a3c15984932d8e326799dcbab37e /src/cli/x509.cpp | |
parent | 4371450b5d0916234b57ff45d9dbde1ad731cf2a (diff) |
Make cli sign_cert key pass param optional
Diffstat (limited to 'src/cli/x509.cpp')
-rw-r--r-- | src/cli/x509.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/cli/x509.cpp b/src/cli/x509.cpp index 665a3ebc5..90979aa53 100644 --- a/src/cli/x509.cpp +++ b/src/cli/x509.cpp @@ -30,11 +30,19 @@ class Sign_Cert final : public Command void go() override { Botan::X509_Certificate ca_cert(get_arg("ca_cert")); + std::unique_ptr<Botan::PKCS8_PrivateKey> key; - std::unique_ptr<Botan::PKCS8_PrivateKey> key( - Botan::PKCS8::load_key(get_arg("ca_key"), - rng(), - get_arg("ca_key_pass"))); + if(flag_set("ca_key_pass")) + { + key.reset(Botan::PKCS8::load_key(get_arg("ca_key"), + rng(), + get_arg("ca_key_pass"))); + } + else + { + key.reset(Botan::PKCS8::load_key(get_arg("ca_key"), + rng())); + } if(!key) throw CLI_Error("Failed to load key from " + get_arg("ca_key")); |