qh3-mutual-tls-patch 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qh3_mutual_tls_patch-0.1.0/LICENSE +21 -0
- qh3_mutual_tls_patch-0.1.0/PKG-INFO +96 -0
- qh3_mutual_tls_patch-0.1.0/README.md +73 -0
- qh3_mutual_tls_patch-0.1.0/pyproject.toml +35 -0
- qh3_mutual_tls_patch-0.1.0/qh3_mutual_tls_patch.egg-info/PKG-INFO +96 -0
- qh3_mutual_tls_patch-0.1.0/qh3_mutual_tls_patch.egg-info/SOURCES.txt +8 -0
- qh3_mutual_tls_patch-0.1.0/qh3_mutual_tls_patch.egg-info/dependency_links.txt +1 -0
- qh3_mutual_tls_patch-0.1.0/qh3_mutual_tls_patch.egg-info/requires.txt +1 -0
- qh3_mutual_tls_patch-0.1.0/qh3_mutual_tls_patch.egg-info/top_level.txt +1 -0
- qh3_mutual_tls_patch-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Davide Gessa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qh3_mutual_tls_patch
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Monkey-patch for qh3 to support mutual TLS (client certificate authentication)
|
|
5
|
+
Author: Davide Gessa
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/dakk/qh3_mutual_tls_patch
|
|
8
|
+
Keywords: quic,tls,mutual-tls,mtls,qh3,client-certificate
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
17
|
+
Classifier: Topic :: Security
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: qh3>=1.2.1
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# qh3_mutual_tls_patch
|
|
25
|
+
|
|
26
|
+
Runtime monkey-patch that adds **mutual TLS** (client certificate authentication) support to [qh3](https://github.com/jawah/qh3)'s server-side TLS 1.3 implementation.
|
|
27
|
+
|
|
28
|
+
## Problem
|
|
29
|
+
|
|
30
|
+
qh3's TLS 1.3 server does not send a `CertificateRequest` message during the handshake, so the client never presents its certificate. This makes it impossible to use mutual TLS authentication in QUIC servers built with qh3.
|
|
31
|
+
|
|
32
|
+
## Solution
|
|
33
|
+
|
|
34
|
+
This package patches qh3's `Context` class at runtime to:
|
|
35
|
+
|
|
36
|
+
1. Inject a `CertificateRequest` message into the server handshake (after `EncryptedExtensions`, before `Certificate`)
|
|
37
|
+
2. Handle the client's `Certificate`, `CertificateVerify`, and `Finished` messages
|
|
38
|
+
3. Verify the client's certificate signature using Ed25519
|
|
39
|
+
|
|
40
|
+
The patch is non-destructive: connections with `verify_mode = ssl.CERT_NONE` are unaffected.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install qh3_mutual_tls_patch
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or install from source:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
Call `apply()` once before creating any QUIC connections:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
import ssl
|
|
60
|
+
from qh3_mutual_tls_patch import apply
|
|
61
|
+
from qh3.quic.configuration import QuicConfiguration
|
|
62
|
+
|
|
63
|
+
# Apply the patch (safe to call multiple times)
|
|
64
|
+
apply()
|
|
65
|
+
|
|
66
|
+
# Now you can request client certificates on the server side
|
|
67
|
+
config = QuicConfiguration(is_client=False)
|
|
68
|
+
config.verify_mode = ssl.CERT_OPTIONAL # or ssl.CERT_REQUIRED
|
|
69
|
+
# ... set certificate, private_key, alpn_protocols, etc.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
After the handshake, the client's certificate is available via `context.get_peercert()`.
|
|
73
|
+
|
|
74
|
+
## How it works
|
|
75
|
+
|
|
76
|
+
The patch hooks three internal qh3 functions:
|
|
77
|
+
|
|
78
|
+
- **`push_encrypted_extensions`** — sets a flag after `EncryptedExtensions` is written
|
|
79
|
+
- **`push_message`** — intercepts the next `push_message` call (for the server `Certificate`) to inject `CertificateRequest` with its own transcript hash scope beforehand
|
|
80
|
+
- **`_server_handle_hello`** — wraps the original to restore the key-schedule hash after qh3's Finished-anticipation step, then transitions to custom states
|
|
81
|
+
|
|
82
|
+
Two custom TLS states (`SERVER_EXPECT_CLIENT_CERT` and `SERVER_EXPECT_CLIENT_CERT_VERIFY`) handle the client's response before handing control back to qh3's `SERVER_EXPECT_FINISHED` state.
|
|
83
|
+
|
|
84
|
+
## Compatibility
|
|
85
|
+
|
|
86
|
+
- **qh3** >= 1.2.1
|
|
87
|
+
- **Python** >= 3.10
|
|
88
|
+
|
|
89
|
+
## Limitations
|
|
90
|
+
|
|
91
|
+
- Only Ed25519 is advertised in the `CertificateRequest` signature algorithms extension.
|
|
92
|
+
- The patch relies on qh3 internals and may break with future qh3 releases.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# qh3_mutual_tls_patch
|
|
2
|
+
|
|
3
|
+
Runtime monkey-patch that adds **mutual TLS** (client certificate authentication) support to [qh3](https://github.com/jawah/qh3)'s server-side TLS 1.3 implementation.
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
qh3's TLS 1.3 server does not send a `CertificateRequest` message during the handshake, so the client never presents its certificate. This makes it impossible to use mutual TLS authentication in QUIC servers built with qh3.
|
|
8
|
+
|
|
9
|
+
## Solution
|
|
10
|
+
|
|
11
|
+
This package patches qh3's `Context` class at runtime to:
|
|
12
|
+
|
|
13
|
+
1. Inject a `CertificateRequest` message into the server handshake (after `EncryptedExtensions`, before `Certificate`)
|
|
14
|
+
2. Handle the client's `Certificate`, `CertificateVerify`, and `Finished` messages
|
|
15
|
+
3. Verify the client's certificate signature using Ed25519
|
|
16
|
+
|
|
17
|
+
The patch is non-destructive: connections with `verify_mode = ssl.CERT_NONE` are unaffected.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install qh3_mutual_tls_patch
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or install from source:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Call `apply()` once before creating any QUIC connections:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import ssl
|
|
37
|
+
from qh3_mutual_tls_patch import apply
|
|
38
|
+
from qh3.quic.configuration import QuicConfiguration
|
|
39
|
+
|
|
40
|
+
# Apply the patch (safe to call multiple times)
|
|
41
|
+
apply()
|
|
42
|
+
|
|
43
|
+
# Now you can request client certificates on the server side
|
|
44
|
+
config = QuicConfiguration(is_client=False)
|
|
45
|
+
config.verify_mode = ssl.CERT_OPTIONAL # or ssl.CERT_REQUIRED
|
|
46
|
+
# ... set certificate, private_key, alpn_protocols, etc.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
After the handshake, the client's certificate is available via `context.get_peercert()`.
|
|
50
|
+
|
|
51
|
+
## How it works
|
|
52
|
+
|
|
53
|
+
The patch hooks three internal qh3 functions:
|
|
54
|
+
|
|
55
|
+
- **`push_encrypted_extensions`** — sets a flag after `EncryptedExtensions` is written
|
|
56
|
+
- **`push_message`** — intercepts the next `push_message` call (for the server `Certificate`) to inject `CertificateRequest` with its own transcript hash scope beforehand
|
|
57
|
+
- **`_server_handle_hello`** — wraps the original to restore the key-schedule hash after qh3's Finished-anticipation step, then transitions to custom states
|
|
58
|
+
|
|
59
|
+
Two custom TLS states (`SERVER_EXPECT_CLIENT_CERT` and `SERVER_EXPECT_CLIENT_CERT_VERIFY`) handle the client's response before handing control back to qh3's `SERVER_EXPECT_FINISHED` state.
|
|
60
|
+
|
|
61
|
+
## Compatibility
|
|
62
|
+
|
|
63
|
+
- **qh3** >= 1.2.1
|
|
64
|
+
- **Python** >= 3.10
|
|
65
|
+
|
|
66
|
+
## Limitations
|
|
67
|
+
|
|
68
|
+
- Only Ed25519 is advertised in the `CertificateRequest` signature algorithms extension.
|
|
69
|
+
- The patch relies on qh3 internals and may break with future qh3 releases.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "qh3_mutual_tls_patch"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Monkey-patch for qh3 to support mutual TLS (client certificate authentication)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Davide Gessa" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["quic", "tls", "mutual-tls", "mtls", "qh3", "client-certificate"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
25
|
+
"Topic :: Security",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"qh3>=1.2.1",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/dakk/qh3_mutual_tls_patch"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
include = ["qh3_mutual_tls_patch*"]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qh3_mutual_tls_patch
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Monkey-patch for qh3 to support mutual TLS (client certificate authentication)
|
|
5
|
+
Author: Davide Gessa
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/dakk/qh3_mutual_tls_patch
|
|
8
|
+
Keywords: quic,tls,mutual-tls,mtls,qh3,client-certificate
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
17
|
+
Classifier: Topic :: Security
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: qh3>=1.2.1
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# qh3_mutual_tls_patch
|
|
25
|
+
|
|
26
|
+
Runtime monkey-patch that adds **mutual TLS** (client certificate authentication) support to [qh3](https://github.com/jawah/qh3)'s server-side TLS 1.3 implementation.
|
|
27
|
+
|
|
28
|
+
## Problem
|
|
29
|
+
|
|
30
|
+
qh3's TLS 1.3 server does not send a `CertificateRequest` message during the handshake, so the client never presents its certificate. This makes it impossible to use mutual TLS authentication in QUIC servers built with qh3.
|
|
31
|
+
|
|
32
|
+
## Solution
|
|
33
|
+
|
|
34
|
+
This package patches qh3's `Context` class at runtime to:
|
|
35
|
+
|
|
36
|
+
1. Inject a `CertificateRequest` message into the server handshake (after `EncryptedExtensions`, before `Certificate`)
|
|
37
|
+
2. Handle the client's `Certificate`, `CertificateVerify`, and `Finished` messages
|
|
38
|
+
3. Verify the client's certificate signature using Ed25519
|
|
39
|
+
|
|
40
|
+
The patch is non-destructive: connections with `verify_mode = ssl.CERT_NONE` are unaffected.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install qh3_mutual_tls_patch
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or install from source:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
Call `apply()` once before creating any QUIC connections:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
import ssl
|
|
60
|
+
from qh3_mutual_tls_patch import apply
|
|
61
|
+
from qh3.quic.configuration import QuicConfiguration
|
|
62
|
+
|
|
63
|
+
# Apply the patch (safe to call multiple times)
|
|
64
|
+
apply()
|
|
65
|
+
|
|
66
|
+
# Now you can request client certificates on the server side
|
|
67
|
+
config = QuicConfiguration(is_client=False)
|
|
68
|
+
config.verify_mode = ssl.CERT_OPTIONAL # or ssl.CERT_REQUIRED
|
|
69
|
+
# ... set certificate, private_key, alpn_protocols, etc.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
After the handshake, the client's certificate is available via `context.get_peercert()`.
|
|
73
|
+
|
|
74
|
+
## How it works
|
|
75
|
+
|
|
76
|
+
The patch hooks three internal qh3 functions:
|
|
77
|
+
|
|
78
|
+
- **`push_encrypted_extensions`** — sets a flag after `EncryptedExtensions` is written
|
|
79
|
+
- **`push_message`** — intercepts the next `push_message` call (for the server `Certificate`) to inject `CertificateRequest` with its own transcript hash scope beforehand
|
|
80
|
+
- **`_server_handle_hello`** — wraps the original to restore the key-schedule hash after qh3's Finished-anticipation step, then transitions to custom states
|
|
81
|
+
|
|
82
|
+
Two custom TLS states (`SERVER_EXPECT_CLIENT_CERT` and `SERVER_EXPECT_CLIENT_CERT_VERIFY`) handle the client's response before handing control back to qh3's `SERVER_EXPECT_FINISHED` state.
|
|
83
|
+
|
|
84
|
+
## Compatibility
|
|
85
|
+
|
|
86
|
+
- **qh3** >= 1.2.1
|
|
87
|
+
- **Python** >= 3.10
|
|
88
|
+
|
|
89
|
+
## Limitations
|
|
90
|
+
|
|
91
|
+
- Only Ed25519 is advertised in the `CertificateRequest` signature algorithms extension.
|
|
92
|
+
- The patch relies on qh3 internals and may break with future qh3 releases.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
qh3>=1.2.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|