aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorNuno Goncalves <[email protected]>2019-11-10 22:06:49 +0100
committerNuno Goncalves <[email protected]>2019-11-11 09:55:28 +0100
commitaab503c6d5194f8e886dff550998007e42e87642 (patch)
tree07543a02c22918966873de716a5333443534abd4 /src/cli
parentf2a3ad32bef63764a54e696bf93faeafd5ad8a3e (diff)
cli: pubkey: fingerprint: read from stdin
Signed-off-by: Nuno Goncalves <[email protected]>
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/pubkey.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp
index e141339ca..39923bc1f 100644
--- a/src/cli/pubkey.cpp
+++ b/src/cli/pubkey.cpp
@@ -159,11 +159,14 @@ class PK_Fingerprint final : public Command
for(std::string key_file : get_arg_list("keys"))
{
- std::unique_ptr<Botan::Public_Key> key(Botan::X509::load_key(key_file));
+ std::unique_ptr<Botan::Public_Key> key(
+ key_file == "-"
+ ? Botan::X509::load_key(this->slurp_file("-", 4096))
+ : Botan::X509::load_key(key_file));
const std::string fprint = key->fingerprint_public(hash_algo);
- if(no_fsname)
+ if(no_fsname || key_file == "-")
{ output() << fprint << "\n"; }
else
{ output() << key_file << ": " << fprint << "\n"; }