diff options
Diffstat (limited to 'src/cli/x509.cpp')
-rw-r--r-- | src/cli/x509.cpp | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/cli/x509.cpp b/src/cli/x509.cpp index add73a466..886b57259 100644 --- a/src/cli/x509.cpp +++ b/src/cli/x509.cpp @@ -8,7 +8,6 @@ #if defined(BOTAN_HAS_X509_CERTIFICATES) -#include <botan/auto_rng.h> #include <botan/certstor.h> #include <botan/pkcs8.h> #include <botan/x509_ca.h> @@ -30,13 +29,11 @@ class Sign_Cert : public Command void go() override { - Botan::AutoSeeded_RNG rng; - Botan::X509_Certificate ca_cert(get_arg("ca_cert")); std::unique_ptr<Botan::PKCS8_PrivateKey> key( Botan::PKCS8::load_key(get_arg("ca_key"), - rng, + rng(), get_arg("ca_key_pass"))); if(!key) @@ -54,14 +51,14 @@ class Sign_Cert : public Command Botan::X509_Time end_time(now + days(get_arg_sz("duration"))); - Botan::X509_Certificate new_cert = ca.sign_request(req, rng, + Botan::X509_Certificate new_cert = ca.sign_request(req, rng(), start_time, end_time); output() << new_cert.PEM_encode(); } }; -BOTAN_REGISTER_COMMAND(Sign_Cert); +BOTAN_REGISTER_COMMAND("sign_cert", Sign_Cert); class Cert_Info : public Command { @@ -75,7 +72,7 @@ class Cert_Info : public Command } }; -BOTAN_REGISTER_COMMAND(Cert_Info); +BOTAN_REGISTER_COMMAND("cert_info", Cert_Info); #if defined(BOTAN_HAS_OCSP) class OCSP_Check : public Command @@ -106,7 +103,7 @@ class OCSP_Check : public Command } }; -BOTAN_REGISTER_COMMAND(OCSP_Check); +BOTAN_REGISTER_COMMAND("ocsp_check", OCSP_Check); #endif // OCSP @@ -143,7 +140,7 @@ class Cert_Verify : public Command } }; -BOTAN_REGISTER_COMMAND(Cert_Verify); +BOTAN_REGISTER_COMMAND("cert_verify", Cert_Verify); class Gen_Self_Signed : public Command { @@ -153,11 +150,9 @@ class Gen_Self_Signed : public Command void go() override { - Botan::AutoSeeded_RNG rng; - std::unique_ptr<Botan::Private_Key> key( Botan::PKCS8::load_key(get_arg("key"), - rng, + rng(), get_arg("key-pass"))); if(!key) @@ -175,13 +170,13 @@ class Gen_Self_Signed : public Command opts.CA_key(); Botan::X509_Certificate cert = - Botan::X509::create_self_signed_cert(opts, *key, get_arg("hash"), rng); + Botan::X509::create_self_signed_cert(opts, *key, get_arg("hash"), rng()); output() << cert.PEM_encode(); } }; -BOTAN_REGISTER_COMMAND(Gen_Self_Signed); +BOTAN_REGISTER_COMMAND("gen_self_signed", Gen_Self_Signed); class Generate_PKCS10 : public Command { @@ -191,11 +186,9 @@ class Generate_PKCS10 : public Command void go() override { - Botan::AutoSeeded_RNG rng; - std::unique_ptr<Botan::Private_Key> key( Botan::PKCS8::load_key(get_arg("key"), - rng, + rng(), get_arg("key-pass"))); if(!key) @@ -211,13 +204,13 @@ class Generate_PKCS10 : public Command Botan::PKCS10_Request req = Botan::X509::create_cert_req(opts, *key, get_arg("hash"), - rng); + rng()); output() << req.PEM_encode(); } }; -BOTAN_REGISTER_COMMAND(Generate_PKCS10); +BOTAN_REGISTER_COMMAND("gen_pkcs10", Generate_PKCS10); } |