5 RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1,
6 RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2,
7 RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP,
8 RSA_padding_add_SSLv23, RSA_padding_check_SSLv23,
9 RSA_padding_add_none, RSA_padding_check_none - Asymmetric encryption
14 #include <openssl/rsa.h>
16 int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
17 unsigned char *f, int fl);
19 int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
20 unsigned char *f, int fl, int rsa_len);
22 int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
23 unsigned char *f, int fl);
25 int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
26 unsigned char *f, int fl, int rsa_len);
28 int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
29 unsigned char *f, int fl, unsigned char *p, int pl);
31 int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
32 unsigned char *f, int fl, int rsa_len, unsigned char *p, int pl);
34 int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
35 unsigned char *f, int fl);
37 int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
38 unsigned char *f, int fl, int rsa_len);
40 int RSA_padding_add_none(unsigned char *to, int tlen,
41 unsigned char *f, int fl);
43 int RSA_padding_check_none(unsigned char *to, int tlen,
44 unsigned char *f, int fl, int rsa_len);
48 The RSA_padding_xxx_xxx() functions are called from the RSA encrypt,
49 decrypt, sign and verify functions. Normally they should not be called
50 from application programs.
52 However, they can also be called directly to implement padding for other
53 asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and
54 RSA_padding_check_PKCS1_OAEP() may be used in an application combined
55 with B<RSA_NO_PADDING> in order to implement OAEP with an encoding
58 RSA_padding_add_xxx() encodes B<fl> bytes from B<f> so as to fit into
59 B<tlen> bytes and stores the result at B<to>. An error occurs if B<fl>
60 does not meet the size requirements of the encoding method.
62 The following encoding methods are implemented:
68 PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for signatures
72 PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2)
80 PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification
88 The random number generator must be seeded prior to calling
89 RSA_padding_add_xxx().
91 RSA_padding_check_xxx() verifies that the B<fl> bytes at B<f> contain
92 a valid encoding for a B<rsa_len> byte RSA key in the respective
93 encoding method and stores the recovered data of at most B<tlen> bytes
96 For RSA_padding_xxx_OAEP(), B<p> points to the encoding parameter
97 of length B<pl>. B<p> may be B<NULL> if B<pl> is 0.
101 The RSA_padding_add_xxx() functions return 1 on success, 0 on error.
102 The RSA_padding_check_xxx() functions return the length of the
103 recovered data, -1 on error. Error codes can be obtained by calling
104 L<ERR_get_error(3)|ERR_get_error(3)>.
108 L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>,
109 L<RSA_private_decrypt(3)|RSA_private_decrypt(3)>,
110 L<RSA_sign(3)|RSA_sign(3)>, L<RSA_verify(3)|RSA_verify(3)>
114 RSA_padding_add_PKCS1_type_1(), RSA_padding_check_PKCS1_type_1(),
115 RSA_padding_add_PKCS1_type_2(), RSA_padding_check_PKCS1_type_2(),
116 RSA_padding_add_SSLv23(), RSA_padding_check_SSLv23(),
117 RSA_padding_add_none() and RSA_padding_check_none() appeared in
120 RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() were
121 added in OpenSSL 0.9.2b.