1RSA_padding_add_PKCS1_type_1(3) OpenSSL RSA_padding_add_PKCS1_type_1(3)
2
3
4
6 RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1,
7 RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2,
8 RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP,
9 RSA_padding_add_SSLv23, RSA_padding_check_SSLv23, RSA_padding_add_none,
10 RSA_padding_check_none - asymmetric encryption padding
11
13 #include <openssl/rsa.h>
14
15 int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
16 unsigned char *f, int fl);
17
18 int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
19 unsigned char *f, int fl, int rsa_len);
20
21 int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
22 unsigned char *f, int fl);
23
24 int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
25 unsigned char *f, int fl, int rsa_len);
26
27 int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
28 unsigned char *f, int fl, unsigned char *p, int pl);
29
30 int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
31 unsigned char *f, int fl, int rsa_len, unsigned char *p, int pl);
32
33 int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
34 unsigned char *f, int fl);
35
36 int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
37 unsigned char *f, int fl, int rsa_len);
38
39 int RSA_padding_add_none(unsigned char *to, int tlen,
40 unsigned char *f, int fl);
41
42 int RSA_padding_check_none(unsigned char *to, int tlen,
43 unsigned char *f, int fl, int rsa_len);
44
46 The RSA_padding_xxx_xxx() functions are called from the RSA encrypt,
47 decrypt, sign and verify functions. Normally they should not be called
48 from application programs.
49
50 However, they can also be called directly to implement padding for
51 other asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and
52 RSA_padding_check_PKCS1_OAEP() may be used in an application combined
53 with RSA_NO_PADDING in order to implement OAEP with an encoding
54 parameter.
55
56 RSA_padding_add_xxx() encodes fl bytes from f so as to fit into tlen
57 bytes and stores the result at to. An error occurs if fl does not meet
58 the size requirements of the encoding method.
59
60 The following encoding methods are implemented:
61
62 PKCS1_type_1
63 PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for
64 signatures
65
66 PKCS1_type_2
67 PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2)
68
69 PKCS1_OAEP
70 PKCS #1 v2.0 EME-OAEP
71
72 SSLv23
73 PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification
74
75 none
76 simply copy the data
77
78 The random number generator must be seeded prior to calling
79 RSA_padding_add_xxx().
80
81 RSA_padding_check_xxx() verifies that the fl bytes at f contain a valid
82 encoding for a rsa_len byte RSA key in the respective encoding method
83 and stores the recovered data of at most tlen bytes (for
84 RSA_NO_PADDING: of size tlen) at to.
85
86 For RSA_padding_xxx_OAEP(), p points to the encoding parameter of
87 length pl. p may be NULL if pl is 0.
88
90 The RSA_padding_add_xxx() functions return 1 on success, 0 on error.
91 The RSA_padding_check_xxx() functions return the length of the
92 recovered data, -1 on error. Error codes can be obtained by calling
93 ERR_get_error(3).
94
96 The RSA_padding_check_PKCS1_type_2() padding check leaks timing
97 information which can potentially be used to mount a Bleichenbacher
98 padding oracle attack. This is an inherent weakness in the PKCS #1 v1.5
99 padding design. Prefer PKCS1_OAEP padding.
100
102 RSA_public_encrypt(3), RSA_private_decrypt(3), RSA_sign(3),
103 RSA_verify(3)
104
106 RSA_padding_add_PKCS1_type_1(), RSA_padding_check_PKCS1_type_1(),
107 RSA_padding_add_PKCS1_type_2(), RSA_padding_check_PKCS1_type_2(),
108 RSA_padding_add_SSLv23(), RSA_padding_check_SSLv23(),
109 RSA_padding_add_none() and RSA_padding_check_none() appeared in SSLeay
110 0.9.0.
111
112 RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() were
113 added in OpenSSL 0.9.2b.
114
115
116
1171.0.2o 2020-01-28 RSA_padding_add_PKCS1_type_1(3)