test: add -macopt hexkey: to dgst command tests
Comparison checksum generated using 1.1.1f.
@@ -17,7 +17,7 @@ use OpenSSL::Test::Utils;
setup("test_dgst");
-plan tests => 8;
+plan tests => 9;
sub tsignverify {
my $testtext = shift;
@@ -131,6 +131,21 @@ subtest "HMAC generation with `dgst` CLI, default digest" => sub {
"HMAC: Check second HMAC value is consistent with the first ($hmacdata[1]) vs ($expected)");
};
+subtest "HMAC generation with `dgst` CLI, key via option" => sub {
+ plan tests => 2;
+
+ my $testdata = srctop_file('test', 'data.bin');
+ #HMAC the data twice to check consistency
+ my @hmacdata = run(app(['openssl', 'dgst', '-sha256', '-hmac',
+ '-macopt', 'hexkey:FFFF',
+ $testdata, $testdata]), capture => 1);
+ chomp(@hmacdata);
+ my $expected = qr/HMAC-SHA2-256\(\Q$testdata\E\)= b6727b7bb251dfa65846e0a8223bdd57d244aa6d7e312cb906d8e21f2dee3a57/;
+ ok($hmacdata[0] =~ $expected, "HMAC: Check HMAC value is as expected ($hmacdata[0]) vs ($expected)");
+ ok($hmacdata[1] =~ $expected,
+ "HMAC: Check second HMAC value is consistent with the first ($hmacdata[1]) vs ($expected)");
+};
+
subtest "Custom length XOF digest generation with `dgst` CLI" => sub {
plan tests => 2;
