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, RSA_pad‐
7 ding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2, RSA_pad‐
8 ding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP, RSA_pad‐
9 ding_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 RSA_pad‐
52 ding_check_PKCS1_OAEP() may be used in an application combined with
53 RSA_NO_PADDING in order to implement OAEP with an encoding parameter.
54
55 RSA_padding_add_xxx() encodes fl bytes from f so as to fit into tlen
56 bytes and stores the result at to. An error occurs if fl does not meet
57 the size requirements of the encoding method.
58
59 The following encoding methods are implemented:
60
61 PKCS1_type_1
62 PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for
63 signatures
64
65 PKCS1_type_2
66 PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2)
67
68 PKCS1_OAEP
69 PKCS #1 v2.0 EME-OAEP
70
71 SSLv23
72 PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification
73
74 none
75 simply copy the data
76
77 The random number generator must be seeded prior to calling RSA_pad‐
78 ding_add_xxx().
79
80 RSA_padding_check_xxx() verifies that the fl bytes at f contain a valid
81 encoding for a rsa_len byte RSA key in the respective encoding method
82 and stores the recovered data of at most tlen bytes (for RSA_NO_PAD‐
83 DING: of size tlen) at to.
84
85 For RSA_padding_xxx_OAEP(), p points to the encoding parameter of
86 length pl. p may be NULL if pl is 0.
87
89 The RSA_padding_add_xxx() functions return 1 on success, 0 on error.
90 The RSA_padding_check_xxx() functions return the length of the recov‐
91 ered data, -1 on error. Error codes can be obtained by calling
92 ERR_get_error(3).
93
95 RSA_public_encrypt(3), RSA_private_decrypt(3), RSA_sign(3), RSA_ver‐
96 ify(3)
97
99 RSA_padding_add_PKCS1_type_1(), RSA_padding_check_PKCS1_type_1(),
100 RSA_padding_add_PKCS1_type_2(), RSA_padding_check_PKCS1_type_2(),
101 RSA_padding_add_SSLv23(), RSA_padding_check_SSLv23(), RSA_pad‐
102 ding_add_none() and RSA_padding_check_none() appeared in SSLeay 0.9.0.
103
104 RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() were
105 added in OpenSSL 0.9.2b.
106
107
108
1090.9.8b 2000-02-24 RSA_padding_add_PKCS1_type_1(3)