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?