1SSL_CTX_SET_SECURITY_LEVEL(3)       OpenSSL      SSL_CTX_SET_SECURITY_LEVEL(3)
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.
82
83       Level 2
84           Security level set to 112 bits of security with the exception of
85           SHA1 allowed for signatures.  As a result RSA, DSA and DH keys
86           shorter than 2048 bits and ECC keys shorter than 224 bits are
87           prohibited.  In addition to the level 1 exclusions any cipher suite
88           using RC4 is also prohibited. SSL version 3 is also not allowed.
89           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       WARNING at this time setting the security level higher than 1 for
114       general internet use is likely to cause considerable interoperability
115       issues and is not recommended. This is because the SHA1 algorithm is
116       very widely used in certificates and will be rejected at levels higher
117       than 1 because it only offers 80 bits of security.
118
119       The default security level can be configured when OpenSSL is compiled
120       by setting -DOPENSSL_TLS_SECURITY_LEVEL=level. If not set then 1 is
121       used.
122
123       The security framework disables or reject parameters inconsistent with
124       the set security level. In the past this was difficult as applications
125       had to set a number of distinct parameters (supported ciphers,
126       supported curves supported signature algorithms) to achieve this end
127       and some cases (DH parameter size for example) could not be checked at
128       all.
129
130       By setting an appropriate security level much of this complexity can be
131       avoided.
132
133       The bits of security limits affect all relevant parameters including
134       cipher suite encryption algorithms, supported ECC curves, supported
135       signature algorithms, DH parameter sizes, certificate key sizes and
136       signature algorithms. This limit applies no matter what other custom
137       settings an application has set: so if the cipher suite is set to ALL
138       then only cipher suites consistent with the security level are
139       permissible.
140
141       See SP800-57 for how the security limits are related to individual
142       algorithms.
143
144       Some security levels require large key sizes for non-ECC public key
145       algorithms which can severely degrade performance. For example 256 bits
146       of security requires the use of RSA keys of at least 15360 bits in
147       size.
148
149       Some restrictions can be gracefully handled: for example cipher suites
150       offering insufficient security are not sent by the client and will not
151       be selected by the server. Other restrictions such as the peer
152       certificate key size or the DH parameter size will abort the handshake
153       with a fatal alert.
154
155       Attempts to set certificates or parameters with insufficient security
156       are also blocked. For example trying to set a certificate using a 512
157       bit RSA key using SSL_CTX_use_certificate() at level 1. Applications
158       which do not check the return values for errors will misbehave: for
159       example it might appear that a certificate is not set at all because it
160       had been rejected.
161

RETURN VALUES

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

HISTORY

181       These functions were added in OpenSSL 1.1.0.
182
184       Copyright 2014-2018 The OpenSSL Project Authors. All Rights Reserved.
185
186       Licensed under the OpenSSL license (the "License").  You may not use
187       this file except in compliance with the License.  You can obtain a copy
188       in the file LICENSE in the source distribution or at
189       <https://www.openssl.org/source/license.html>.
190
191
192
1931.1.1d                            2019-10-03     SSL_CTX_SET_SECURITY_LEVEL(3)
Impressum