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