1Crypt::RSA::ES::OAEP(3)User Contributed Perl DocumentatioCnrypt::RSA::ES::OAEP(3)
2
3
4
6 Crypt::RSA::ES::OAEP - Plaintext-aware encryption with RSA.
7
9 my $oaep = new Crypt::RSA::ES::OAEP;
10
11 my $ct = $oaep->encrypt( Key => $key, Message => $message ) ||
12 die $oaep->errstr;
13
14 my $pt = $oaep->decrypt( Key => $key, Cyphertext => $ct ) ||
15 die $oaep->errstr;
16
18 This module implements Optimal Asymmetric Encryption, a plaintext-aware
19 encryption scheme based on RSA. The notion of plaintext-aware implies
20 it's computationally infeasible to obtain full or partial information
21 about a message from a cyphertext, and computationally infeasible to
22 generate a valid cyphertext without knowing the corresponding message.
23 Plaintext-aware schemes, such as OAEP, are semantically secure, non-
24 malleable and secure against chosen-ciphertext attack. For more
25 information on OAEP and plaintext-aware encryption, see [3], [9] &
26 [13].
27
29 new()
30 Constructor.
31
32 version()
33 Returns the version number of the module.
34
35 encrypt()
36 Encrypts a string with a public key and returns the encrypted string on
37 success. encrypt() takes a hash argument with the following mandatory
38 keys:
39
40 Message
41 A string to be encrypted. The length of this string should not
42 exceed k-42 octets, where k is the octet length of the RSA modulus.
43 If Message is longer than k-42, the method will fail and set
44 $self->errstr to "Message too long." This means the key must be at
45 least _336_ bits long if you are to use OAEP.
46
47 Key Public key of the recipient, a Crypt::RSA::Key::Public object.
48
49 decrypt()
50 Decrypts cyphertext with a private key and returns plaintext on
51 success. $self->errstr is set to "Decryption Error." or appropriate
52 error on failure. decrypt() takes a hash argument with the following
53 mandatory keys:
54
55 Cyphertext
56 A string encrypted with encrypt(). The length of the cyphertext
57 must be k octets, where k is the length of the RSA modulus.
58
59 Key Private key of the receiver, a Crypt::RSA::Key::Private object.
60
61 Version
62 Version of the module that was used for creating the Cyphertext.
63 This is an optional argument. When present, decrypt() will ensure
64 before proceeding that the installed version of the module can
65 successfully decrypt the Cyphertext.
66
68 See ERROR HANDLING in Crypt::RSA(3) manpage.
69
71 See BIBLIOGRAPHY in Crypt::RSA(3) manpage.
72
74 Vipul Ved Prakash, <mail@vipul.net>
75
77 Crypt::RSA(3), Crypt::RSA::Primitives(3), Crypt::RSA::Keys(3),
78 Crypt::RSA::SSA::PSS(3)
79
80
81
82perl v5.32.0 2020-07-28 Crypt::RSA::ES::OAEP(3)