1RSA_PRIVATE_ENCRYPT(3ossl) OpenSSL RSA_PRIVATE_ENCRYPT(3ossl)
2
3
4
6 RSA_private_encrypt, RSA_public_decrypt - low-level signature
7 operations
8
10 #include <openssl/rsa.h>
11
12 The following functions have been deprecated since OpenSSL 3.0, and can
13 be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
14 version value, see openssl_user_macros(7):
15
16 int RSA_private_encrypt(int flen, unsigned char *from,
17 unsigned char *to, RSA *rsa, int padding);
18
19 int RSA_public_decrypt(int flen, unsigned char *from,
20 unsigned char *to, RSA *rsa, int padding);
21
23 Both of the functions described on this page are deprecated.
24 Applications should instead use EVP_PKEY_sign_init_ex(3),
25 EVP_PKEY_sign(3), EVP_PKEY_verify_recover_init(3), and
26 EVP_PKEY_verify_recover(3).
27
28 These functions handle RSA signatures at a low-level.
29
30 RSA_private_encrypt() signs the flen bytes at from (usually a message
31 digest with an algorithm identifier) using the private key rsa and
32 stores the signature in to. to must point to RSA_size(rsa) bytes of
33 memory.
34
35 padding denotes one of the following modes:
36
37 RSA_PKCS1_PADDING
38 PKCS #1 v1.5 padding. This function does not handle the
39 algorithmIdentifier specified in PKCS #1. When generating or
40 verifying PKCS #1 signatures, RSA_sign(3) and RSA_verify(3) should
41 be used.
42
43 RSA_NO_PADDING
44 Raw RSA signature. This mode should only be used to implement
45 cryptographically sound padding modes in the application code.
46 Signing user data directly with RSA is insecure.
47
48 RSA_public_decrypt() recovers the message digest from the flen bytes
49 long signature at from using the signer's public key rsa. to must point
50 to a memory section large enough to hold the message digest (which is
51 smaller than RSA_size(rsa) - 11). padding is the padding mode that was
52 used to sign the data.
53
55 RSA_private_encrypt() returns the size of the signature (i.e.,
56 RSA_size(rsa)). RSA_public_decrypt() returns the size of the recovered
57 message digest.
58
59 On error, -1 is returned; the error codes can be obtained by
60 ERR_get_error(3).
61
63 ERR_get_error(3), RSA_sign(3), RSA_verify(3), EVP_PKEY_sign(3),
64 EVP_PKEY_verify_recover(3)
65
67 Both of these functions were deprecated in OpenSSL 3.0.
68
70 Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
71
72 Licensed under the Apache License 2.0 (the "License"). You may not use
73 this file except in compliance with the License. You can obtain a copy
74 in the file LICENSE in the source distribution or at
75 <https://www.openssl.org/source/license.html>.
76
77
78
793.1.1 2023-08-31 RSA_PRIVATE_ENCRYPT(3ossl)