@@ -1188,23 +1188,6 @@ added: REPLACEME
11881188The ` QuicClientSession ` class implements the client side of a QUIC connection.
11891189Instances are created using the ` quicsocket.connect() ` method.
11901190
1191- #### Event: ` 'OCSPResponse' `
1192- <!-- YAML
1193- added: REPLACEME
1194- -->
1195-
1196- Emitted when the ` QuicClientSession ` receives a requested OCSP certificate
1197- status response from the QUIC server peer.
1198-
1199- The callback is invoked with a single argument:
1200-
1201- * ` response ` {Buffer}
1202-
1203- Node.js does not perform any automatic validation or processing of the
1204- response.
1205-
1206- The ` 'OCSPResponse' ` event will not be emitted more than once.
1207-
12081191#### Event: ` 'sessionTicket' `
12091192<!-- YAML
12101193added: REPLACEME
@@ -1313,24 +1296,6 @@ The callback is invoked with four arguments:
13131296
13141297The ` 'clientHello' ` event will not be emitted more than once.
13151298
1316- #### Event: ` 'OCSPRequest' `
1317- <!-- YAML
1318- added: REPLACEME
1319- -->
1320-
1321- Emitted when the ` QuicServerSession ` has received a OCSP certificate status
1322- request as part of the TLS handshake.
1323-
1324- The callback is invoked with three arguments:
1325-
1326- * ` servername ` {string}
1327- * ` context ` {tls.SecureContext}
1328- * ` callback ` {Function}
1329-
1330- The callback * must* be invoked in order for the TLS handshake to continue.
1331-
1332- The ` 'OCSPRequest' ` event will not be emitted more than once.
1333-
13341299#### ` quicserversession.addContext(servername\[, context\]) `
13351300<!-- YAML
13361301added: REPLACEME
@@ -1681,6 +1646,7 @@ added: REPLACEME
16811646 * ` qpackBlockedStreams ` {number}
16821647 * ` maxHeaderListSize ` {number}
16831648 * ` maxPushes ` {number}
1649+ * ` ocspHandler ` {Function} A function for handling [ OCSP responses] [ ] .
16841650 * ` passphrase ` {string} Shared passphrase used for a single private key and/or
16851651 a PFX.
16861652 * ` pfx ` {string|string[ ] |Buffer|Buffer[ ] |Object[ ] } PFX or PKCS12 encoded
@@ -1702,9 +1668,6 @@ added: REPLACEME
17021668 ` QuicClientSession ` object.
17031669 * ` qlog ` {boolean} Whether to enable [ 'qlog'] [ ] for this session.
17041670 Default: ` false ` .
1705- * ` requestOCSP ` {boolean} If ` true ` , specifies that the OCSP status request
1706- extension will be added to the client hello and an ` 'OCSPResponse' ` event
1707- will be emitted before establishing a secure communication.
17081671 * ` secureOptions ` {number} Optionally affect the OpenSSL protocol behavior,
17091672 which is not usually necessary. This should be used carefully if at all!
17101673 Value is a numeric bitmask of the ` SSL_OP_* ` options from
@@ -1852,6 +1815,7 @@ added: REPLACEME
18521815 * ` maxStreamDataBidiLocal ` {number}
18531816 * ` maxStreamDataBidiRemote ` {number}
18541817 * ` maxStreamDataUni ` {number}
1818+ * ` ocspHandler ` {Function} A function for handling [ OCSP requests] [ ] .
18551819 * ` passphrase ` {string} Shared passphrase used for a single private key
18561820 and/or a PFX.
18571821 * ` pfx ` {string|string[ ] |Buffer|Buffer[ ] |Object[ ] } PFX or PKCS12 encoded
@@ -2466,6 +2430,55 @@ async function myCustomLookup(address, type) {
24662430}
24672431```
24682432
2433+ ### Online Certificate Status Protocol (OCSP)
2434+
2435+ The QUIC implementation supports use of OCSP during the TLS 1.3 handshake
2436+ of a new QUIC session.
2437+
2438+ #### Requests
2439+
2440+ A ` QuicServerSession ` can receive and process OCSP requests by setting the
2441+ ` ocspHandler ` option in the ` quicsocket.listen() ` function. The value of
2442+ the ` ocspHandler ` is an async function that must return an object with the
2443+ OCSP response and, optionally, a new {tls.SecureContext} to use during the
2444+ handshake.
2445+
2446+ The handler function will be invoked with two arguments:
2447+
2448+ * ` type ` : {string} Will always be ` request ` for ` QuicServerSession ` .
2449+ * ` options ` : {Object}
2450+ * ` servername ` {string} The SNI server name.
2451+ * ` context ` {tls.SecureContext} The ` SecureContext ` currently used.
2452+
2453+ ``` js
2454+ async function ocspServerHandler (type , { servername, context }) {
2455+ // Process the request...
2456+ return { data: Buffer .from (' The OCSP response' ) };
2457+ }
2458+
2459+ sock .listen ({ ocspHandler: ocspServerHandler });
2460+ ```
2461+
2462+ #### Responses
2463+
2464+ A ` QuicClientSession ` can receive and process OCSP responses by setting the
2465+ ` ocspHandler ` option in the ` quicsocket.connect() ` function. The value of
2466+ the ` ocspHandler ` is an async function with no expected return value.
2467+
2468+ The handler function will be invoked with two arguments:
2469+
2470+ * ` type ` : {string} Will always be ` response ` for ` QuicClientSession ` .
2471+ * ` options ` : {Object}
2472+ * ` data ` : {Buffer} The OCSP response provided by the server
2473+
2474+ ``` js
2475+ async function ocspClientHandler (type , { data }) {
2476+ console .log (data .toString ());
2477+ }
2478+
2479+ sock .connect ({ ocspHandler: ocspClientHandler });
2480+ ```
2481+
24692482[ `crypto.getCurves()` ] : crypto.html#crypto_crypto_getcurves
24702483[ `stream.Readable` ] : #stream_class_stream_readable
24712484[ `tls.DEFAULT_ECDH_CURVE` ] : #tls_tls_default_ecdh_curve
@@ -2475,6 +2488,8 @@ async function myCustomLookup(address, type) {
24752488[ Certificate Object ] : https://nodejs.org/dist/latest-v12.x/docs/api/tls.html#tls_certificate_object
24762489[ custom DNS lookup function ] : #quic_custom_dns_lookup_functions
24772490[ modifying the default cipher suite ] : tls.html#tls_modifying_the_default_tls_cipher_suite
2491+ [ OCSP requests ] : #quic_online_certificate_status_protocol_ocsp
2492+ [ OCSP responses ] : #quic_online_certificate_status_protocol_ocsp
24782493[ OpenSSL Options ] : crypto.html#crypto_openssl_options
24792494[ Perfect Forward Secrecy ] : #tls_perfect_forward_secrecy
24802495[ promisified version of `lookup()` ] : dns.html#dns_dnspromises_lookup_hostname_options
0 commit comments