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,
32 unsigned char *p, int pl);
33
34 int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
35 unsigned char *f, int fl);
36
37 int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
38 unsigned char *f, int fl, int rsa_len);
39
40 int RSA_padding_add_none(unsigned char *to, int tlen,
41 unsigned char *f, int fl);
42
43 int RSA_padding_check_none(unsigned char *to, int tlen,
44 unsigned char *f, int fl, int rsa_len);
45
47 The RSA_padding_xxx_xxx() functions are called from the RSA encrypt,
48 decrypt, sign and verify functions. Normally they should not be called
49 from application programs.
50
51 However, they can also be called directly to implement padding for
52 other asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and
53 RSA_padding_check_PKCS1_OAEP() may be used in an application combined
54 with RSA_NO_PADDING in order to implement OAEP with an encoding
55 parameter.
56
57 RSA_padding_add_xxx() encodes fl bytes from f so as to fit into tlen
58 bytes and stores the result at to. An error occurs if fl does not meet
59 the size requirements of the encoding method.
60
61 The following encoding methods are implemented:
62
63 PKCS1_type_1
64 PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for
65 signatures
66
67 PKCS1_type_2
68 PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2)
69
70 PKCS1_OAEP
71 PKCS #1 v2.0 EME-OAEP
72
73 SSLv23
74 PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification
75
76 none
77 simply copy the data
78
79 The random number generator must be seeded prior to calling
80 RSA_padding_add_xxx().
81
82 RSA_padding_check_xxx() verifies that the fl bytes at f contain a valid
83 encoding for a rsa_len byte RSA key in the respective encoding method
84 and stores the recovered data of at most tlen bytes (for
85 RSA_NO_PADDING: of size tlen) at to.
86
87 For RSA_padding_xxx_OAEP(), p points to the encoding parameter of
88 length pl. p may be NULL if pl is 0.
89
91 The RSA_padding_add_xxx() functions return 1 on success, 0 on error.
92 The RSA_padding_check_xxx() functions return the length of the
93 recovered data, -1 on error. Error codes can be obtained by calling
94 ERR_get_error(3).
95
97 The RSA_padding_check_PKCS1_type_2() padding check leaks timing
98 information which can potentially be used to mount a Bleichenbacher
99 padding oracle attack. This is an inherent weakness in the PKCS #1 v1.5
100 padding design. Prefer PKCS1_OAEP padding.
101
103 RSA_public_encrypt(3), RSA_private_decrypt(3), RSA_sign(3),
104 RSA_verify(3)
105
107 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
108
109 Licensed under the OpenSSL license (the "License"). You may not use
110 this file except in compliance with the License. You can obtain a copy
111 in the file LICENSE in the source distribution or at
112 <https://www.openssl.org/source/license.html>.
113
114
115
1161.1.1 2018-09-11 RSA_PADDING_ADD_PKCS1_TYPE_1(3)