1RSA_PRIVATE_ENCRYPT(3) OpenSSL RSA_PRIVATE_ENCRYPT(3)
2
3
4
6 RSA_private_encrypt, RSA_public_decrypt - low-level signature
7 operations
8
10 #include <openssl/rsa.h>
11
12 int RSA_private_encrypt(int flen, unsigned char *from,
13 unsigned char *to, RSA *rsa, int padding);
14
15 int RSA_public_decrypt(int flen, unsigned char *from,
16 unsigned char *to, RSA *rsa, int padding);
17
19 These functions handle RSA signatures at a low-level.
20
21 RSA_private_encrypt() signs the flen bytes at from (usually a message
22 digest with an algorithm identifier) using the private key rsa and
23 stores the signature in to. to must point to RSA_size(rsa) bytes of
24 memory.
25
26 padding denotes one of the following modes:
27
28 RSA_PKCS1_PADDING
29 PKCS #1 v1.5 padding. This function does not handle the
30 algorithmIdentifier specified in PKCS #1. When generating or
31 verifying PKCS #1 signatures, RSA_sign(3) and RSA_verify(3) should
32 be used.
33
34 RSA_NO_PADDING
35 Raw RSA signature. This mode should only be used to implement
36 cryptographically sound padding modes in the application code.
37 Signing user data directly with RSA is insecure.
38
39 RSA_public_decrypt() recovers the message digest from the flen bytes
40 long signature at from using the signer's public key rsa. to must point
41 to a memory section large enough to hold the message digest (which is
42 smaller than RSA_size(rsa) - 11). padding is the padding mode that was
43 used to sign the data.
44
46 RSA_private_encrypt() returns the size of the signature (i.e.,
47 RSA_size(rsa)). RSA_public_decrypt() returns the size of the recovered
48 message digest.
49
50 On error, -1 is returned; the error codes can be obtained by
51 ERR_get_error(3).
52
54 ERR_get_error(3), RSA_sign(3), RSA_verify(3)
55
57 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
58
59 Licensed under the OpenSSL license (the "License"). You may not use
60 this file except in compliance with the License. You can obtain a copy
61 in the file LICENSE in the source distribution or at
62 <https://www.openssl.org/source/license.html>.
63
64
65
661.1.1i 2021-01-26 RSA_PRIVATE_ENCRYPT(3)