1Crypt::OpenSSL::DSA(3)User Contributed Perl DocumentationCrypt::OpenSSL::DSA(3)
2
3
4

NAME

6       Crypt::OpenSSL::DSA - Digital Signature Algorithm using OpenSSL
7

SYNOPSIS

9         use Crypt::OpenSSL::DSA;
10
11         # generate keys and write out to PEM files
12         my $dsa = Crypt::OpenSSL::DSA->generate_parameters( 512 );
13         $dsa->generate_key;
14         $dsa->write_pub_key( $filename );
15         $dsa->write_priv_key( $filename );
16
17         # using keys from PEM files
18         my $dsa_priv = Crypt::OpenSSL::DSA->read_priv_key( $filename );
19         my $sig      = $dsa_priv->sign($message);
20         my $dsa_pub  = Crypt::OpenSSL::DSA->read_pub_key( $filename );
21         my $valid    = $dsa_pub->verify($message, $sig);
22
23         # using keys from PEM strings
24         my $dsa_priv = Crypt::OpenSSL::DSA->read_priv_key_str( $key_string );
25         my $sig      = $dsa_priv->sign($message);
26         my $dsa_pub  = Crypt::OpenSSL::DSA->read_pub_key_str( $key_string );
27         my $valid    = $dsa_pub->verify($message, $sig);
28

DESCRIPTION

30       Crypt::OpenSSL::DSA implements the DSA (Digital Signature Algorithm)
31       signature verification system.
32
33       It is a thin XS wrapper to the DSA functions contained in the OpenSSL
34       crypto library, located at http://www.openssl.org
35

CLASS METHODS

37       $dsa = Crypt::OpenSSL::DSA->generate_parameters( $bits, $seed );
38           Returns a new DSA object and generates the p, q and g parameters
39           necessary to generate keys.
40
41           bits is the length of the prime to be generated; the DSS allows a
42           maximum of 1024 bits.
43
44       $dsa = Crypt::OpenSSL::DSA->read_params( $filename );
45           Reads in a parameter PEM file and returns a new DSA object with the
46           p, q and g parameters necessary to generate keys.
47
48       $dsa = Crypt::OpenSSL::DSA->read_pub_key( $filename );
49           Reads in a public key PEM file and returns a new DSA object that
50           can be used to verify DSA signatures.
51
52       $dsa = Crypt::OpenSSL::DSA->read_priv_key( $filename );
53           Reads in a private key PEM file and returns a new DSA object that
54           can be used to sign messages.
55
56       $dsa = Crypt::OpenSSL::DSA->read_pub_key_str( $key_string );
57           Reads in a public key PEM string and returns a new DSA object that
58           can be used to verify DSA signatures.  The string should include
59           the -----BEGIN...----- and -----END...----- lines.
60
61       $dsa = Crypt::OpenSSL::DSA->read_priv_key_str( $key_string );
62           Reads in a private key PEM string and returns a new DSA object that
63           can be used to sign messages.  The string should include the
64           -----BEGIN...----- and -----END...----- lines.
65

OBJECT METHODS

67       $dsa->generate_key;
68           Generates private and public keys, assuming that $dsa is the return
69           value of generate_parameters.
70
71       $sig = $dsa->sign( $message );
72           Signs $message, returning the signature.  Note that $meesage cannot
73           exceed 20 characters in length.
74
75           $dsa is the signer's private key.
76
77       $sig_obj = $dsa->do_sign( $message );
78           Similar to "sign", but returns a Crypt::OpenSSL::DSA::Signature
79           object.
80
81       $valid = $dsa->verify( $message, $sig );
82           Verifies that the $sig signature for $message is valid.
83
84           $dsa is the signer's public key.
85
86       $valid = $dsa->do_verify( $message, $sig_obj );
87           Similar to "verify", but uses a Crypt::OpenSSL::DSA::Signature
88           object.
89
90       $dsa->write_params( $filename );
91           Writes the parameters into a PEM file.
92
93       $dsa->write_pub_key( $filename );
94           Writes the public key into a PEM file.
95
96       $dsa->write_priv_key( $filename );
97           Writes the private key into a PEM file.
98
99       $p = $dsa->get_p, $dsa->set_p($p)
100           Gets/sets the prime number in binary format.
101
102       $q = $dsa->get_q, $dsa->set_q($q)
103           Gets/sets the subprime number (q ⎪ p-1) in binary format.
104
105       $g = $dsa->get_g, $dsa->set_g($g)
106           Gets/sets the generator of subgroup in binary format.
107
108       $pub_key = $dsa->get_pub_key, $dsa->set_pub_key($pub_key)
109           Gets/sets the public key (y = g^x) in binary format.
110
111       $priv_key = $dsa->get_priv_key, $dsa->set_priv_key($priv_key)
112           Gets/sets the private key in binary format.
113

NOTES

115       Crpyt::DSA is a more mature Perl DSA module, but can be difficult to
116       install, because of the Math::Pari requirement.
117
118       Comments, suggestions, and patches welcome.
119

AUTHOR

121       T.J. Mather, <tjmather@maxmind.com>
122
124       Copyright (c) 2002 T.J. Mather.  Crypt::OpenSSL::DSA is free software;
125       you may redistribute it and/or modify it under the same terms as Perl
126       itself.
127
128       Paid support is available from directly from the author of this pack‐
129       age.  Please see <http://www.maxmind.com/app/opensourceservices> for
130       more details.
131

SEE ALSO

133       Crypt::OpenSSL::DSA::Signature
134
135       Crypt::DSA, Crypt::OpenSSL::RSA
136
137       Net::DNS::SEC
138
139
140
141perl v5.8.8                       2005-10-15            Crypt::OpenSSL::DSA(3)
Impressum