xref: /freebsd/crypto/openssl/doc/man3/DSA_sign.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
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
11*b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be
12*b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
13*b077aed3SPierre Proncherysee L<openssl_user_macros(7)>:
14*b077aed3SPierre Pronchery
15e71b7053SJung-uk Kim int DSA_sign(int type, const unsigned char *dgst, int len,
16e71b7053SJung-uk Kim              unsigned char *sigret, unsigned int *siglen, DSA *dsa);
17e71b7053SJung-uk Kim
18e71b7053SJung-uk Kim int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);
19e71b7053SJung-uk Kim
20e71b7053SJung-uk Kim int DSA_verify(int type, const unsigned char *dgst, int len,
21e71b7053SJung-uk Kim                unsigned char *sigbuf, int siglen, DSA *dsa);
22e71b7053SJung-uk Kim
23e71b7053SJung-uk Kim=head1 DESCRIPTION
24e71b7053SJung-uk Kim
25*b077aed3SPierre ProncheryAll of the functions described on this page are deprecated.
26*b077aed3SPierre ProncheryApplications should instead use L<EVP_PKEY_sign_init(3)>, L<EVP_PKEY_sign(3)>,
27*b077aed3SPierre ProncheryL<EVP_PKEY_verify_init(3)> and L<EVP_PKEY_verify(3)>.
28*b077aed3SPierre Pronchery
29e71b7053SJung-uk KimDSA_sign() computes a digital signature on the B<len> byte message
30e71b7053SJung-uk Kimdigest B<dgst> using the private key B<dsa> and places its ASN.1 DER
31e71b7053SJung-uk Kimencoding at B<sigret>. The length of the signature is places in
32e71b7053SJung-uk Kim*B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
33e71b7053SJung-uk Kim
34e71b7053SJung-uk KimDSA_sign_setup() is defined only for backward binary compatibility and
35e71b7053SJung-uk Kimshould not be used.
36e71b7053SJung-uk KimSince OpenSSL 1.1.0 the DSA type is opaque and the output of
37e71b7053SJung-uk KimDSA_sign_setup() cannot be used anyway: calling this function will only
38e71b7053SJung-uk Kimcause overhead, and does not affect the actual signature
39e71b7053SJung-uk Kim(pre-)computation.
40e71b7053SJung-uk Kim
41e71b7053SJung-uk KimDSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
42e71b7053SJung-uk Kimmatches a given message digest B<dgst> of size B<len>.
43e71b7053SJung-uk KimB<dsa> is the signer's public key.
44e71b7053SJung-uk Kim
45e71b7053SJung-uk KimThe B<type> parameter is ignored.
46e71b7053SJung-uk Kim
47da327cd2SJung-uk KimThe random generator must be seeded when DSA_sign() (or DSA_sign_setup())
48e71b7053SJung-uk Kimis called.
49da327cd2SJung-uk KimIf the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to
50da327cd2SJung-uk Kimexternal circumstances (see L<RAND(7)>), the operation will fail.
51e71b7053SJung-uk Kim
52e71b7053SJung-uk Kim=head1 RETURN VALUES
53e71b7053SJung-uk Kim
54e71b7053SJung-uk KimDSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
55e71b7053SJung-uk KimDSA_verify() returns 1 for a valid signature, 0 for an incorrect
56e71b7053SJung-uk Kimsignature and -1 on error. The error codes can be obtained by
57e71b7053SJung-uk KimL<ERR_get_error(3)>.
58e71b7053SJung-uk Kim
59e71b7053SJung-uk Kim=head1 CONFORMING TO
60e71b7053SJung-uk Kim
61*b077aed3SPierre ProncheryUS Federal Information Processing Standard FIPS186-4 (Digital Signature
62e71b7053SJung-uk KimStandard, DSS), ANSI X9.30
63e71b7053SJung-uk Kim
64e71b7053SJung-uk Kim=head1 SEE ALSO
65e71b7053SJung-uk Kim
66e71b7053SJung-uk KimL<DSA_new(3)>, L<ERR_get_error(3)>, L<RAND_bytes(3)>,
67da327cd2SJung-uk KimL<DSA_do_sign(3)>,
68da327cd2SJung-uk KimL<RAND(7)>
69e71b7053SJung-uk Kim
70*b077aed3SPierre Pronchery=head1 HISTORY
71*b077aed3SPierre Pronchery
72*b077aed3SPierre ProncheryAll of these functions were deprecated in OpenSSL 3.0.
73*b077aed3SPierre Pronchery
74e71b7053SJung-uk Kim=head1 COPYRIGHT
75e71b7053SJung-uk Kim
76*b077aed3SPierre ProncheryCopyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
77e71b7053SJung-uk Kim
78*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
79e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
80e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
81e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
82e71b7053SJung-uk Kim
83e71b7053SJung-uk Kim=cut
84