Repository navigation
v2.0.0
Added
- The
sslcontextcommand (extracli):listandshowkeystore
identities,probe URLto see a server's certificate request, the
candidates and the certificate sent. KeychainBackend(sslcontext.backends, namekeychain): identities in
the macOS Keychain and on smart cards, signed silently or, with
KEYSTORE_PROMPT, after macOS's own dialog.system_sources()uses it on
macOS.- On Python 3.9, where truststore is unavailable,
system_context()on macOS
trusts the Keychain's anchors (system roots, and those an administrator or
the user trusted) in addition to OpenSSL's default store. create_context()andsystem_context()takeca=,certificate=,
key=,password=andidentity=. Every certificate, key, CA and
bundle argument (includingload_pem()andload_pkcs12()) accepts PEM
text, PEM or DER bytes, a path, an object withopen()orread(), a
cryptographycertificate or private key, or a list of them.- Apple's
/usr/bin/python3(LibreSSL 2.8) is supported: keystore
identities sign through it over TLS 1.2, and client certificates are
chosen when the server asks. system_context(): a client context that behaves like the system's
browser: OS verification through truststore (a dependency on Python 3.10+) and
client certificates chosen when the server asks by a
ClientCertificateSelectoroversystem_sources()(the Windows
Personal store, the default PKCS#11 module elsewhere), filtered as a
browser filters (validity, client-authentication usage, key type, the
CAs the server names) and picked by remembered choice,AutoSelectRule
rules, the Edge/Chrome/ChromiumAutoSelectCertificateForUrlspolicy
(browser_policies()), achoosecallback or the only candidate.create_context()builds a verifyingssl.SSLContextfrom
verify/cafile/capath/cadata, TLS version bounds and ALPN.load_pem()andload_pkcs12()load a certificate, chain and key from
memory, with no temporary files.Identity, theSignerprotocol andload_identity(): a certificate whose
private key is used only through a signer, for every handshake signature
(RSA PKCS#1 v1.5 and PSS, ECDSA; TLS 1.2 and 1.3). OpenSSL 1.1.1 and 3.x.sslcontext.testing.SoftwareSignerandsoftware_identity().sslcontext.issuing:CertificateAuthority(create, or load from PEM;
optional X.509 name constraints; encrypted key export) issuing server
certificates (IssuedCertificate) that pass strict verification, made with
the interpreter's own OpenSSL.Identity.info(CertificateInfo: subject, issuer, serial, validity,
SHA-1/SHA-256 thumbprints, key type and size).sslcontext.backends: theBackendcontract with thumbprint, subject,
issuer, label and validity queries, a registry (names(),get(),
register_backend(), entry-point groupsslcontext.backends), and
CNGBackendfor Windows certificate stores: non-exportable, TPM and
smart-card keys through CNG, and legacy CryptoAPI CSP keys (PKCS#1 v1.5,
TLS 1.2).- PIN and password sources:
pin=on every backend takes a PIN,
KEYSTORE_PROMPT, or a callback receiving aPinRequest(backend, token,
certificate, purpose); with no PIN, an operation needing one fails at once
instead of showing a dialog or waiting on a PIN pad.load_pem(),
load_pkcs12()andSoftwareSigneraccept a password callable, called
only for an encrypted key. PKCS11Backendfor PKCS#11 tokens: smart cards (real and virtual, through
OpenSC), HSMs, TPMs and software tokens. RSA PKCS#1 v1.5 and PSS and
ECDSA, PINs from the PIN source (see below),
per-signature login forCKA_ALWAYS_AUTHENTICATEkeys, and recovery after
the card is removed and reinserted.SSLCONTEXT_PKCS11_MODULEselects the
default module.
Changed
- Rewritten from scratch.
sslcontextnow loads certificates and keystore-held
private keys into the standard library'sssl.SSLContext; nothing of the
1.x API (SSLContext/SSLSocketinterfaces,PyOpenSSLContext,
SSLContextProvider) remains. The 1.x companionssslcontext-factory,
openssl-engineandopenssl-engine-capiare superseded: OpenSSL 4 removed
the ENGINE API they were built on.
Full Changelog: https://github.com/jose-pr/sslcontext/commits/v2.0.0