Manual Pages for UNIX Darwin command on man RSA_private_decrypt
MyWebUniversity

Manual Pages for UNIX Darwin command on man RSA_private_decrypt

RSApublicencrypt(3) OpenSSL RSApublicencrypt(3)

NAME

RSApublicencrypt, RSAprivatedecrypt - RSA public key cryptography

SYNOPSIS

#include

int RSApublicencrypt(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); int RSAprivatedecrypt(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding);

DESCRIPTION

RSApublicencrypt() encrypts the fflleenn bytes at ffrroomm (usually a session key) using the public key rrssaa and stores the ciphertext in ttoo. ttoo must point to RSAsize(rrssaa) bytes of memory. ppaaddddiinngg denotes one of the following modes: RSAPKCS1PADDING

PKCS #1 v1.5 padding. This currently is the most widely used mode.

RSAPKCS1OAEPPADDING

EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty

encoding parameter. This mode is recommended for all new applications. RSASSLV23PADDING

PKCS #1 v1.5 padding with an SSL-specific modification that denotes

that the server is SSL3 capable. RSANOPADDING Raw RSA encryption. This mode should only be used to implement cryptographically sound padding modes in the application code. Encrypting user data directly with RSA is insecure.

fflleenn must be less than RSAsize(rrssaa) - 11 for the PKCS #1 v1.5 based

padding modes, less than RSAsize(rrssaa) - 41 for RSAPKCS1OAEPPADDING

and exactly RSAsize(rrssaa) for RSANOPADDING. The random number generator must be seeded prior to calling RSApublicencrypt(). RSAprivatedecrypt() decrypts the fflleenn bytes at ffrroomm using the private key rrssaa and stores the plaintext in ttoo. ttoo must point to a memory section large enough to hold the decrypted data (which is smaller than RSAsize(rrssaa)). ppaaddddiinngg is the padding mode that was used to encrypt the data.

RETURN VALUES

RSApublicencrypt() returns the size of the encrypted data (i.e., RSAsize(rrssaa)). RSAprivatedecrypt() returns the size of the recovered plaintext.

On error, -1 is returned; the error codes can be obtained by

ERRgeterror(3). CCOONNFFOORRMMIINNGG TTOO

SSL, PKCS #1 v2.0

SEE ALSO

ERRgeterror(3), rand(3), rsa(3), RSAsize(3) HISTORY The ppaaddddiinngg argument was added in SSLeay 0.8. RSANOPADDING is available since SSLeay 0.9.0, OAEP was added in OpenSSL 0.9.2b.

0.9.7l 2004-03-23 RSApublicencrypt(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™