wincertstore
wincertstore provides an interface to access Windows’ CA and CRL certificates. It uses ctypes and Windows’s sytem cert store API through crypt32.dll.
Example
import wincertstore
for storename in ("CA", "ROOT"):
with wincertstore.CertSystemStore(storename) as store:
for cert in store.itercerts(usage=wincertstore.SERVER_AUTH):
print(cert.get_pem().decode("ascii"))
print(cert.get_name())
print(cert.enhanced_keyusage_names())
SERVER_AUTH is the default enhanced key usage. In order to get all certificates for any usage, use None. The module offers more OIDs like CLIENT_AUTH, too.
For Python versions without the with statement:
for storename in ("CA", "ROOT"):
store = wincertstore.CertSystemStore(storename)
try:
for cert in store.itercerts():
print(cert.get_pem().decode("ascii")
finally:
store.close()
CertFile helper:
import wincertstore
import atexit
import ssl
certfile = wincertstore.CertFile()
certfile.addstore("CA")
certfile.addstore("ROOT")
atexit.register(certfile.close) # cleanup and remove files on shutdown)
ssl_sock = ssl.wrap_socket(sock,
ca_certs=certfile.name,
cert_reqs=ssl.CERT_REQUIRED)
Requirements
Python 2.3 to 3.3
Windows XP, Windows Server 2003 or newer
ctypes 1.0.2 (Python 2.3 and 2.4) from http://sourceforge.net/projects/ctypes/
License
Copyright (c) 2013, 2014 by Christian Heimes <christian@python.org>
Licensed to PSF under a Contributor Agreement.
See http://www.python.org/psf/license for licensing details.
Acknowledgements
http://fixunix.com/openssl/254866-re-can-openssl-use-windows-certificate-store.html
References
ChangeLog
wincertstore 0.2
Release date: 26-Feb-2013
By default CertSystemStore.itercerts() is now limited to return only certs that are suitable for SERVER_AUTH – that is to validate a TLS/SSL’s server cert from the perspective of a client.
Add CERT_CONTEXT.get_name() to get a human readable name of a certificate.
Add CERT_CONTEXT.enhanced_keyusage() to get enhanced key usage and trust settings from registry. The method returns either True or a frozenset of OIDs. True means that the certificate is valid for any purpose.
CERT_CONTEXT.enhanced_keyusage_names() maps OIDs to human readable names.
Add commin OIDs for enhanced key usages like SERVER_AUTH and CLIENT_AUTH.
Add support for universal wheels.
Add tox for testing Python 2.6 to 3.3. Python 2.4 and 2.5 are tested manually.
Use pypi.python.org:443 for TLS tests.
wincertstore 0.1
Release date: 22-Mar-2013
Initial release
Metadata
Release files for wincertstore 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wincertstore-0.2.1.zip | 16.6 kB | Without provenance | Details for wincertstore-0.2.1.zip |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wincertstore-0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for wincertstore-0.2.1-py2.py3-none-any.whl |
Total release size: 24.5 kB
Release files / wincertstore-0.2.1.zip
| Download URL | wincertstore-0.2.1.zip |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebd681f45f4e156493b4fa54f134b9a171d9c0a8de40ae1a0bc96c3092cb8b12
|
|
BLAKE2b-256 checksum How to use checksums |
90717b01b7e37a73200bf52a81a2a9ea71b2d0492a5137258dd6034975c808e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / wincertstore-0.2.1-py2.py3-none-any.whl
| Download URL | wincertstore-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
cfedf0047855c3fd2668a4750e951329f68ecf6118b5814026c18f23f127dd93
|
|
BLAKE2b-256 checksum How to use checksums |
3d82d50da806a22161c74059e59319240c02422d92cede1cbf6c36d5035f9337
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Security for wincertstore 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.