Crypt::OpenSSL::DSA - Digital Signature Algorithm using OpenSSL |
Crypt::OpenSSL::DSA - Digital Signature Algorithm using OpenSSL
use Crypt::OpenSSL::DSA;
# generate keys and write out to PEM files my $dsa = Crypt::OpenSSL::DSA->generate_parameters( 512 ); $dsa->generate_key; $dsa->write_pub_key( $filename ); $dsa->write_priv_key( $filename );
# using keys from PEM files my $dsa_priv = Crypt::OpenSSL::DSA->read_priv_key( $filename ); my $sig = $dsa_priv->sign($message); my $dsa_pub = Crypt::OpenSSL::DSA->read_pub_key( $filename ); my $valid = $dsa_pub->verify($message, $sig);
# using keys from PEM strings my $dsa_priv = Crypt::OpenSSL::DSA->read_priv_key_str( $key_string ); my $sig = $dsa_priv->sign($message); my $dsa_pub = Crypt::OpenSSL::DSA->read_pub_key_str( $key_string ); my $valid = $dsa_pub->verify($message, $sig);
Crypt::OpenSSL::DSA implements the DSA (Digital Signature Algorithm) signature verification system.
It is a thin XS wrapper to the DSA functions contained in the OpenSSL crypto library, located at http://www.openssl.org
bits is the length of the prime to be generated; the DSS allows a maximum of 1024 bits.
$dsa is the signer's private key.
sign
, but returns a the Crypt::OpenSSL::DSA::Signature manpage object.
$dsa is the signer's public key.
Note: it croaks if the underlying library call returns error (-1).
verify
, but uses a the Crypt::OpenSSL::DSA::Signature manpage object.
Note: it croaks if the underlying library call returns error (-1).
set_p($p)
set_q($q)
set_g($g)
set_pub_key($pub_key)
set_priv_key($priv_key)
the Crpyt::DSA manpage is a more mature Perl DSA module, but can be difficult to install, because of the the Math::Pari manpage requirement.
Comments, suggestions, and patches welcome.
T.J. Mather, <tjmather@maxmind.com>
Copyright (c) 2002 T.J. Mather. Crypt::OpenSSL::DSA is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Paid support is available from directly from the author of this package. Please see http://www.maxmind.com/app/opensourceservices for more details.
the Crypt::OpenSSL::DSA::Signature manpage
the Crypt::DSA manpage, the Crypt::OpenSSL::RSA manpage
Crypt::OpenSSL::DSA - Digital Signature Algorithm using OpenSSL |