Skip to content

Commit 2e9f99d

Browse files
authored
Add examples
1 parent dbc1815 commit 2e9f99d

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

docs/api/QUIC_STATELESS_RETRY_CONFIG.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,42 @@ Where:
5454

5555
*Label* is the string "QUIC Stateless Retry Key" without the terminating NULL character.
5656

57-
*Context* is the UNIX epoch timestamp in milliseconds, divided by `RotationMs`, as an 8-byte signed integer in little-endian format.
57+
*Context* is the UNIX epoch timestamp in milliseconds, as an 8-byte signed integer in little-endian format, divided by `RotationMs`, rounded down.
5858

5959
*L* is the same as the key length for the `Algorithm`.
6060

61+
### Example 1 - AES-GCM 256
62+
63+
`Secret` is the following value: 0x3edc6b5b8f7aadbd713732b482b8f979286e1ea3b8f8f99c30c884cfe3349b83.
64+
65+
`SecretLength` is 32.
66+
67+
`RotationMs` is 30000.
68+
69+
`Algorithm` is **QUIC_AEAD_ALGORITHM_AES_256_GCM**.
70+
71+
The UNIX epoch timestamp is 1752112221.
72+
73+
Therefore, *Context* = timestamp / `RotationMs` = `1752112221 / 30000` = 58403.
74+
75+
The generated key should be the following value : 0x8135A3ACD2FB4B2B6D7CDD9C36ACB0A182F725F52C641F4A1F21AB53CD63F9B1.
76+
77+
### Example 2 - AES-GCM 128
78+
79+
`Secret` is the following value: 0x5ddd79f7b33f1f4a6dd57c34a8eec42e.
80+
81+
`SecretLength` is 16.
82+
83+
`RotationMs` is 30000.
84+
85+
`Algorithm` is **QUIC_AEAD_ALGORITHM_AES_128_GCM**.
86+
87+
The UNIX epoch timestamp is 1752112221.
88+
89+
Therefore, *Context* = timestamp / `RotationMs` = `1752112221 / 30000` = 58403.
90+
91+
The generated key should be the following value: 0x44B08A21DC20D6297328C6B356354502
92+
6193

6294
# See Also
6395

0 commit comments

Comments
 (0)