0

I'm trying to use python to list the installed certificates installed in my machine. I'm using python 3.6.8. I'm using the code below. It works in Windows, but fails in CentOS:

import ssl
from cryptography import x509

for store in ["CA", "ROOT", "MY"]:
    for cert, encoding, trust in ssl.enum_certificates(store):
        certificate = x509.load_der_x509_certificate(cert, backend=None)
        print(certificate.issuer, certificate.not_valid_after)

The CentOS error is:

AttributeError: module 'ssl' has no attribute 'enum_certificates'

It is weird because the docs of ssl modules say that the enum_certificates method was added in version 3.4. It should be present.

How would I list the installed certificates?

1 Answer 1

1

The enum_certificates attribute in only available on Windows. In you link, just above where it says New in version 3.4. it says Availability: Windows.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.