diff options
author | Jack Lloyd <[email protected]> | 2018-05-03 22:40:21 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-05-03 22:40:21 -0400 |
commit | c86f83c1e5a3c54b6c4e72a728af9cd63c1ba5a2 (patch) | |
tree | 76d412599c794562fe9fa6a28917cfe78e29f800 /src/cli | |
parent | d1227f830ee37b3d67e79aaa85df73b338931135 (diff) |
Let pkcs8 command line util accept '-' for stdin
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/pubkey.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp index 60119ca13..a72ff68e6 100644 --- a/src/cli/pubkey.cpp +++ b/src/cli/pubkey.cpp @@ -18,6 +18,7 @@ #include <botan/pkcs8.h> #include <botan/pubkey.h> #include <botan/workfactor.h> +#include <botan/data_src.h> #if defined(BOTAN_HAS_DL_GROUP) #include <botan/dl_group.h> @@ -256,16 +257,18 @@ class PKCS8_Tool final : public Command void go() override { + const std::string pass_in = get_arg("pass-in"); + + Botan::DataSource_Memory key_src(slurp_file(get_arg("key"))); std::unique_ptr<Botan::Private_Key> key; - std::string pass_in = get_arg("pass-in"); if(pass_in.empty()) { - key.reset(Botan::PKCS8::load_key(get_arg("key"), rng())); + key.reset(Botan::PKCS8::load_key(key_src, rng())); } else { - key.reset(Botan::PKCS8::load_key(get_arg("key"), rng(), pass_in)); + key.reset(Botan::PKCS8::load_key(key_src, rng(), pass_in)); } const std::chrono::milliseconds pbe_millis(get_arg_sz("pbe-millis")); |