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
16       portions. Subclasses of Crypt::DSA::Key implement read and write
17       methods, such that you can store DSA keys on disk, and read them back
18       into your 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       Creates a new (empty) key object. All of the attributes are initialized
30       to 0.
31
32       Alternately, if you provide the Filename parameter (see below), the key
33       will be read in from disk. If you provide the Type parameter (mandatory
34       if Filename is provided), be aware that your key will actually be
35       blessed into a subclass of Crypt::DSA::Key. Specifically, it will be
36       the class implementing the specific read functionality for that type,
37       eg. Crypt::DSA::Key::PEM.
38
39       Returns the key on success, "undef" otherwise. (See Password for one
40       reason why new might return "undef").
41
42       %arg can contain:
43
44       •   Type
45
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
58           The location of the file from which you'd like to read the key.
59           Requires a Type argument so the decoder knows what type of file it
60           is.  You can't specify Content and Filename at the same time.
61
62       •   Content
63
64           The serialized version of the key.  Requires a Type argument so the
65           decoder knows how to decode it.  You can't specify Content and
66           Filename at the same time.
67
68       •   Password
69
70           If your key file is encrypted, you'll need to supply a passphrase
71           to decrypt it. You can do that here.
72
73           If your passphrase is incorrect, new will return "undef".
74
75   $key->write(%arg)
76       Writes a key (optionally) to disk, using a format that you define with
77       the Type parameter.
78
79       If your $key object has a defined priv_key (private key portion), the
80       key will be written as a DSA private key object; otherwise, it will be
81       written out as a public key. Note that not all serialization mechanisms
82       can produce public keys in this version--currently, only PEM public
83       keys are supported.
84
85       %arg can include:
86
87       •   Type
88
89           The type of file format that you wish to write. PEM is one example
90           (in fact, currently, it's the only example).
91
92           This argument is mandatory, unless your $key object is already
93           blessed into a subclass (eg. Crypt::DSA::Key::PEM), and you wish to
94           write the file using the same subclass.
95
96       •   Filename
97
98           The location of the file on disk where you want the key file to be
99           written.
100
101       •   Password
102
103           If you want the key file to be encrypted, provide this argument,
104           and the ASN.1-encoded string will be encrypted using the passphrase
105           as a key.
106
107   $key->size
108       Returns the size of the key, in bits. This is actually the number of
109       bits in the large prime p.
110

AUTHOR & COPYRIGHTS

112       Please see the Crypt::DSA manpage for author, copyright, and license
113       information.
114
115
116
117perl v5.36.0                      2023-01-20                Crypt::DSA::Key(3)
Impressum