Skip to content

Commit

Permalink
Add test for deterministic signature generation
Browse files Browse the repository at this point in the history
Deterministic signatures should be added in future versions of
Libtomcrypt, which is used by CryptX. Ticket link:
libtom/libtomcrypt#441
  • Loading branch information
bbrtj committed Jan 26, 2019
1 parent dd316b1 commit e864c2e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion t/PrivateKey.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use strict;
use warnings;

use Test::More tests => 18;
use Test::More tests => 19;
use Try::Tiny;
use Bitcoin::Crypto::Config;

Expand Down Expand Up @@ -31,6 +31,9 @@ my $pubkey = $privkey->getPublicKey();
my $message = "Perl test script";
my $signature = $privkey->signMessage($message);

ok($privkey->signMessage($message) eq $signature, "Signatures generation should be deterministic")
or diag("Signatures generation seems to be nondeterministic, which is a possible private key security threat");

ok($privkey->verifyMessage($message, $signature), "Valid signature");
ok($pubkey->verifyMessage($message, $signature), "Pubkey recognizes signature");

Expand Down

0 comments on commit e864c2e

Please sign in to comment.