1Crypt::RSA::Key(3) User Contributed Perl Documentation Crypt::RSA::Key(3)
2
3
4
6 Crypt::RSA::Key - RSA Key Pair Generator.
7
9 my $keychain = new Crypt::RSA::Key;
10 my ($public, $private) = $keychain->generate (
11 Identity => 'Lord Macbeth <macbeth@glamis.com>',
12 Size => 2048,
13 Password => 'A day so foul & fair',
14 Verbosity => 1,
15 ) or die $keychain->errstr();
16
18 This module provides a method to generate an RSA key pair.
19
21 new()
22
23 Constructor.
24
25 generate()
26
27 generate() generates an RSA key of specified bitsize. It returns a list
28 of two elements, a Crypt::RSA::Key::Public object that holds the public
29 part of the key pair and a Crypt::RSA::Key::Private object that holds
30 that private part. On failure, it returns undef and sets $self->errstr
31 to appropriate error string. generate() takes a hash argument with the
32 following keys:
33
34 Size
35 Bitsize of the key to be generated. This should be an even integer
36 > 48. Bitsize is a mandatory argument.
37
38 Password
39 String with which the private key will be encrypted. If Password is
40 not provided the key will be stored unencrypted.
41
42 Identity
43 A string that identifies the owner of the key. This string usually
44 takes the form of a name and an email address. The identity is not
45 bound to the key with a signature. However, a future release or
46 another module will provide this facility.
47
48 Cipher
49 The block cipher which is used for encrypting the private key.
50 Defaults to `Blowfish'. Cipher could be set to any value that works
51 with Crypt::CBC(3) and Tie::EncryptedHash(3).
52
53 Verbosity
54 When set to 1, generate() will draw a progress display on STDOUT.
55
56 Filename
57 The generated key pair will be written to disk, in $Filename.public
58 and $Filename.private files, if this argument is provided. Disk
59 writes can be deferred by skipping this argument and achieved later
60 with the write() method of Crypt::RSA::Key::Public(3) and
61 Crypt::RSA::Key::Private(3).
62
63 KF A string that specifies the key format. As of this writing, two key
64 formats, `Native' and `SSH', are supported. KF defaults to
65 `Native'.
66
67 SKF Secret (Private) Key Format. Instead of specifying KF, the user
68 could choose to specify secret and public key formats separately.
69 The value for SKF can be a string ("Native" or "SSH") or a hash
70 reference that specifies a module name, its constructor and con‐
71 structor arguments. The specified module is loaded with
72 Class::Loader(3) and must be interface compatible with
73 Crypt::RSA::Key::Private(3).
74
75 PKF Public Key Format. This option is like SKF but for the public key.
76
78 See ERROR HANDLING in Crypt::RSA(3) manpage.
79
81 There's an inefficiency in the way generate() ensures the key pair is
82 exactly Size bits long. This will be fixed in a future release.
83
85 Vipul Ved Prakash, <mail@vipul.net>
86
88 Crypt::RSA(3), Crypt::RSA::Key::Public(3), Crypt::RSA::Key::Private(3),
89 Crypt::Primes(3), Tie::EncryptedHash(3), Class::Loader(3)
90
91
92
93perl v5.8.8 2007-04-17 Crypt::RSA::Key(3)