Verify certificates using OS trust stores
Project description
Truststore
Verify certificates using OS trust stores. Supports macOS, Windows, and Linux (with OpenSSL). This project should be considered experimental.
Usage
# The following code works on Linux, macOS, and Windows without dependencies.
import socket
import ssl
import truststore
# Create an SSLContext for the system trust store
ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
# Connect to the peer and initiate a TLS handshake
sock = socket.create_connection(("example.com", 443))
sock = ctx.wrap_socket(sock, server_hostname="example.com")
# Also works with libraries that accept an SSLContext object
import urllib3
http = urllib3.PoolManager(ssl_context=ctx)
http.request("GET", "https://example.com")
# Works with ssl.MemoryBIO objects for async I/O
import aiohttp
http = aiohttp.ClientSession()
await http.request("GET", "https://example.com", ssl=ctx)
Platforms
Works in the following configurations:
- macOS 10.8+ via Security framework
- Windows via CryptoAPI
- Linux via OpenSSL
Prior art
- The future of trust stores in Python (PyCon US 2022 lightning talk) (slides)
- Experimental APIs in Python 3.10 and the future of trust stores
- PEP 543: A Unified TLS API for Python
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
truststore-0.5.0.tar.gz
(12.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file truststore-0.5.0.tar.gz.
File metadata
- Download URL: truststore-0.5.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b85d151389b0363eb8f10ce5b66f76a92abe8f34ab7127cdc70b75846f34ce12
|
|
| MD5 |
7c4914062e0fcc429677dfeed0be1b25
|
|
| BLAKE2b-256 |
ad050c8e8e43ba1dedbf2bbb0a2703f3993578a4582fe3c90e05154d04f4fb80
|
File details
Details for the file truststore-0.5.0-py3-none-any.whl.
File metadata
- Download URL: truststore-0.5.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef51cb87968a853cb20fd670f351f5f36d4c09cc09ee4474537e229d6bd46f4f
|
|
| MD5 |
252a3b89ffc0ec4928861378193e50ab
|
|
| BLAKE2b-256 |
2e1fb50aa8ec1f48ed28ab4a59dc7495b79051dcb21f092fcf6b8eeb3759c005
|