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