| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -173,6 +173,8 @@ specifying a cipher suite with the `ciphers` option. The list of available | |||
| 173 | 173 | ciphers can be retrieved via `openssl ciphers -v 'PSK'`. All TLS 1.3 | |
| 174 | 174 | ciphers are eligible for PSK and can be retrieved via | |
| 175 | 175 | `openssl ciphers -v -s -tls1_3 -psk`. | |
| 176 | + On the client connection, a custom `checkServerIdentity` should be passed | ||
| 177 | + because the default one will fail in the absence of a certificate. | ||
| 176 | 178 | ||
| 177 | 179 | According to the [RFC 4279][], PSK identities up to 128 bytes in length and | |
| 178 | 180 | PSKs up to 64 bytes in length must be supported. As of OpenSSL 1.1.0 | |
@@ -181,6 +183,30 @@ maximum identity size is 128 bytes, and maximum PSK length is 256 bytes. | |||
| 181 | 183 | The current implementation doesn't support asynchronous PSK callbacks due to the | |
| 182 | 184 | limitations of the underlying OpenSSL API. | |
| 183 | 185 | ||
| 186 | + To use TLS-PSK, client and server must specify the `pskCallback` option, | ||
| 187 | + a function that returns the PSK to use (which must be compatible with | ||
| 188 | + the selected cipher's digest). | ||
| 189 | + | ||
| 190 | + It will be called first on the client: | ||
| 191 | + | ||
| 192 | + * hint: {string} optional message sent from the server to help the client | ||
| 193 | + decide which identity to use during negotiation. | ||
| 194 | + Always `null` if TLS 1.3 is used. | ||
| 195 | + * Returns: {Object} in the form | ||
| 196 | + `{ psk: <Buffer|TypedArray|DataView>, identity: <string> }` or `null`. | ||
| 197 | + | ||
| 198 | + Then on the server: | ||
| 199 | + | ||
| 200 | + * socket: {tls.TLSSocket} the server socket instance, equivalent to `this`. | ||
| 201 | + * identity: {string} identity parameter sent from the client. | ||
| 202 | + * Returns: {Buffer|TypedArray|DataView} the PSK (or `null`). | ||
| 203 | + | ||
| 204 | + A return value of `null` stops the negotiation process and sends an | ||
| 205 | + `unknown_psk_identity` alert message to the other party. | ||
| 206 | + If the server wishes to hide the fact that the PSK identity was not known, | ||
| 207 | + the callback must provide some random data as `psk` to make the connection | ||
| 208 | + fail with `decrypt_error` before negotiation is finished. | ||
| 209 | + | ||
| 184 | 210 | ### Client-initiated renegotiation attack mitigation | |
| 185 | 211 | ||
| 186 | 212 | <!-- type=misc --> | |
@@ -1646,25 +1672,7 @@ changes: | |||
| 1646 | 1672 | verified against the list of supplied CAs. An `'error'` event is emitted if | |
| 1647 | 1673 | verification fails; `err.code` contains the OpenSSL error code. **Default:** | |
| 1648 | 1674 | `true`. | |
| 1649 | - * `pskCallback` {Function} | ||
| 1650 | - | ||
| 1651 | - * hint: {string} optional message sent from the server to help client | ||
| 1652 | - decide which identity to use during negotiation. | ||
| 1653 | - Always `null` if TLS 1.3 is used. | ||
| 1654 | - * Returns: {Object} An object in the form | ||
| 1655 | - `{ psk: <Buffer|TypedArray|DataView>, identity: <string> }` | ||
| 1656 | - or `null` to stop the negotiation process. `psk` must be | ||
| 1657 | - compatible with the selected cipher's digest. | ||
| 1658 | - `identity` must use UTF-8 encoding. | ||
| 1659 | - | ||
| 1660 | - When negotiating TLS-PSK (pre-shared keys), this function is called | ||
| 1661 | - with optional identity `hint` provided by the server or `null` | ||
| 1662 | - in case of TLS 1.3 where `hint` was removed. | ||
| 1663 | - It will be necessary to provide a custom `tls.checkServerIdentity()` | ||
| 1664 | - for the connection as the default one will try to check host name/IP | ||
| 1665 | - of the server against the certificate but that's not applicable for PSK | ||
| 1666 | - because there won't be a certificate present. | ||
| 1667 | - More information can be found in the [RFC 4279][]. | ||
| 1675 | + * `pskCallback` {Function} For TLS-PSK negotiation, see [Pre-shared keys][]. | ||
| 1668 | 1676 | * `ALPNProtocols`: {string\[]|Buffer\[]|TypedArray\[]|DataView\[]|Buffer| | |
| 1669 | 1677 | TypedArray|DataView} | |
| 1670 | 1678 | An array of strings, `Buffer`s, `TypedArray`s, or `DataView`s, or a | |
@@ -2119,25 +2127,7 @@ changes: | |||
| 2119 | 2127 | default callback with high-level API will be used (see below). | |
| 2120 | 2128 | * `ticketKeys`: {Buffer} 48-bytes of cryptographically strong pseudorandom | |
| 2121 | 2129 | data. See [Session Resumption][] for more information. | |
| 2122 | - * `pskCallback` {Function} | ||
| 2123 | - | ||
| 2124 | - * socket: {tls.TLSSocket} the server [`tls.TLSSocket`][] instance for | ||
| 2125 | - this connection. | ||
| 2126 | - * identity: {string} identity parameter sent from the client. | ||
| 2127 | - * Returns: {Buffer|TypedArray|DataView} pre-shared key that must either be | ||
| 2128 | - a buffer or `null` to stop the negotiation process. Returned PSK must be | ||
| 2129 | - compatible with the selected cipher's digest. | ||
| 2130 | - | ||
| 2131 | - When negotiating TLS-PSK (pre-shared keys), this function is called | ||
| 2132 | - with the identity provided by the client. | ||
| 2133 | - If the return value is `null` the negotiation process will stop and an | ||
| 2134 | - "unknown\_psk\_identity" alert message will be sent to the other party. | ||
| 2135 | - If the server wishes to hide the fact that the PSK identity was not known, | ||
| 2136 | - the callback must provide some random data as `psk` to make the connection | ||
| 2137 | - fail with "decrypt\_error" before negotiation is finished. | ||
| 2138 | - PSK ciphers are disabled by default, and using TLS-PSK thus | ||
| 2139 | - requires explicitly specifying a cipher suite with the `ciphers` option. | ||
| 2140 | - More information can be found in the [RFC 4279][]. | ||
| 2130 | + * `pskCallback` {Function} For TLS-PSK negotiation, see [Pre-shared keys][]. | ||
| 2141 | 2131 | * `pskIdentityHint` {string} optional hint to send to a client to help | |
| 2142 | 2132 | with selecting the identity during TLS-PSK negotiation. Will be ignored | |
| 2143 | 2133 | in TLS 1.3. Upon failing to set pskIdentityHint `'tlsClientError'` will be | |
@@ -2286,6 +2276,7 @@ added: v19.8.0 | |||
| 2286 | 2276 | [Mozilla's publicly trusted list of CAs]: https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt | |
| 2287 | 2277 | [OCSP request]: https://en.wikipedia.org/wiki/OCSP_stapling | |
| 2288 | 2278 | [OpenSSL Options]: crypto.md#openssl-options | |
| 2279 | + [Pre-shared keys]: #pre-shared-keys | ||
| 2289 | 2280 | [RFC 2246]: https://www.ietf.org/rfc/rfc2246.txt | |
| 2290 | 2281 | [RFC 4086]: https://tools.ietf.org/html/rfc4086 | |
| 2291 | 2282 | [RFC 4279]: https://tools.ietf.org/html/rfc4279 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments