aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/utils.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-07-04 12:45:39 -0400
committerJack Lloyd <[email protected]>2018-07-04 12:47:59 -0400
commit90c91d724b44a4aff6ffddddee38376593d5769d (patch)
tree9c29bc3d038524c56d5fe791d8ebcfd12514f4a0 /src/cli/utils.cpp
parentcd47debfa1747907d4627ecbbb24002b708167bd (diff)
More CLI tests
Diffstat (limited to 'src/cli/utils.cpp')
-rw-r--r--src/cli/utils.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp
index 4d6bcf047..2e096f586 100644
--- a/src/cli/utils.cpp
+++ b/src/cli/utils.cpp
@@ -596,7 +596,7 @@ BOTAN_REGISTER_COMMAND("check_bcrypt", Check_Bcrypt);
class HMAC final : public Command
{
public:
- HMAC() : Command("hmac --hash=SHA-256 --buf-size=4096 key *files") {}
+ HMAC() : Command("hmac --hash=SHA-256 --buf-size=4096 --no-fsname key *files") {}
std::string group() const override
{
@@ -610,6 +610,7 @@ class HMAC final : public Command
void go() override
{
+ const bool no_fsname = flag_set("no-fsname");
const std::string hash_algo = get_arg("hash");
std::unique_ptr<Botan::MessageAuthenticationCode> hmac =
Botan::MessageAuthenticationCode::create("HMAC(" + hash_algo + ")");
@@ -631,7 +632,12 @@ class HMAC final : public Command
{
auto update_hmac = [&](const uint8_t b[], size_t l) { hmac->update(b, l); };
read_file(fsname, update_hmac, buf_size);
- output() << Botan::hex_encode(hmac->final()) << " " << fsname << "\n";
+ output() << Botan::hex_encode(hmac->final());
+
+ if(no_fsname == false)
+ output() << " " << fsname;
+
+ output() << "\n";
}
catch(CLI_IO_Error& e)
{