RSA_sign 3 2005-11-24 0.9.9-dev OpenSSL

NAME

RSA_sign, RSA_verify - RSA signatures

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
    unsigned char *sigret, unsigned int *siglen, RSA *rsa);


 int RSA_verify(int type, const unsigned char *m, unsigned int m_len,
    unsigned char *sigbuf, unsigned int siglen, RSA *rsa);

DESCRIPTION

_R_S_A___s_i_g_n_(_) signs the message digest mm of size mm__lleenn using the private key rrssaa as specified in PKCS #1 v2.0. It stores the signature in ssiiggrreett and the signature size in ssiigglleenn. ssiiggrreett must point to RSA_size(rrssaa) bytes of memory.

ttyyppee denotes the message digest algorithm that was used to generate mm. It usually is one of NNIIDD__sshhaa11, NNIIDD__rriippeemmdd116600 and NNIIDD__mmdd55; see _o_b_j_e_c_t_s(3) for details. If ttyyppee is NNIIDD__mmdd55__sshhaa11, an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding and no algorithm identifier) is created.

_R_S_A___v_e_r_i_f_y_(_) verifies that the signature ssiiggbbuuff of size ssiigglleenn matches a given message digest mm of size mm__lleenn. ttyyppee denotes the message digest algorithm that was used to generate the signature. rrssaa is the signer's public key.

RETURN VALUES

_R_S_A___s_i_g_n_(_) returns 1 on success, 0 otherwise. _R_S_A___v_e_r_i_f_y_(_) returns 1 on successful verification, 0 otherwise.

The error codes can be obtained by _E_R_R___g_e_t___e_r_r_o_r(3).

BUGS

Certain signatures with an improper algorithm identifier are accepted for compatibility with SSLeay 0.4.5 :-)

CONFORMING TO

SSL, PKCS #1 v2.0

SEE ALSO

_E_R_R___g_e_t___e_r_r_o_r(3), _o_b_j_e_c_t_s(3), _o_p_e_n_s_s_l___r_s_a(3), _R_S_A___p_r_i_v_a_t_e___e_n_c_r_y_p_t(3), _R_S_A___p_u_b_l_i_c___d_e_c_r_y_p_t(3)

HISTORY

_R_S_A___s_i_g_n_(_) and _R_S_A___v_e_r_i_f_y_(_) are available in all versions of SSLeay and OpenSSL.