Crypt::RSA::EME::OAEP - Plaintext-aware encryption with RSA.
my $oaep = new Crypt::RSA::EME::OAEP; my $ct = $oaep->encrypt (Key => $key, Message => $message) || die $oaep->errstr; my $pt = $oaep->decrypt (Key => $key, Cyphertext => $ct) || die $oaep->errstr;
This module implements "plaintext-aware encryption" with RSA. Plaintext-aware means it's computationally infeasible to obtain full or partial information about a message from a cyphertext, and computationally infeasible to generate a valid cyphertext without knowing the corresponding message. It's impossible to mount chosen cyphertext attacks against this scheme. For more information on plaintext-aware encryption, see [3], [9] & [13].
Constructor.
Encrypts a string with a public key and returns the encrypted string on success. encrypt() takes a hash argument with the following mandatory keys:
A string to be encrypted. The length of this string should not exceed k-42 octets, where k is the octet length of the RSA modulus. If Message is longer than k-42, the method will fail and set $self->errstr to "Message too long."
Public key of the recepient, a Crypt::RSA::Key::Public object.
Decrypts cyphertext with a private key and returns plaintext on success. $self->errstr is set to "Decryption Error." or appropriate error on failure. decrypt() takes a hash argument with the following mandatory keys:
A string encrypted with encrypt(). The length of the cyphertext must be k octets, where k is the length of the RSA modulus.
Private key of the reciever, a Crypt::RSA::Key::Private object.
See ERROR HANDLING in Crypt::RSA(3) manpage.
See BIBLIOGRAPHY in Crypt::RSA(3) manpage.
Vipul Ved Prakash, <mail@vipul.net>
Crypt::RSA(3), Crypt::RSA::Primitives(3), Crypt::RSA::Keys(3), Crypt::RSA::SSA::PSS(3)
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Crypt::RSA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::RSA
CPAN shell
perl -MCPAN -e shell install Crypt::RSA
For more information on module installation, please visit the detailed CPAN module installation guide.