You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
607 B

#!/usr/bin/perl
#
# testing out ecdsa key generation ...
use Crypt::PK::ECC;
use YAML::Syck qw(Dump);
#Key generation
my $pk = Crypt::PK::ECC->new();
$pk->generate_key('secp256k1');
my $private_der = $pk->export_key_der('private');
my $public_pem = $pk->export_key_pem('public');
local *PK;
open PK,'>','eckey-priv.der'; binmode(PK);
print PK $private_der;
close
open PK,'>','eckey-pub.pem';
print PK $public_pem;
close PK;
open PK,'>','eckey.yml';
print PK "--- # eckey\n";
printf PK "pk: %s\n",Dump($pk->key2hash);
printf PK "...\n";
close PK;
exit $?;
1; # $Source: /my/perl/script/eckeygen.pl $