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.
 
 
 
 
 
 

25 lines
536 B

#!/usr/bin/perl
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use encode qw(mbase58);
use ECKeys qw($keys ecsign ecverif eckeygen saveKeys);
use YAML::Syck qw(Dump);
my $name = shift;
my $id = eckeygen('identity' => $name);
&saveKeys();
printf "keys: %s\n",Dump($keys);
my $msg = sprintf "this message is signed by %s",$keys->{identity}{name};
printf "msg: %s\n",$msg;
my $sig = &ecsign('identity',$msg);
my $valid = &ecverif($keys->{identity}{public},$sig,$msg);
if ($valid) { print "ok\n"; }
exit $?;
1;