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
import ssl
import truststore
sock = socket.create_connection(("example.com", 443))
ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
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.3.0.tar.gz
(11.0 kB
view hashes)
Built Distribution
truststore-0.3.0-py3-none-any.whl
(12.2 kB
view hashes)
Close
Hashes for truststore-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 366e9e15c53b1b343288792000e618e0ac5470d5c7a8d1b5ad5c347ace35d5da |
|
MD5 | b606e6387278e4d1d25d15bc0adaf79c |
|
BLAKE2b-256 | c84997e348d3385df67b500678c83569cb35fa8319074d485ac1ba130333f8ff |