xref: /freebsd/crypto/openssl/doc/man3/RSA_sign.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimRSA_sign, RSA_verify - RSA signatures
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim #include <openssl/rsa.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 RSA_sign(int type, const unsigned char *m, unsigned int m_len,
16e71b7053SJung-uk Kim              unsigned char *sigret, unsigned int *siglen, RSA *rsa);
17e71b7053SJung-uk Kim
18e71b7053SJung-uk Kim int RSA_verify(int type, const unsigned char *m, unsigned int m_len,
19e71b7053SJung-uk Kim                unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
20e71b7053SJung-uk Kim
21e71b7053SJung-uk Kim=head1 DESCRIPTION
22e71b7053SJung-uk Kim
23*b077aed3SPierre ProncheryAll of the functions described on this page are deprecated.
24*b077aed3SPierre ProncheryApplications should instead use L<EVP_PKEY_sign_init(3)>, L<EVP_PKEY_sign(3)>,
25*b077aed3SPierre ProncheryL<EVP_PKEY_verify_init(3)> and L<EVP_PKEY_verify(3)>.
26*b077aed3SPierre Pronchery
27e71b7053SJung-uk KimRSA_sign() signs the message digest B<m> of size B<m_len> using the
28e71b7053SJung-uk Kimprivate key B<rsa> using RSASSA-PKCS1-v1_5 as specified in RFC 3447. It
29e71b7053SJung-uk Kimstores the signature in B<sigret> and the signature size in B<siglen>.
30e71b7053SJung-uk KimB<sigret> must point to RSA_size(B<rsa>) bytes of memory.
31e71b7053SJung-uk KimNote that PKCS #1 adds meta-data, placing limits on the size of the
32e71b7053SJung-uk Kimkey that can be used.
33e71b7053SJung-uk KimSee L<RSA_private_encrypt(3)> for lower-level
34e71b7053SJung-uk Kimoperations.
35e71b7053SJung-uk Kim
36e71b7053SJung-uk KimB<type> denotes the message digest algorithm that was used to generate
37e71b7053SJung-uk KimB<m>.
38e71b7053SJung-uk KimIf B<type> is B<NID_md5_sha1>,
39e71b7053SJung-uk Kiman SSL signature (MD5 and SHA1 message digests with PKCS #1 padding
40e71b7053SJung-uk Kimand no algorithm identifier) is created.
41e71b7053SJung-uk Kim
42e71b7053SJung-uk KimRSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
43e71b7053SJung-uk Kimmatches a given message digest B<m> of size B<m_len>. B<type> denotes
44e71b7053SJung-uk Kimthe message digest algorithm that was used to generate the signature.
45e71b7053SJung-uk KimB<rsa> is the signer's public key.
46e71b7053SJung-uk Kim
47e71b7053SJung-uk Kim=head1 RETURN VALUES
48e71b7053SJung-uk Kim
49*b077aed3SPierre ProncheryRSA_sign() returns 1 on success and 0 for failure.
50*b077aed3SPierre ProncheryRSA_verify() returns 1 on successful verification and 0 for failure.
51e71b7053SJung-uk Kim
52e71b7053SJung-uk KimThe error codes can be obtained by L<ERR_get_error(3)>.
53e71b7053SJung-uk Kim
54e71b7053SJung-uk Kim=head1 CONFORMING TO
55e71b7053SJung-uk Kim
56e71b7053SJung-uk KimSSL, PKCS #1 v2.0
57e71b7053SJung-uk Kim
58e71b7053SJung-uk Kim=head1 SEE ALSO
59e71b7053SJung-uk Kim
60e71b7053SJung-uk KimL<ERR_get_error(3)>,
61e71b7053SJung-uk KimL<RSA_private_encrypt(3)>,
62e71b7053SJung-uk KimL<RSA_public_decrypt(3)>
63e71b7053SJung-uk Kim
64*b077aed3SPierre Pronchery=head1 HISTORY
65*b077aed3SPierre Pronchery
66*b077aed3SPierre ProncheryAll of these functions were deprecated in OpenSSL 3.0.
67*b077aed3SPierre Pronchery
68e71b7053SJung-uk Kim=head1 COPYRIGHT
69e71b7053SJung-uk Kim
70*b077aed3SPierre ProncheryCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
71e71b7053SJung-uk Kim
72*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
73e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
74e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
75e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
76e71b7053SJung-uk Kim
77e71b7053SJung-uk Kim=cut
78