EVP_SignInit(3) OpenSSL EVP_SignInit(3) NNAAMMEE EVP_SignInit, EVP_SignInit_ex, EVP_SignUpdate, EVP_SignFinal - EVP signing functions SSYYNNOOPPSSIISS #include int EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); int EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey); void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); int EVP_PKEY_size(EVP_PKEY *pkey); DDEESSCCRRIIPPTTIIOONN The EVP signature routines are a high level interface to digital signa- tures. _E_V_P___S_i_g_n_I_n_i_t___e_x_(_) sets up signing context ccttxx to use digest ttyyppee from ENGINE iimmppll. ccttxx must be initialized with _E_V_P___M_D___C_T_X___i_n_i_t_(_) before calling this function. _E_V_P___S_i_g_n_U_p_d_a_t_e_(_) hashes ccnntt bytes of data at dd into the signature con- text ccttxx. This function can be called several times on the same ccttxx to include additional data. _E_V_P___S_i_g_n_F_i_n_a_l_(_) signs the data in ccttxx using the private key ppkkeeyy and places the signature in ssiigg. ssiigg must be at least EVP_PKEY_size(pkey) bytes in size. ss is an OUT paramter, and not used as an IN parameter. The number of bytes of data written (i.e. the length of the signature) will be written to the integer at ss, at most EVP_PKEY_size(pkey) bytes will be written. _E_V_P___S_i_g_n_I_n_i_t_(_) initializes a signing context ccttxx to use the default implementation of digest ttyyppee. _E_V_P___P_K_E_Y___s_i_z_e_(_) returns the maximum size of a signature in bytes. The actual signature returned by _E_V_P___S_i_g_n_F_i_n_a_l_(_) may be smaller. RREETTUURRNN VVAALLUUEESS _E_V_P___S_i_g_n_I_n_i_t___e_x_(_), _E_V_P___S_i_g_n_U_p_d_a_t_e_(_) and _E_V_P___S_i_g_n_F_i_n_a_l_(_) return 1 for success and 0 for failure. _E_V_P___P_K_E_Y___s_i_z_e_(_) returns the maximum size of a signature in bytes. The error codes can be obtained by _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. 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). When signing with DSA private keys the random number generator must be seeded or the operation will fail. The random number generator does not need to be seeded for RSA signatures. The call to _E_V_P___S_i_g_n_F_i_n_a_l_(_) internally finalizes a copy of the digest context. This means that calls to _E_V_P___S_i_g_n_U_p_d_a_t_e_(_) and _E_V_P___S_i_g_n_F_i_n_a_l_(_) can be called later to digest and sign 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. BBUUGGSS Older versions of this documentation wrongly stated that calls to _E_V_P___S_i_g_n_U_p_d_a_t_e_(_) could not be made after calling _E_V_P___S_i_g_n_F_i_n_a_l_(_). Since the private 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 func- tion. The previous two bugs are fixed in the newer EVP_SignDigest*() func- tion. SSEEEE AALLSSOO _E_V_P___V_e_r_i_f_y_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___S_i_g_n_I_n_i_t_(_), _E_V_P___S_i_g_n_U_p_d_a_t_e_(_) and _E_V_P___S_i_g_n_F_i_n_a_l_(_) are available in all versions of SSLeay and OpenSSL. _E_V_P___S_i_g_n_I_n_i_t___e_x_(_) was added in OpenSSL 0.9.7. 1.0.1u 2016-09-22 EVP_SignInit(3)