]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/RSA_private_encrypt.pod
Remove an unnecessary call to BN_CTX_free.
[thirdparty/openssl.git] / doc / man3 / RSA_private_encrypt.pod
CommitLineData
2186cd8e
UM
1=pod
2
3=head1 NAME
4
4d524e10 5RSA_private_encrypt, RSA_public_decrypt - low level signature operations
2186cd8e
UM
6
7=head1 SYNOPSIS
8
9 #include <openssl/rsa.h>
10
4fd8a3e1
P
11Deprecated since OpenSSL 3.0, can be hidden entirely by defining
12B<OPENSSL_API_COMPAT> with a suitable version value, see
13L<openssl_user_macros(7)>:
14
e9b77246
BB
15 int RSA_private_encrypt(int flen, unsigned char *from,
16 unsigned char *to, RSA *rsa, int padding);
2186cd8e 17
e9b77246
BB
18 int RSA_public_decrypt(int flen, unsigned char *from,
19 unsigned char *to, RSA *rsa, int padding);
2186cd8e
UM
20
21=head1 DESCRIPTION
22
4fd8a3e1
P
23Both of the functions described on this page are deprecated.
24Applications should instead use L<EVP_PKEY_encrypt_init(3)>,
25L<EVP_PKEY_encrypt(3)>, L<EVP_PKEY_decrypt_init(3)> and L<EVP_PKEY_decrypt(3)>.
26
2186cd8e
UM
27These functions handle RSA signatures at a low level.
28
29RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a
30message digest with an algorithm identifier) using the private key
31B<rsa> and stores the signature in B<to>. B<to> must point to
32B<RSA_size(rsa)> bytes of memory.
33
34B<padding> denotes one of the following modes:
35
36=over 4
37
38=item RSA_PKCS1_PADDING
39
40PKCS #1 v1.5 padding. This function does not handle the
41B<algorithmIdentifier> specified in PKCS #1. When generating or
9b86974e 42verifying PKCS #1 signatures, L<RSA_sign(3)> and L<RSA_verify(3)> should be
2186cd8e
UM
43used.
44
45=item RSA_NO_PADDING
46
47Raw RSA signature. This mode should I<only> be used to implement
48cryptographically sound padding modes in the application code.
49Signing user data directly with RSA is insecure.
50
51=back
52
2186cd8e
UM
53RSA_public_decrypt() recovers the message digest from the B<flen>
54bytes long signature at B<from> using the signer's public key
55B<rsa>. B<to> must point to a memory section large enough to hold the
56message digest (which is smaller than B<RSA_size(rsa) -
5711>). B<padding> is the padding mode that was used to sign the data.
58
59=head1 RETURN VALUES
60
61RSA_private_encrypt() returns the size of the signature (i.e.,
62RSA_size(rsa)). RSA_public_decrypt() returns the size of the
63recovered message digest.
64
65On error, -1 is returned; the error codes can be
9b86974e 66obtained by L<ERR_get_error(3)>.
2186cd8e
UM
67
68=head1 SEE ALSO
69
53934822 70L<ERR_get_error(3)>,
9b86974e 71L<RSA_sign(3)>, L<RSA_verify(3)>
2186cd8e 72
4fd8a3e1
P
73=head1 HISTORY
74
75Both of these functions were deprecated in OpenSSL 3.0.
76
e2f92610
RS
77=head1 COPYRIGHT
78
79Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
80
4746f25a 81Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
82this file except in compliance with the License. You can obtain a copy
83in the file LICENSE in the source distribution or at
84L<https://www.openssl.org/source/license.html>.
85
86=cut