xref: /freebsd/crypto/openssl/doc/man3/RSA_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 KimRSA_sign, RSA_verify - RSA signatures
6*e71b7053SJung-uk Kim
7*e71b7053SJung-uk Kim=head1 SYNOPSIS
8*e71b7053SJung-uk Kim
9*e71b7053SJung-uk Kim #include <openssl/rsa.h>
10*e71b7053SJung-uk Kim
11*e71b7053SJung-uk Kim int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
12*e71b7053SJung-uk Kim              unsigned char *sigret, unsigned int *siglen, RSA *rsa);
13*e71b7053SJung-uk Kim
14*e71b7053SJung-uk Kim int RSA_verify(int type, const unsigned char *m, unsigned int m_len,
15*e71b7053SJung-uk Kim                unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
16*e71b7053SJung-uk Kim
17*e71b7053SJung-uk Kim=head1 DESCRIPTION
18*e71b7053SJung-uk Kim
19*e71b7053SJung-uk KimRSA_sign() signs the message digest B<m> of size B<m_len> using the
20*e71b7053SJung-uk Kimprivate key B<rsa> using RSASSA-PKCS1-v1_5 as specified in RFC 3447. It
21*e71b7053SJung-uk Kimstores the signature in B<sigret> and the signature size in B<siglen>.
22*e71b7053SJung-uk KimB<sigret> must point to RSA_size(B<rsa>) bytes of memory.
23*e71b7053SJung-uk KimNote that PKCS #1 adds meta-data, placing limits on the size of the
24*e71b7053SJung-uk Kimkey that can be used.
25*e71b7053SJung-uk KimSee L<RSA_private_encrypt(3)> for lower-level
26*e71b7053SJung-uk Kimoperations.
27*e71b7053SJung-uk Kim
28*e71b7053SJung-uk KimB<type> denotes the message digest algorithm that was used to generate
29*e71b7053SJung-uk KimB<m>.
30*e71b7053SJung-uk KimIf B<type> is B<NID_md5_sha1>,
31*e71b7053SJung-uk Kiman SSL signature (MD5 and SHA1 message digests with PKCS #1 padding
32*e71b7053SJung-uk Kimand no algorithm identifier) is created.
33*e71b7053SJung-uk Kim
34*e71b7053SJung-uk KimRSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
35*e71b7053SJung-uk Kimmatches a given message digest B<m> of size B<m_len>. B<type> denotes
36*e71b7053SJung-uk Kimthe message digest algorithm that was used to generate the signature.
37*e71b7053SJung-uk KimB<rsa> is the signer's public key.
38*e71b7053SJung-uk Kim
39*e71b7053SJung-uk Kim=head1 RETURN VALUES
40*e71b7053SJung-uk Kim
41*e71b7053SJung-uk KimRSA_sign() returns 1 on success.
42*e71b7053SJung-uk KimRSA_verify() returns 1 on successful verification.
43*e71b7053SJung-uk Kim
44*e71b7053SJung-uk KimThe error codes can be obtained by L<ERR_get_error(3)>.
45*e71b7053SJung-uk Kim
46*e71b7053SJung-uk Kim=head1 CONFORMING TO
47*e71b7053SJung-uk Kim
48*e71b7053SJung-uk KimSSL, PKCS #1 v2.0
49*e71b7053SJung-uk Kim
50*e71b7053SJung-uk Kim=head1 SEE ALSO
51*e71b7053SJung-uk Kim
52*e71b7053SJung-uk KimL<ERR_get_error(3)>,
53*e71b7053SJung-uk KimL<RSA_private_encrypt(3)>,
54*e71b7053SJung-uk KimL<RSA_public_decrypt(3)>
55*e71b7053SJung-uk Kim
56*e71b7053SJung-uk Kim=head1 COPYRIGHT
57*e71b7053SJung-uk Kim
58*e71b7053SJung-uk KimCopyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
59*e71b7053SJung-uk Kim
60*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
61*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
62*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
63*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
64*e71b7053SJung-uk Kim
65*e71b7053SJung-uk Kim=cut
66