EVP_DigestVerifyInit(3) OpenSSL EVP_DigestVerifyInit(3) NNAAMMEE EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal - EVP signature verification functions SSYYNNOOPPSSIISS #include int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen); DDEESSCCRRIIPPTTIIOONN The EVP signature routines are a high level interface to digital signa- tures. _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_I_n_i_t_(_) sets up verification context ccttxx to use digest ttyyppee from ENGINE iimmppll and public key ppkkeeyy. ccttxx must be initialized with _E_V_P___M_D___C_T_X___i_n_i_t_(_) before calling this function. If ppccttxx is not NULL, the EVP_PKEY_CTX of the verification operation will be written to **ppccttxx: this can be used to set alternative verification options. Note that any existing value in **ppccttxx is overwritten. The EVP_PKEY_CTX value returned must not be freed directly by the application (it will be freed automatically when the EVP_MD_CTX is freed). _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_U_p_d_a_t_e_(_) hashes ccnntt bytes of data at dd into the verifi- cation context ccttxx. This function can be called several times on the same ccttxx to include additional data. This function is currently imple- mented using a macro. _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_F_i_n_a_l_(_) verifies the data in ccttxx against the signature in ssiigg of length ssiigglleenn. RREETTUURRNN VVAALLUUEESS _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_I_n_i_t_(_) and _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_U_p_d_a_t_e_(_) return 1 for suc- cess and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm. _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_F_i_n_a_l_(_) returns 1 for success; any other value indi- cates failure. A return value of zero indicates that the signature did not verify successfully (that is, tbs did not match the original data or the signature had an invalid form), while other values indicate a more serious error (and sometimes also indicate an invalid signature form). The error codes can be obtained from _E_R_R___g_e_t___e_r_r_o_r(3). NNOOTTEESS 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. In previous versions of OpenSSL there was a link between message digest types and public key algorithms. This meant that "clone" digests such as _E_V_P___d_s_s_1_(_) needed to be used to sign using SHA1 and DSA. This is no longer necessary and the use of clone digest is now discouraged. For some key types and parameters the random number generator must be seeded or the operation will fail. The call to _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_F_i_n_a_l_(_) internally finalizes a copy of the digest context. This means that _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 mem- ory leak will occur. SSEEEE AALLSSOO _E_V_P___D_i_g_e_s_t_S_i_g_n_I_n_i_t(3), _E_V_P___D_i_g_e_s_t_I_n_i_t(3), _e_r_r(3), _e_v_p(3), _h_m_a_c(3), _m_d_2(3), _m_d_5(3), _m_d_c_2(3), _r_i_p_e_m_d(3), _s_h_a(3), _d_g_s_t(1) HHIISSTTOORRYY _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_I_n_i_t_(_), _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_U_p_d_a_t_e_(_) and _E_V_P___D_i_g_e_s_t_V_e_r_i_f_y_- _F_i_n_a_l_(_) were first added to OpenSSL 1.0.0. 1.0.2u 2019-12-20 EVP_DigestVerifyInit(3)