Closed bakkiaraj closed 5 years ago
Your k
value is too big, It should be smaller than BRAINPOOLP256R1
curve prime which is A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5377
.
And do not mix key loading and key generation:
use Crypt::PK::ECC;
use Data::Dumper;
# generate a new key
my $pk1 = Crypt::PK::ECC->new();
$pk1->generate_key('BRAINPOOLP256R1');
print Dumper($pk1->key2hash);
# import an existing key (public only)
my $pk2 = Crypt::PK::ECC->new();
$pk2->import_key({
curve_name => "BRAINPOOLP256R1",
pub_x => "86E819FEF7505865C174C6D610FECF1A88BD328DA058CC3FC25B456DA332B62F",
pub_y => "A373B076CDDB12182CA21090270D57AEA6290D5DF9F7E90EF0AB85D28541BCCF",
});
print Dumper($pk2->key2hash);
Hi,
Thanks for quick reply. Sorry I gave a dummy key , x,y data because i could not provide real data which I use in project.
The confusion point is that, My k, pub_x, pub_y works well in old version of CryptX but not with CryptX 0.066.
Is this means some checks are newly added in version 0.066?
Is this means some checks are newly added in version 0.066?
Yes the newer libtomcrypt (library behind CryptX) is stricter.
A possible workaround might be: k = k modulo prime
Understood. Yes my key is bigger than prime. When key is reduced, its working fine. Thanks a lot for lightning fast help.
Hi,
The following code works well in CryptX 0.059
The same code gives following error in 0.066 Version.
What could be the cause?