aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/x509.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/x509.cpp')
-rw-r--r--src/cli/x509.cpp16
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"));