1Crypt::DSA::KeyChain(3)User Contributed Perl DocumentatioCnrypt::DSA::KeyChain(3)
2
3
4
6 Crypt::DSA::KeyChain - DSA key generation system
7
9 use Crypt::DSA::KeyChain;
10 my $keychain = Crypt::DSA::KeyChain->new;
11
12 my $key = $keychain->generate_params(
13 Size => 512,
14 Seed => $seed,
15 Verbosity => 1,
16 );
17
18 $keychain->generate_keys($key);
19
21 Crypt::DSA::KeyChain is a lower-level interface to key generation than
22 the interface in Crypt::DSA (the keygen method). It allows you to
23 separately generate the p, q, and g key parameters, given an optional
24 starting seed, and a mandatory bit size for p (q and g are 160 bits
25 each).
26
27 You can then call generate_keys to generate the public and private
28 portions of the key.
29
31 $keychain = Crypt::DSA::KeyChain->new
32 Constructs a new Crypt::DSA::KeyChain object. At the moment this isn't
33 particularly useful in itself, other than being the object you need in
34 order to call the other methods.
35
36 Returns the new object.
37
38 $key = $keychain->generate_params(%arg)
39 Generates a set of DSA parameters: the p, q, and g values of the key.
40 This involves finding primes, and as such it can be a relatively long
41 process.
42
43 When invoked in scalar context, returns a new Crypt::DSA::Key object.
44
45 In list context, returns the new Crypt::DSA::Key object, along with:
46 the value of the internal counter when a suitable prime p was found;
47 the value of h when g was derived; and the value of the seed (a 20-byte
48 string) when q was found. These values aren't particularly useful in
49 normal circumstances, but they could be useful.
50
51 %arg can contain:
52
53 • Size
54
55 The size in bits of the p value to generate. The q and g values are
56 always 160 bits each.
57
58 This argument is mandatory.
59
60 • Seed
61
62 A seed with which q generation will begin. If this seed does not
63 lead to a suitable prime, it will be discarded, and a new random
64 seed chosen in its place, until a suitable prime can be found.
65
66 This is entirely optional, and if not provided a random seed will
67 be generated automatically.
68
69 • Verbosity
70
71 Should be either 0 or 1. A value of 1 will give you a progress
72 meter during p and q generation--this can be useful, since the
73 process can be relatively long.
74
75 The default is 0.
76
77 $keychain->generate_keys($key)
78 Generates the public and private portions of the key $key, a
79 Crypt::DSA::Key object.
80
82 Please see the Crypt::DSA manpage for author, copyright, and license
83 information.
84
85
86
87perl v5.34.0 2022-01-21 Crypt::DSA::KeyChain(3)