import libcrypto (LibreSSL 2.5.2)
[unleashed.git] / lib / libcrypto / man / RSA_sign.3
blobc523f2750a9750bd8309bde74b155a3b7c337d6d
1 .\"     $OpenBSD: RSA_sign.3,v 1.4 2016/12/11 12:21:48 schwarze Exp $
2 .\"     OpenSSL aa90ca11 Aug 20 15:48:56 2016 -0400
3 .\"
4 .\" This file was written by Ulf Moeller <ulf@openssl.org>.
5 .\" Copyright (c) 2000, 2005, 2014, 2015, 2016 The OpenSSL Project.
6 .\" All rights reserved.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\"
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\"
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\"    notice, this list of conditions and the following disclaimer in
17 .\"    the documentation and/or other materials provided with the
18 .\"    distribution.
19 .\"
20 .\" 3. All advertising materials mentioning features or use of this
21 .\"    software must display the following acknowledgment:
22 .\"    "This product includes software developed by the OpenSSL Project
23 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 .\"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\"    endorse or promote products derived from this software without
27 .\"    prior written permission. For written permission, please contact
28 .\"    openssl-core@openssl.org.
29 .\"
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\"    nor may "OpenSSL" appear in their names without prior written
32 .\"    permission of the OpenSSL Project.
33 .\"
34 .\" 6. Redistributions of any form whatsoever must retain the following
35 .\"    acknowledgment:
36 .\"    "This product includes software developed by the OpenSSL Project
37 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 .\"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
51 .\"
52 .Dd $Mdocdate: December 11 2016 $
53 .Dt RSA_SIGN 3
54 .Os
55 .Sh NAME
56 .Nm RSA_sign ,
57 .Nm RSA_verify
58 .Nd RSA signatures
59 .Sh SYNOPSIS
60 .In openssl/rsa.h
61 .Ft int
62 .Fo RSA_sign
63 .Fa "int type"
64 .Fa "const unsigned char *m"
65 .Fa "unsigned int m_len"
66 .Fa "unsigned char *sigret"
67 .Fa "unsigned int *siglen"
68 .Fa "RSA *rsa"
69 .Fc
70 .Ft int
71 .Fo RSA_verify
72 .Fa "int type"
73 .Fa "const unsigned char *m"
74 .Fa "unsigned int m_len"
75 .Fa "unsigned char *sigbuf"
76 .Fa "unsigned int siglen"
77 .Fa "RSA *rsa"
78 .Fc
79 .Sh DESCRIPTION
80 .Fn RSA_sign
81 signs the message digest
82 .Fa m
83 of size
84 .Fa m_len
85 using the private key
86 .Fa rsa
87 using RSASSA-PKCS1-v1_5 as specified in RFC 3447.
88 It stores the signature in
89 .Fa sigret
90 and the signature size in
91 .Fa siglen .
92 .Fa sigret
93 must point to
94 .Fn RSA_size rsa
95 bytes of memory.
96 Note that PKCS #1 adds meta-data, placing limits on the size of the key
97 that can be used.
98 See
99 .Xr RSA_private_encrypt 3
100 for lower-level operations.
102 .Fa type
103 denotes the message digest algorithm that was used to generate
104 .Fa m .
106 .Fa type
108 .Sy NID_md5_sha1 ,
109 an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding and
110 no algorithm identifier) is created.
112 .Fn RSA_verify
113 verifies that the signature
114 .Fa sigbuf
115 of size
116 .Fa siglen
117 matches a given message digest
118 .Fa m
119 of size
120 .Fa m_len .
121 .Fa type
122 denotes the message digest algorithm that was used to generate the
123 signature.
124 .Fa rsa
125 is the signer's public key.
126 .Sh RETURN VALUES
127 .Fn RSA_sign
128 returns 1 on success.
129 .Fn RSA_verify
130 returns 1 on successful verification.
132 The error codes can be obtained by
133 .Xr ERR_get_error 3 .
134 .Sh SEE ALSO
135 .Xr ERR_get_error 3 ,
136 .Xr RSA_new 3 ,
137 .Xr RSA_private_encrypt 3 ,
138 .Xr RSA_public_decrypt 3
139 .Sh STANDARDS
140 SSL, PKCS #1 v2.0
141 .Sh HISTORY
142 .Fn RSA_sign
144 .Fn RSA_verify
145 are available in all versions of SSLeay and OpenSSL.