1Crypt::DSA::Key(3)    User Contributed Perl Documentation   Crypt::DSA::Key(3)
2
3
4

NAME

6       Crypt::DSA::Key - DSA key
7

SYNOPSIS

9           use Crypt::DSA::Key;
10           my $key = Crypt::DSA::Key->new;
11
12           $key->p($p);
13

DESCRIPTION

15       Crypt::DSA::Key contains a DSA key, both the public and private por‐
16       tions. Subclasses of Crypt::DSA::Key implement read and write methods,
17       such that you can store DSA keys on disk, and read them back into your
18       application.
19

USAGE

21       Any of the key attributes can be accessed through combination get/set
22       methods. The key attributes are: p, q, g, priv_key, and pub_key. For
23       example:
24
25           $key->p($p);
26           my $p2 = $key->p;
27
28       $key = Crypt::DSA::Key->new(%arg)
29
30       Creates a new (empty) key object. All of the attributes are initialized
31       to 0.
32
33       Alternately, if you provide the Filename parameter (see below), the key
34       will be read in from disk. If you provide the Type parameter (mandatory
35       if Filename is provided), be aware that your key will actually be
36       blessed into a subclass of Crypt::DSA::Key. Specifically, it will be
37       the class implementing the specific read functionality for that type,
38       eg. Crypt::DSA::Key::PEM.
39
40       Returns the key on success, "undef" otherwise. (See Password for one
41       reason why new might return "undef").
42
43       %arg can contain:
44
45       * Type
46           The type of file where the key is stored. Currently the only option
47           is PEM, which indicates a PEM file (optionally encrypted,
48           ASN.1-encoded object). Support for reading/writing PEM files comes
49           from Convert::PEM; if you don't have this module installed, the new
50           method will die.
51
52           This argument is mandatory, if you're either reading the file from
53           disk (ie. you provide a Filename argument) or you've specified the
54           Content argument.
55
56       * Filename
57           The location of the file from which you'd like to read the key.
58           Requires a Type argument so the decoder knows what type of file it
59           is.  You can't specify Content and Filename at the same time.
60
61       * Content
62           The serialized version of the key.  Requires a Type argument so the
63           decoder knows how to decode it.  You can't specify Content and
64           Filename at the same time.
65
66       * Password
67           If your key file is encrypted, you'll need to supply a passphrase
68           to decrypt it. You can do that here.
69
70           If your passphrase is incorrect, new will return "undef".
71
72       $key->write(%arg)
73
74       Writes a key (optionally) to disk, using a format that you define with
75       the Type parameter.
76
77       If your $key object has a defined priv_key (private key portion), the
78       key will be written as a DSA private key object; otherwise, it will be
79       written out as a public key. Note that not all serialization mechanisms
80       can produce public keys in this version--currently, only PEM public
81       keys are supported.
82
83       %arg can include:
84
85       * Type
86           The type of file format that you wish to write. PEM is one example
87           (in fact, currently, it's the only example).
88
89           This argument is mandatory, unless your $key object is already
90           blessed into a subclass (eg. Crypt::DSA::Key::PEM), and you wish to
91           write the file using the same subclass.
92
93       * Filename
94           The location of the file on disk where you want the key file to be
95           written.
96
97       * Password
98           If you want the key file to be encrypted, provide this argument,
99           and the ASN.1-encoded string will be encrypted using the passphrase
100           as a key.
101
102       $key->size
103
104       Returns the size of the key, in bits. This is actually the number of
105       bits in the large prime p.
106

AUTHOR & COPYRIGHTS

108       Please see the Crypt::DSA manpage for author, copyright, and license
109       information.
110
111
112
113perl v5.8.8                       2004-12-31                Crypt::DSA::Key(3)
Impressum