NAME
DSAsign, DSAsignsetup, DSAverify - DSA signatures
SYNOPSIS
#include
int DSAsign(int type, const unsigned char *dgst, int len, unsigned char *sigret, unsigned int *siglen, DSA *dsa); int DSAsignsetup(DSA *dsa, BNCTX *ctx, BIGNUM **kinvp, BIGNUM **rp); int DSAverify(int type, const unsigned char *dgst, int len, unsigned char *sigbuf, int siglen, DSA *dsa);DESCRIPTION
DSAsign() 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 DSAsize(ddssaa) bytes of memory. DSAsignsetup() may be used to precompute part of the signingoperation 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 DSAsign() inddssaa->>kkiinnvv and ddssaa->>rr. ccttxx is a pre-allocated BBNNCCTTXX or NULL.
DSAverify() 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 DSAsign() (or DSAsignsetup()) is called.RETURN VALUES
DSAsign() and DSAsignsetup() return 1 on success, 0 on error. DSAverify() returns 1 for a valid signature, 0 for an incorrectsignature and -1 on error. The error codes can be obtained by
ERRgeterror(3). CCOONNFFOORRMMIINNGG TTOO US Federal Information Processing Standard FIPS 186 (Digital Signature Standard, DSS), ANSI X9.30SEE ALSO
dsa(3), ERRgeterror(3), rand(3), DSAdosign(3) HISTORY DSAsign() and DSAverify() are available in all versions of SSLeay. DSAsignsetup() was added in SSLeay 0.8.0.9.7l 2002-09-25 DSAsign(3)