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 and macOS without other dependencies.
import socket
from truststore import TruststoreSSLContext
sock = socket.create_connection(("example.com", 443))
ctx = TruststoreSSLContext()
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")
import aiohttp
http = aiohttp.ClientSession()
await http.request("GET", "https://example.com", ssl=ctx)
Platforms
Works in the following configurations:
- macOS 10.8+ using Python 3.10+ (via Security framework)
- Windows using Python 3.10+ (via CryptoAPI)
- Linux using any Python version
Prior art
- PEP 543: A Unified TLS API for Python
- Experimental APIs in Python 3.10 and the future of trust stores
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.2.0.tar.gz
(11.0 kB
view hashes)
Built Distribution
truststore-0.2.0-py3-none-any.whl
(10.9 kB
view hashes)
Close
Hashes for truststore-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fba8cc8fcd2839b60fee5584833c3d82c0c4004b7d2342e120fb1a335cd5b263 |
|
MD5 | 49879337ef1ebbf2efd1fcf054dae2d1 |
|
BLAKE2b-256 | 1e9b43061eebbeedbafaeb02aa90e2f4fe73c259765d0da1a3ff2d25c72738a1 |