1RSA_private_encrypt(3)              OpenSSL             RSA_private_encrypt(3)
2
3
4

NAME

6       RSA_private_encrypt, RSA_public_decrypt - low level signature opera‐
7       tions
8

SYNOPSIS

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

DESCRIPTION

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 algorithmI‐
30           dentifier specified in PKCS #1. When generating or verifying PKCS
31           #1 signatures, RSA_sign(3) and RSA_verify(3) should be used.
32
33       RSA_NO_PADDING
34           Raw RSA signature. This mode should only be used to implement cryp‐
35           tographically sound padding modes in the application code.  Signing
36           user data directly with RSA is insecure.
37
38       RSA_public_decrypt() recovers the message digest from the flen bytes
39       long signature at from using the signer's public key rsa. to must point
40       to a memory section large enough to hold the message digest (which is
41       smaller than RSA_size(rsa) - 11). padding is the padding mode that was
42       used to sign the data.
43

RETURN VALUES

45       RSA_private_encrypt() returns the size of the signature (i.e.,
46       RSA_size(rsa)). RSA_public_decrypt() returns the size of the recovered
47       message digest.
48
49       On error, -1 is returned; the error codes can be obtained by
50       ERR_get_error(3).
51

SEE ALSO

53       ERR_get_error(3), rsa(3), RSA_sign(3), RSA_verify(3)
54

HISTORY

56       The padding argument was added in SSLeay 0.8. RSA_NO_PADDING is avail‐
57       able since SSLeay 0.9.0.
58
59
60
610.9.8b                            2002-09-25            RSA_private_encrypt(3)
Impressum