RSA_private_encrypt 3 2003-07-24 0.9.9-dev OpenSSL
NAME
RSA_private_encrypt, RSA_public_decrypt - low level signature operations
LIBRARY
libcrypto, -lcrypto
SYNOPSIS
#include
int RSA_private_encrypt(int flen, unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int RSA_public_decrypt(int flen, unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
DESCRIPTION
These functions handle RSA signatures at a low level.
_R_S_A___p_r_i_v_a_t_e___e_n_c_r_y_p_t_(_) signs the fflleenn bytes at ffrroomm (usually a
message digest with an algorithm identifier) using the private key
rrssaa and stores the signature in ttoo. ttoo must point to
RRSSAA__ssiizzee((rrssaa)) bytes of memory.
ppaaddddiinngg denotes one of the following modes:
-
RSA_PKCS1_PADDING
PKCS #1 v1.5 padding. This function does not handle the
-
aallggoorriitthhmmIIddeennttiiffiieerr specified in PKCS #1. When generating or
verifying PKCS #1 signatures, _R_S_A___s_i_g_n(3) and _R_S_A___v_e_r_i_f_y(3) should be
used.
-
RSA_NO_PADDING
Raw RSA signature. This mode should _o_n_l_y be used to implement
-
cryptographically sound padding modes in the application code.
Signing user data directly with RSA is insecure.
_R_S_A___p_u_b_l_i_c___d_e_c_r_y_p_t_(_) recovers the message digest from the fflleenn
bytes long signature at ffrroomm using the signer's public key
rrssaa. ttoo must point to a memory section large enough to hold the
message digest (which is smaller than RRSSAA__ssiizzee((rrssaa)) --
1111). ppaaddddiinngg is the padding mode that was used to sign the data.
RETURN VALUES
_R_S_A___p_r_i_v_a_t_e___e_n_c_r_y_p_t_(_) returns the size of the signature (i.e.,
RSA_size(rsa)). _R_S_A___p_u_b_l_i_c___d_e_c_r_y_p_t_(_) returns the size of the
recovered message digest.
On error, -1 is returned; the error codes can be
obtained by _E_R_R___g_e_t___e_r_r_o_r(3).
SEE ALSO
_E_R_R___g_e_t___e_r_r_o_r(3), _o_p_e_n_s_s_l___r_s_a(3),
_R_S_A___s_i_g_n(3), _R_S_A___v_e_r_i_f_y(3)
HISTORY
The ppaaddddiinngg argument was added in SSLeay 0.8. RSA_NO_PADDING is
available since SSLeay 0.9.0.