1SSL_CTX_SET_TLSEXT_STATUS_CB(3ossl) OpenSSLSSL_CTX_SET_TLSEXT_STATUS_CB(3ossl)
2
3
4
6 SSL_CTX_set_tlsext_status_cb, SSL_CTX_get_tlsext_status_cb,
7 SSL_CTX_set_tlsext_status_arg, SSL_CTX_get_tlsext_status_arg,
8 SSL_CTX_set_tlsext_status_type, SSL_CTX_get_tlsext_status_type,
9 SSL_set_tlsext_status_type, SSL_get_tlsext_status_type,
10 SSL_get_tlsext_status_ocsp_resp, SSL_set_tlsext_status_ocsp_resp - OCSP
11 Certificate Status Request functions
12
14 #include <openssl/tls1.h>
15
16 long SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx, int (*callback)(SSL *, void *));
17 long SSL_CTX_get_tlsext_status_cb(SSL_CTX *ctx, int (**callback)(SSL *, void *));
18
19 long SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg);
20 long SSL_CTX_get_tlsext_status_arg(SSL_CTX *ctx, void **arg);
21
22 long SSL_CTX_set_tlsext_status_type(SSL_CTX *ctx, int type);
23 long SSL_CTX_get_tlsext_status_type(SSL_CTX *ctx);
24
25 long SSL_set_tlsext_status_type(SSL *s, int type);
26 long SSL_get_tlsext_status_type(SSL *s);
27
28 long SSL_get_tlsext_status_ocsp_resp(ssl, unsigned char **resp);
29 long SSL_set_tlsext_status_ocsp_resp(ssl, unsigned char *resp, int len);
30
32 A client application may request that a server send back an OCSP status
33 response (also known as OCSP stapling). To do so the client should call
34 the SSL_CTX_set_tlsext_status_type() function prior to the creation of
35 any SSL objects. Alternatively an application can call the
36 SSL_set_tlsext_status_type() function on an individual SSL object prior
37 to the start of the handshake. Currently the only supported type is
38 TLSEXT_STATUSTYPE_ocsp. This value should be passed in the type
39 argument. Calling SSL_CTX_get_tlsext_status_type() will return the type
40 TLSEXT_STATUSTYPE_ocsp previously set via
41 SSL_CTX_set_tlsext_status_type() or -1 if not set.
42
43 The client should additionally provide a callback function to decide
44 what to do with the returned OCSP response by calling
45 SSL_CTX_set_tlsext_status_cb(). The callback function should determine
46 whether the returned OCSP response is acceptable or not. The callback
47 will be passed as an argument the value previously set via a call to
48 SSL_CTX_set_tlsext_status_arg(). Note that the callback will not be
49 called in the event of a handshake where session resumption occurs
50 (because there are no Certificates exchanged in such a handshake). The
51 callback previously set via SSL_CTX_set_tlsext_status_cb() can be
52 retrieved by calling SSL_CTX_get_tlsext_status_cb(), and the argument
53 by calling SSL_CTX_get_tlsext_status_arg().
54
55 On the client side SSL_get_tlsext_status_type() can be used to
56 determine whether the client has previously called
57 SSL_set_tlsext_status_type(). It will return TLSEXT_STATUSTYPE_ocsp if
58 it has been called or -1 otherwise. On the server side
59 SSL_get_tlsext_status_type() can be used to determine whether the
60 client requested OCSP stapling. If the client requested it then this
61 function will return TLSEXT_STATUSTYPE_ocsp, or -1 otherwise.
62
63 The response returned by the server can be obtained via a call to
64 SSL_get_tlsext_status_ocsp_resp(). The value *resp will be updated to
65 point to the OCSP response data and the return value will be the length
66 of that data. Typically a callback would obtain an OCSP_RESPONSE
67 object from this data via a call to the d2i_OCSP_RESPONSE() function.
68 If the server has not provided any response data then *resp will be
69 NULL and the return value from SSL_get_tlsext_status_ocsp_resp() will
70 be -1.
71
72 A server application must also call the SSL_CTX_set_tlsext_status_cb()
73 function if it wants to be able to provide clients with OCSP
74 Certificate Status responses. Typically the server callback would
75 obtain the server certificate that is being sent back to the client via
76 a call to SSL_get_certificate(); obtain the OCSP response to be sent
77 back; and then set that response data by calling
78 SSL_set_tlsext_status_ocsp_resp(). A pointer to the response data
79 should be provided in the resp argument, and the length of that data
80 should be in the len argument.
81
83 The callback when used on the client side should return a negative
84 value on error; 0 if the response is not acceptable (in which case the
85 handshake will fail) or a positive value if it is acceptable.
86
87 The callback when used on the server side should return with either
88 SSL_TLSEXT_ERR_OK (meaning that the OCSP response that has been set
89 should be returned), SSL_TLSEXT_ERR_NOACK (meaning that an OCSP
90 response should not be returned) or SSL_TLSEXT_ERR_ALERT_FATAL (meaning
91 that a fatal error has occurred).
92
93 SSL_CTX_set_tlsext_status_cb(), SSL_CTX_set_tlsext_status_arg(),
94 SSL_CTX_set_tlsext_status_type(), SSL_set_tlsext_status_type() and
95 SSL_set_tlsext_status_ocsp_resp() return 0 on error or 1 on success.
96
97 SSL_CTX_get_tlsext_status_type() returns the value previously set by
98 SSL_CTX_set_tlsext_status_type(), or -1 if not set.
99
100 SSL_get_tlsext_status_ocsp_resp() returns the length of the OCSP
101 response data or -1 if there is no OCSP response data.
102
103 SSL_get_tlsext_status_type() returns TLSEXT_STATUSTYPE_ocsp on the
104 client side if SSL_set_tlsext_status_type() was previously called, or
105 on the server side if the client requested OCSP stapling. Otherwise -1
106 is returned.
107
109 ssl(7)
110
112 The SSL_get_tlsext_status_type(), SSL_CTX_get_tlsext_status_type() and
113 SSL_CTX_set_tlsext_status_type() functions were added in OpenSSL 1.1.0.
114
116 Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
117
118 Licensed under the Apache License 2.0 (the "License"). You may not use
119 this file except in compliance with the License. You can obtain a copy
120 in the file LICENSE in the source distribution or at
121 <https://www.openssl.org/source/license.html>.
122
123
124
1253.0.5 2022-07-05SSL_CTX_SET_TLSEXT_STATUS_CB(3ossl)