Crypt::Perl::Ed25519::PrivateKey
my $new_key = Crypt::Perl::Ed25519::PrivateKey->new(); # The passed-in string should contain ONLY the private pieces. my $import_key = Crypt::Perl::Ed25519::PrivateKey->new( $priv_str ); # … or do this if you’ve got the public component: $import_key = Crypt::Perl::Ed25519::PrivateKey->new( $priv_str, $pub_str ); # Returns an octet string my $signature = $key->sign( $message ); $key->verify( $message, $signature ) or die "Invalid sig for msg!"; #---------------------------------------------------------------------- # These return an octet string. my $pub_str = $key->get_public(); my $priv_str = $key->get_private(); # Returns an object my $pub_obj = $key->get_public_key(); # These return a hash reference, NOT a JSON string. my $priv_hr = $key->get_struct_for_private_jwk(); my $pub_hr = $key->get_struct_for_public_jwk();
This class implements Ed25519 signing and verification.
To install Crypt::Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::Perl
CPAN shell
perl -MCPAN -e shell install Crypt::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.