diff options
author | Jack Lloyd <[email protected]> | 2018-08-02 16:46:17 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-02 16:46:17 -0400 |
commit | edf3f23ef452ee8235ddca0b8a3358da8036dc00 (patch) | |
tree | 5d92081f753a3bbca9ffaccc07bd4c8c7638cba8 /src/cli | |
parent | a574282bd588241257323b9cbe12ddc86485324d (diff) |
Add --no-fsname option to fingerprint command
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/pubkey.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp index c28a9fa42..8704fe1ad 100644 --- a/src/cli/pubkey.cpp +++ b/src/cli/pubkey.cpp @@ -117,7 +117,7 @@ std::string algo_default_emsa(const std::string& key) class PK_Fingerprint final : public Command { public: - PK_Fingerprint() : Command("fingerprint --algo=SHA-256 *keys") {} + PK_Fingerprint() : Command("fingerprint --no-fsname --algo=SHA-256 *keys") {} std::string group() const override { @@ -132,12 +132,18 @@ class PK_Fingerprint final : public Command void go() override { const std::string hash_algo = get_arg("algo"); + const bool no_fsname = flag_set("no-fsname"); for(std::string key_file : get_arg_list("keys")) { std::unique_ptr<Botan::Public_Key> key(Botan::X509::load_key(key_file)); - output() << key_file << ": " << key->fingerprint_public(hash_algo) << "\n"; + const std::string fprint = key->fingerprint_public(hash_algo); + + if(no_fsname) + output() << fprint << "\n"; + else + output() << key_file << ": " << fprint << "\n"; } } }; |