DSA_sign.pod revision 337982
1=pod
2
3=head1 NAME
4
5DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures
6
7=head1 SYNOPSIS
8
9 #include <openssl/dsa.h>
10
11 int	DSA_sign(int type, const unsigned char *dgst, int len,
12		unsigned char *sigret, unsigned int *siglen, DSA *dsa);
13
14 int	DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp,
15                BIGNUM **rp);
16
17 int	DSA_verify(int type, const unsigned char *dgst, int len,
18		unsigned char *sigbuf, int siglen, DSA *dsa);
19
20=head1 DESCRIPTION
21
22DSA_sign() computes a digital signature on the B<len> byte message
23digest B<dgst> using the private key B<dsa> and places its ASN.1 DER
24encoding at B<sigret>. The length of the signature is places in
25*B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
26
27DSA_sign_setup() may be used to precompute part of the signing
28operation in case signature generation is time-critical. It expects
29B<dsa> to contain DSA parameters. It places the precomputed values
30in newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing
31the old ones unless *B<kinvp> and *B<rp> are NULL. These values may
32be passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>.
33B<ctx> is a pre-allocated B<BN_CTX> or NULL.
34The precomputed values from DSA_sign_setup() B<MUST NOT be used> for
35more than one signature: using the same B<dsa-E<gt>kinv> and
36B<dsa-E<gt>r> pair twice under the same private key on different
37plaintexts will result in permanently exposing the DSA private key.
38
39DSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
40matches a given message digest B<dgst> of size B<len>.
41B<dsa> is the signer's public key.
42
43The B<type> parameter is ignored.
44
45The PRNG must be seeded before DSA_sign() (or DSA_sign_setup())
46is called.
47
48=head1 RETURN VALUES
49
50DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
51DSA_verify() returns 1 for a valid signature, 0 for an incorrect
52signature and -1 on error. The error codes can be obtained by
53L<ERR_get_error(3)|ERR_get_error(3)>.
54
55=head1 CONFORMING TO
56
57US Federal Information Processing Standard FIPS 186 (Digital Signature
58Standard, DSS), ANSI X9.30
59
60=head1 SEE ALSO
61
62L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>,
63L<DSA_do_sign(3)|DSA_do_sign(3)>
64
65=head1 HISTORY
66
67DSA_sign() and DSA_verify() are available in all versions of SSLeay.
68DSA_sign_setup() was added in SSLeay 0.8.
69
70=cut
71