|
1 | 1 | ConnectionExportKeyingMaterial function |
2 | 2 | ====== |
3 | 3 |
|
4 | | -Exports keying material derived from the connection's TLS session, as described in [RFC 5705](https://www.rfc-editor.org/rfc/rfc5705) and [RFC 8446 Section 7.5](https://www.rfc-editor.org/rfc/rfc8446#section-7.5). The exported material is bound to the TLS session and can be used by the app for its own purposes (for example, to authenticate the peer at the application layer). |
| 4 | +Exports keying material derived from the connection's TLS session, as described in [RFC 5705](https://www.rfc-editor.org/rfc/rfc5705) and [RFC 8446 Section 7.5](https://www.rfc-editor.org/rfc/rfc8446#section-7.5). |
| 5 | +The exported material is bound to the TLS session and can be used by the app for its own purposes (for example, to authenticate the peer at the application layer). |
5 | 6 |
|
6 | | -> **Note** - This is a preview API and is only available when the library is built with `QUIC_API_ENABLE_PREVIEW_FEATURES`. It is available from v2.6. |
| 7 | +> **Note** - This API is in [preview](../PreviewFeatures.md). It should be considered unstable and can be subject to breaking changes. |
7 | 8 |
|
8 | 9 | # Syntax |
9 | 10 |
|
@@ -39,38 +40,24 @@ The function returns a [QUIC_STATUS](QUIC_STATUS.md). The app may use `QUIC_FAIL |
39 | 40 |
|
40 | 41 | The following errors are the most likely to be returned: |
41 | 42 |
|
42 | | -`QUIC_STATUS_SUCCESS` |
43 | | -
|
44 | | -The keying material was exported into `Output`. |
45 | | -
|
46 | | -`QUIC_STATUS_INVALID_PARAMETER` |
47 | | -
|
48 | | -`Config`, `Config->Label`, or `Output` is NULL; `Config->OutputLength` is 0; `Config->Context` is NULL while `Config->ContextLength` is non-zero; or `Connection` is not a connection handle. |
49 | | -
|
50 | | -`QUIC_STATUS_INVALID_STATE` |
51 | | -
|
52 | | -The connection's TLS context is no longer available. This happens if the handshake has not completed yet, or if it has already been released after handshake completion (see Remarks). |
53 | | -
|
54 | | -`QUIC_STATUS_NOT_SUPPORTED` |
55 | | -
|
56 | | -The underlying TLS provider does not support exporting keying material. This is the case in kernel mode. |
| 43 | +Value | Meaning |
| 44 | +--- | --- |
| 45 | +**QUIC_STATUS_SUCCESS** | The keying material was exported into `Output`. |
| 46 | +**QUIC_STATUS_INVALID_PARAMETER** | `Config`, `Config->Label`, or `Output` is NULL; `Config->OutputLength` is 0; `Config->Context` is NULL while `Config->ContextLength` is non-zero; or `Connection` is not a connection handle. |
| 47 | +**QUIC_STATUS_INVALID_STATE** | The connection's TLS context is no longer available. This happens if the handshake has not completed yet, or if it has already been released after handshake completion (see Remarks). |
| 48 | +**QUIC_STATUS_NOT_SUPPORTED** | The underlying TLS provider does not support exporting keying material. This is the case in kernel mode. |
57 | 49 |
|
58 | 50 | # Remarks |
59 | 51 |
|
60 | | -The keying material can only be exported while the connection's TLS context is alive. The context is created during the handshake and, when session resumption is disabled, is released shortly after the handshake completes (once the handshake `CRYPTO` data is fully acknowledged), mirroring the behavior of `QUIC_PARAM_TLS_HANDSHAKE_INFO`. |
61 | | -
|
62 | | -The guaranteed-safe window to call this API is inline while handling the `QUIC_CONNECTION_EVENT_CONNECTED` event. Calling it later may return `QUIC_STATUS_INVALID_STATE` if the context has already been released. |
63 | | -
|
64 | | -The call is blocking. When invoked from the connection's worker thread (for example, inline in a connection event callback) it executes synchronously; otherwise it is queued to the connection's worker and the calling thread blocks until the operation completes. |
| 52 | +The keying material can only be exported once the handshake is completed and while the connection's TLS context is alive. |
| 53 | +On a server, the TLS context is is released shortly after the handshake completes (unless resumption tickets are used) |
65 | 54 |
|
66 | | -Both peers of a connection derive identical keying material for the same `Label` and `Context`. Different labels or contexts produce independent, unrelated material. |
| 55 | +This API is best called inline while handling the `QUIC_CONNECTION_EVENT_CONNECTED` event to ensure the TLS context is still alive. |
| 56 | +Calling it later may return `QUIC_STATUS_INVALID_STATE` if the context has already been released. |
67 | 57 |
|
68 | | -This API is only supported by the user-mode TLS providers (Schannel and OpenSSL/quictls). In kernel mode it returns `QUIC_STATUS_NOT_SUPPORTED`. |
| 58 | +This API is not supported for Windows Kernel Mode, where it returns `QUIC_STATUS_NOT_SUPPORTED`. |
69 | 59 |
|
70 | 60 | # See Also |
71 | 61 |
|
72 | 62 | [QUIC_KEYING_MATERIAL_CONFIG](QUIC_KEYING_MATERIAL_CONFIG.md)<br> |
73 | | -[QUIC_CONNECTION_EVENT](QUIC_CONNECTION_EVENT.md)<br> |
74 | | -[ConnectionOpen](ConnectionOpen.md)<br> |
75 | | -[ConnectionStart](ConnectionStart.md)<br> |
76 | | -[ConnectionClose](ConnectionClose.md)<br> |
| 63 | +[QUIC_CONNECTION_EVENT](QUIC_CONNECTION_EVENT.md)<br> |
0 commit comments