Skip to main content

Python module to extract CA and CRL certs from Windows' cert store (ctypes based).

Project description

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():
            print(cert.get_pem().decode("ascii")

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()

See CertOpenSystemStore

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

License

Copyright (c) 2013 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

http://bugs.python.org/issue17134

References

Changelog

wincertstore 0.1

Release date: 22-Mar-2013

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wincertstore-0.1.zip (8.9 kB view details)

Uploaded Source

File details

Details for the file wincertstore-0.1.zip.

File metadata

  • Download URL: wincertstore-0.1.zip
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wincertstore-0.1.zip
Algorithm Hash digest
SHA256 ea233947a5703f69e85ffdfde5c7996323cbb54455ca66250d073cc171977ad2
MD5 2f9accbebe8f7b4c06ac7aa83879b81c
BLAKE2b-256 34b8aaa315a46431ea670a5371294f1b5306e2fadaacdab0d85ea4bf7fdfccba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page