1SSL_CTX_SET_SECURITY_LEVEL(3ossl)   OpenSSL  SSL_CTX_SET_SECURITY_LEVEL(3ossl)
2
3
4

NAME

6       SSL_CTX_set_security_level, SSL_set_security_level,
7       SSL_CTX_get_security_level, SSL_get_security_level,
8       SSL_CTX_set_security_callback, SSL_set_security_callback,
9       SSL_CTX_get_security_callback, SSL_get_security_callback,
10       SSL_CTX_set0_security_ex_data, SSL_set0_security_ex_data,
11       SSL_CTX_get0_security_ex_data, SSL_get0_security_ex_data - SSL/TLS
12       security framework
13

SYNOPSIS

15        #include <openssl/ssl.h>
16
17        void SSL_CTX_set_security_level(SSL_CTX *ctx, int level);
18        void SSL_set_security_level(SSL *s, int level);
19
20        int SSL_CTX_get_security_level(const SSL_CTX *ctx);
21        int SSL_get_security_level(const SSL *s);
22
23        void SSL_CTX_set_security_callback(SSL_CTX *ctx,
24                                           int (*cb)(SSL *s, SSL_CTX *ctx, int op,
25                                                     int bits, int nid,
26                                                     void *other, void *ex));
27
28        void SSL_set_security_callback(SSL *s, int (*cb)(SSL *s, SSL_CTX *ctx, int op,
29                                                         int bits, int nid,
30                                                         void *other, void *ex));
31
32        int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx))(SSL *s, SSL_CTX *ctx, int op,
33                                                                 int bits, int nid, void *other,
34                                                                 void *ex);
35        int (*SSL_get_security_callback(const SSL *s))(SSL *s, SSL_CTX *ctx, int op,
36                                                       int bits, int nid, void *other,
37                                                       void *ex);
38
39        void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex);
40        void SSL_set0_security_ex_data(SSL *s, void *ex);
41
42        void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx);
43        void *SSL_get0_security_ex_data(const SSL *s);
44

DESCRIPTION

46       The functions SSL_CTX_set_security_level() and SSL_set_security_level()
47       set the security level to level. If not set the library default
48       security level is used.
49
50       The functions SSL_CTX_get_security_level() and SSL_get_security_level()
51       retrieve the current security level.
52
53       SSL_CTX_set_security_callback(), SSL_set_security_callback(),
54       SSL_CTX_get_security_callback() and SSL_get_security_callback() get or
55       set the security callback associated with ctx or s. If not set a
56       default security callback is used. The meaning of the parameters and
57       the behaviour of the default callbacks is described below.
58
59       SSL_CTX_set0_security_ex_data(), SSL_set0_security_ex_data(),
60       SSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() set the
61       extra data pointer passed to the ex parameter of the callback. This
62       value is passed to the callback verbatim and can be set to any
63       convenient application specific value.
64

DEFAULT CALLBACK BEHAVIOUR

66       If an application doesn't set its own security callback the default
67       callback is used. It is intended to provide sane defaults. The meaning
68       of each level is described below.
69
70       Level 0
71           Everything is permitted. This retains compatibility with previous
72           versions of OpenSSL.
73
74       Level 1
75           The security level corresponds to a minimum of 80 bits of security.
76           Any parameters offering below 80 bits of security are excluded. As
77           a result RSA, DSA and DH keys shorter than 1024 bits and ECC keys
78           shorter than 160 bits are prohibited. All export cipher suites are
79           prohibited since they all offer less than 80 bits of security. SSL
80           version 2 is prohibited. Any cipher suite using MD5 for the MAC is
81           also prohibited. Note that signatures using SHA1 and MD5 are also
82           forbidden at this level as they have less than 80 security bits.
83
84       Level 2
85           Security level set to 112 bits of security. As a result RSA, DSA
86           and DH keys shorter than 2048 bits and ECC keys shorter than 224
87           bits are prohibited.  In addition to the level 1 exclusions any
88           cipher suite using RC4 is also prohibited. SSL version 3 is also
89           not allowed. Compression is disabled.
90
91       Level 3
92           Security level set to 128 bits of security. As a result RSA, DSA
93           and DH keys shorter than 3072 bits and ECC keys shorter than 256
94           bits are prohibited.  In addition to the level 2 exclusions cipher
95           suites not offering forward secrecy are prohibited. TLS versions
96           below 1.1 are not permitted. Session tickets are disabled.
97
98       Level 4
99           Security level set to 192 bits of security. As a result RSA, DSA
100           and DH keys shorter than 7680 bits and ECC keys shorter than 384
101           bits are prohibited.  Cipher suites using SHA1 for the MAC are
102           prohibited. TLS versions below 1.2 are not permitted.
103
104       Level 5
105           Security level set to 256 bits of security. As a result RSA, DSA
106           and DH keys shorter than 15360 bits and ECC keys shorter than 512
107           bits are prohibited.
108

APPLICATION DEFINED SECURITY CALLBACKS

110       Documentation to be provided.
111

NOTES

113       The default security level can be configured when OpenSSL is compiled
114       by setting -DOPENSSL_TLS_SECURITY_LEVEL=level. If not set then 1 is
115       used.
116
117       The security framework disables or reject parameters inconsistent with
118       the set security level. In the past this was difficult as applications
119       had to set a number of distinct parameters (supported ciphers,
120       supported curves supported signature algorithms) to achieve this end
121       and some cases (DH parameter size for example) could not be checked at
122       all.
123
124       By setting an appropriate security level much of this complexity can be
125       avoided.
126
127       The bits of security limits affect all relevant parameters including
128       cipher suite encryption algorithms, supported ECC curves, supported
129       signature algorithms, DH parameter sizes, certificate key sizes and
130       signature algorithms. This limit applies no matter what other custom
131       settings an application has set: so if the cipher suite is set to ALL
132       then only cipher suites consistent with the security level are
133       permissible.
134
135       See SP800-57 for how the security limits are related to individual
136       algorithms.
137
138       Some security levels require large key sizes for non-ECC public key
139       algorithms which can severely degrade performance. For example 256 bits
140       of security requires the use of RSA keys of at least 15360 bits in
141       size.
142
143       Some restrictions can be gracefully handled: for example cipher suites
144       offering insufficient security are not sent by the client and will not
145       be selected by the server. Other restrictions such as the peer
146       certificate key size or the DH parameter size will abort the handshake
147       with a fatal alert.
148
149       Attempts to set certificates or parameters with insufficient security
150       are also blocked. For example trying to set a certificate using a 512
151       bit RSA key or a certificate with a signature with SHA1 digest at level
152       1 using SSL_CTX_use_certificate(). Applications which do not check the
153       return values for errors will misbehave: for example it might appear
154       that a certificate is not set at all because it had been rejected.
155

RETURN VALUES

157       SSL_CTX_set_security_level() and SSL_set_security_level() do not return
158       values.
159
160       SSL_CTX_get_security_level() and SSL_get_security_level() return a
161       integer that represents the security level with SSL_CTX or SSL,
162       respectively.
163
164       SSL_CTX_set_security_callback() and SSL_set_security_callback() do not
165       return values.
166
167       SSL_CTX_get_security_callback() and SSL_get_security_callback() return
168       the pointer to the security callback or NULL if the callback is not
169       set.
170
171       SSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() return
172       the extra data pointer or NULL if the ex data is not set.
173

SEE ALSO

175       ssl(7)
176

HISTORY

178       These functions were added in OpenSSL 1.1.0.
179
181       Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.
182
183       Licensed under the Apache License 2.0 (the "License").  You may not use
184       this file except in compliance with the License.  You can obtain a copy
185       in the file LICENSE in the source distribution or at
186       <https://www.openssl.org/source/license.html>.
187
188
189
1903.0.5                             2022-07-05 SSL_CTX_SET_SECURITY_LEVEL(3ossl)
Impressum