Crypt-MagicSignatures-Key
view release on metacpan or search on metacpan
lib/Crypt/MagicSignatures/Key.pm view on Meta::CPAN
};
Verifies a signature of a message based on the public
component of the key.
Returns a C<true> value on success and C<false> otherwise.
=head2 to_string
my $pub_key = $mkey->to_string;
my $priv_key = $mkey->to_string(1);
Returns the public key as a string in
L<compact notation|https://cdn.rawgit.com/salmon-protocol/salmon-protocol/master/draft-panzer-magicsig-01.html#anchor13>.
If a C<true> value is passed to the method,
the full key (including the private exponent if existing)
is returned.
=head1 FUNCTIONS
=head2 b64url_encode
use Crypt::MagicSignatures::Key qw/b64url_encode/;
print b64url_encode('This is a message');
print b64url_encode('This is a message', 0);
Encodes a string as base-64 with URL safe characters.
A second parameter indicates, if trailing equal signs
are wanted. The default is C<true>.
This differs from
L<MIME::Base64::encode_base64|MIME::Base64/"encode_base64">.
The function can be exported.
=head2 b64url_decode
use Crypt::MagicSignatures::Key qw/b64url_decode/;
print b64url_decode('VGhpcyBpcyBhIG1lc3NhZ2U=');
Decodes a base-64 string with URL safe characters.
Characters not part of the character set are silently ignored.
The function can be exported.
=head1 DEPENDENCIES
For signing and verification there are no dependencies
other than Perl v5.10.1 and core modules.
For key generation L<Math::Prime::Util> v0.21 is necessary.
Either L<Math::BigInt::GMP> (preferred) or L<Math::BigInt::Pari>
is strongly recommended for speed improvement
(signing and verification) as well as
L<Math::Prime::Util::GMP> and L<Math::Random::ISAAC::XS>
(key generation).
=head1 KNOWN BUGS AND LIMITATIONS
The signing and verification is not guaranteed to be
compatible with other implementations, as the specification
changed over time!
=head1 SEE ALSO
L<Crypt::MagicSignatures::Envelope>,
L<Crypt::RSA::DataFormat>,
L<Alt::Crypt::RSA::BigInt>,
L<https://github.com/sivy/Salmon>.
=head1 AVAILABILITY
https://github.com/Akron/Crypt-MagicSignatures-Key
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2012-2021, L<Nils Diewald|https://www.nils-diewald.de/>.
This program is free software, you can redistribute it
and/or modify it under the terms of the Artistic License version 2.0.
=cut
( run in 0.766 second using v1.01-cache-2.11-cpan-e1769b4cff6 )