EVP_VerifyInit 3 2008-05-09 0.9.9-dev OpenSSL

NAME

EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal - EVP signature verification functions

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
 int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
 int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf, unsigned int siglen,EVP_PKEY *pkey);


 int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);

DESCRIPTION

The EVP signature verification routines are a high level interface to digital signatures.

_E_V_P___V_e_r_i_f_y_I_n_i_t___e_x_(_) sets up verification context ccttxx to use digest ttyyppee from ENGINE iimmppll. ccttxx must be initialized by calling _E_V_P___M_D___C_T_X___i_n_i_t_(_) before calling this function.

_E_V_P___V_e_r_i_f_y_U_p_d_a_t_e_(_) hashes ccnntt bytes of data at dd into the verification context ccttxx. This function can be called several times on the same ccttxx to include additional data.

_E_V_P___V_e_r_i_f_y_F_i_n_a_l_(_) verifies the data in ccttxx using the public key ppkkeeyy and against the ssiigglleenn bytes at ssiiggbbuuff.

_E_V_P___V_e_r_i_f_y_I_n_i_t_(_) initializes verification context ccttxx to use the default implementation of digest ttyyppee.

RETURN VALUES

_E_V_P___V_e_r_i_f_y_I_n_i_t___e_x_(_) and _E_V_P___V_e_r_i_f_y_U_p_d_a_t_e_(_) return 1 for success and 0 for failure.

_E_V_P___V_e_r_i_f_y_F_i_n_a_l_(_) returns 1 for a correct signature, 0 for failure and -1 if some other error occurred.

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

NOTES

The EEVVPP interface to digital signatures should almost always be used in preference to the low level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

Due to the link between message digests and public key algorithms the correct digest algorithm must be used with the correct public key type. A list of algorithms and associated public key algorithms appears in _E_V_P___D_i_g_e_s_t_I_n_i_t(3).

The call to _E_V_P___V_e_r_i_f_y_F_i_n_a_l_(_) internally finalizes a copy of the digest context. This means that calls to _E_V_P___V_e_r_i_f_y_U_p_d_a_t_e_(_) and _E_V_P___V_e_r_i_f_y_F_i_n_a_l_(_) can be called later to digest and verify additional data.

Since only a copy of the digest context is ever finalized the context must be cleaned up after use by calling _E_V_P___M_D___C_T_X___c_l_e_a_n_u_p_(_) or a memory leak will occur.

BUGS

Older versions of this documentation wrongly stated that calls to _E_V_P___V_e_r_i_f_y_U_p_d_a_t_e_(_) could not be made after calling _E_V_P___V_e_r_i_f_y_F_i_n_a_l_(_).

Since the public key is passed in the call to _E_V_P___S_i_g_n_F_i_n_a_l_(_) any error relating to the private key (for example an unsuitable key and digest combination) will not be indicated until after potentially large amounts of data have been passed through _E_V_P___S_i_g_n_U_p_d_a_t_e_(_).

It is not possible to change the signing parameters using these function.

The previous two bugs are fixed in the newer EVP_VerifyDigest*() function.

SEE ALSO

_o_p_e_n_s_s_l___e_v_p(3), _E_V_P___S_i_g_n_I_n_i_t(3), _E_V_P___D_i_g_e_s_t_I_n_i_t(3), _o_p_e_n_s_s_l___e_r_r(3), _o_p_e_n_s_s_l___e_v_p(3), _o_p_e_n_s_s_l___h_m_a_c(3), _m_d_2(3), _o_p_e_n_s_s_l___m_d_5(3), _o_p_e_n_s_s_l___m_d_c_2(3), _o_p_e_n_s_s_l___r_i_p_e_m_d(3), _o_p_e_n_s_s_l___s_h_a(3), _o_p_e_n_s_s_l___d_g_s_t(1)

HISTORY

_E_V_P___V_e_r_i_f_y_I_n_i_t_(_), _E_V_P___V_e_r_i_f_y_U_p_d_a_t_e_(_) and _E_V_P___V_e_r_i_f_y_F_i_n_a_l_(_) are available in all versions of SSLeay and OpenSSL.

_E_V_P___V_e_r_i_f_y_I_n_i_t___e_x_(_) was added in OpenSSL 0.9.7