xref: /freebsd/crypto/openssl/doc/man3/DSA_sign.pod (revision da327cd22e88f26f6cab9d4c45805b512139aa11)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimDSA_sign, DSA_sign_setup, DSA_verify - DSA signatures
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim #include <openssl/dsa.h>
10e71b7053SJung-uk Kim
11e71b7053SJung-uk Kim int DSA_sign(int type, const unsigned char *dgst, int len,
12e71b7053SJung-uk Kim              unsigned char *sigret, unsigned int *siglen, DSA *dsa);
13e71b7053SJung-uk Kim
14e71b7053SJung-uk Kim int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);
15e71b7053SJung-uk Kim
16e71b7053SJung-uk Kim int DSA_verify(int type, const unsigned char *dgst, int len,
17e71b7053SJung-uk Kim                unsigned char *sigbuf, int siglen, DSA *dsa);
18e71b7053SJung-uk Kim
19e71b7053SJung-uk Kim=head1 DESCRIPTION
20e71b7053SJung-uk Kim
21e71b7053SJung-uk KimDSA_sign() computes a digital signature on the B<len> byte message
22e71b7053SJung-uk Kimdigest B<dgst> using the private key B<dsa> and places its ASN.1 DER
23e71b7053SJung-uk Kimencoding at B<sigret>. The length of the signature is places in
24e71b7053SJung-uk Kim*B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
25e71b7053SJung-uk Kim
26e71b7053SJung-uk KimDSA_sign_setup() is defined only for backward binary compatibility and
27e71b7053SJung-uk Kimshould not be used.
28e71b7053SJung-uk KimSince OpenSSL 1.1.0 the DSA type is opaque and the output of
29e71b7053SJung-uk KimDSA_sign_setup() cannot be used anyway: calling this function will only
30e71b7053SJung-uk Kimcause overhead, and does not affect the actual signature
31e71b7053SJung-uk Kim(pre-)computation.
32e71b7053SJung-uk Kim
33e71b7053SJung-uk KimDSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
34e71b7053SJung-uk Kimmatches a given message digest B<dgst> of size B<len>.
35e71b7053SJung-uk KimB<dsa> is the signer's public key.
36e71b7053SJung-uk Kim
37e71b7053SJung-uk KimThe B<type> parameter is ignored.
38e71b7053SJung-uk Kim
39*da327cd2SJung-uk KimThe random generator must be seeded when DSA_sign() (or DSA_sign_setup())
40e71b7053SJung-uk Kimis called.
41*da327cd2SJung-uk KimIf the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to
42*da327cd2SJung-uk Kimexternal circumstances (see L<RAND(7)>), the operation will fail.
43e71b7053SJung-uk Kim
44e71b7053SJung-uk Kim=head1 RETURN VALUES
45e71b7053SJung-uk Kim
46e71b7053SJung-uk KimDSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
47e71b7053SJung-uk KimDSA_verify() returns 1 for a valid signature, 0 for an incorrect
48e71b7053SJung-uk Kimsignature and -1 on error. The error codes can be obtained by
49e71b7053SJung-uk KimL<ERR_get_error(3)>.
50e71b7053SJung-uk Kim
51e71b7053SJung-uk Kim=head1 CONFORMING TO
52e71b7053SJung-uk Kim
53e71b7053SJung-uk KimUS Federal Information Processing Standard FIPS 186 (Digital Signature
54e71b7053SJung-uk KimStandard, DSS), ANSI X9.30
55e71b7053SJung-uk Kim
56e71b7053SJung-uk Kim=head1 SEE ALSO
57e71b7053SJung-uk Kim
58e71b7053SJung-uk KimL<DSA_new(3)>, L<ERR_get_error(3)>, L<RAND_bytes(3)>,
59*da327cd2SJung-uk KimL<DSA_do_sign(3)>,
60*da327cd2SJung-uk KimL<RAND(7)>
61e71b7053SJung-uk Kim
62e71b7053SJung-uk Kim=head1 COPYRIGHT
63e71b7053SJung-uk Kim
64*da327cd2SJung-uk KimCopyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
65e71b7053SJung-uk Kim
66e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
67e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
68e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
69e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
70e71b7053SJung-uk Kim
71e71b7053SJung-uk Kim=cut
72