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

  1. #!/usr/bin/perl
  2. #
  3. # testing out ecdsa key generation ...
  4. use Crypt::PK::ECC;
  5. use YAML::Syck qw(Dump);
  6. #Key generation
  7. my $pk = Crypt::PK::ECC->new();
  8. $pk->generate_key('secp256k1');
  9. my $private_der = $pk->export_key_der('private');
  10. my $public_pem = $pk->export_key_pem('public');
  11. local *PK;
  12. open PK,'>','eckey-priv.der'; binmode(PK);
  13. print PK $private_der;
  14. close
  15. open PK,'>','eckey-pub.pem';
  16. print PK $public_pem;
  17. close PK;
  18. open PK,'>','eckey.yml';
  19. print PK "--- # eckey\n";
  20. printf PK "pk: %s\n",Dump($pk->key2hash);
  21. printf PK "...\n";
  22. close PK;
  23. exit $?;
  24. 1; # $Source: /my/perl/script/eckeygen.pl $