DSA_sign 3 2003-07-24 0.9.9-dev OpenSSL

NAME

DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 int    DSA_sign(int type, const unsigned char *dgst, int len,
                unsigned char *sigret, unsigned int *siglen, DSA *dsa);


 int    DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp,
                BIGNUM **rp);


 int    DSA_verify(int type, const unsigned char *dgst, int len,
                unsigned char *sigbuf, int siglen, DSA *dsa);

DESCRIPTION

_D_S_A___s_i_g_n_(_) computes a digital signature on the lleenn byte message digest ddggsstt using the private key ddssaa and places its ASN.1 DER encoding at ssiiggrreett. The length of the signature is places in *ssiigglleenn. ssiiggrreett must point to DSA_size(ddssaa) bytes of memory.

_D_S_A___s_i_g_n___s_e_t_u_p_(_) may be used to precompute part of the signing operation in case signature generation is time-critical. It expects ddssaa to contain DSA parameters. It places the precomputed values in newly allocated BBIIGGNNUUMMs at *kkiinnvvpp and *rrpp, after freeing the old ones unless *kkiinnvvpp and *rrpp are NULL. These values may be passed to _D_S_A___s_i_g_n_(_) in ddssaa-->>kkiinnvv and ddssaa-->>rr. ccttxx is a pre-allocated BBNN__CCTTXX or NULL.

_D_S_A___v_e_r_i_f_y_(_) verifies that the signature ssiiggbbuuff of size ssiigglleenn matches a given message digest ddggsstt of size lleenn. ddssaa is the signer's public key.

The ttyyppee parameter is ignored.

The PRNG must be seeded before _D_S_A___s_i_g_n_(_) (or _D_S_A___s_i_g_n___s_e_t_u_p_(_)) is called.

RETURN VALUES

_D_S_A___s_i_g_n_(_) and _D_S_A___s_i_g_n___s_e_t_u_p_(_) return 1 on success, 0 on error. _D_S_A___v_e_r_i_f_y_(_) returns 1 for a valid signature, 0 for an incorrect signature and -1 on error. The error codes can be obtained by _E_R_R___g_e_t___e_r_r_o_r(3).

CONFORMING TO

US Federal Information Processing Standard FIPS 186 (Digital Signature Standard, DSS), ANSI X9.30

SEE ALSO

_o_p_e_n_s_s_l___d_s_a(3), _E_R_R___g_e_t___e_r_r_o_r(3), _o_p_e_n_s_s_l___r_a_n_d(3), _D_S_A___d_o___s_i_g_n(3)

HISTORY

_D_S_A___s_i_g_n_(_) and _D_S_A___v_e_r_i_f_y_(_) are available in all versions of SSLeay. _D_S_A___s_i_g_n___s_e_t_u_p_(_) was added in SSLeay 0.8.