Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

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.


Security Fix

wincertstore 0.1 used to return all certificates although some are not suitable to verify TLS/SSL server certificates. wincertstore 0.2 only returns certificates for SERVER_AUTH enhanced key usage by default.


import wincertstore
for storename in ("CA", "ROOT"):
    with wincertstore.CertSystemStore(storename) as store:
        for cert in store.itercerts(usage=wincertstore.SERVER_AUTH):

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)
        for cert in store.itercerts():

See CertOpenSystemStore

CertFile helper:

import wincertstore
import atexit
import ssl

certfile = wincertstore.CertFile()
atexit.register(certfile.close) # cleanup and remove files on shutdown)

ssl_sock = ssl.wrap_socket(sock,



Copyright (c) 2013, 2014 by Christian Heimes <>

Licensed to PSF under a Contributor Agreement.

See for licensing details.



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 for TLS tests.

wincertstore 0.1

Release date: 22-Mar-2013

  • Initial release

Release History

This version
History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(8.8 kB) Copy SHA256 Hash SHA256
Wheel 2.7 Feb 26, 2014
(15.0 kB) Copy SHA256 Hash SHA256
Source None Feb 26, 2014

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting