Method Name:
cert_store_stats
Method Signature:
cert_store_stats()
Parameters:
None
Return Value:
A Python dictionary representing the type of X.509 certificates, the Certificate Revocation Lists(CRL) loaded into the SSLContext vs their count.
Overview:
- The method cert_store_stats() returns a dictionary containing the statistics of loaded certificates and the the Certificate Revocation Lists(CRL) into an SSLContext instance.
- The key of the returned dictionary is a string representing the type of X.509 certificate or Certificate Revocation List and the value corresponding to the key is the count.
Example:
| # Example Python program that retrieves the statistics of # loaded X.509 certificates into the SSLContext import ssl import socket 
 # Create an SSLContext context = ssl.SSLContext(); 
 # Get the certificate statistics as a Python dictionary certStats = context.cert_store_stats(); print("Loaded certificates:"); print(certStats); 
 # Load the CA certificates context.load_verify_locations("./DemoCA.pem"); 
 # Load the X.509 certificate of the client context.load_cert_chain(certfile="./DemoClt.crt", keyfile="./DemoClt.key"); 
 # Get the updated certificate statistics as a Python dictionary certStats = context.cert_store_stats(); print("Loaded certificates(updated):"); print(certStats); | 
Output:
| Loaded certificates: {'x509': 0, 'crl': 0, 'x509_ca': 0} Loaded certificates(updated): {'x509': 1, 'crl': 0, 'x509_ca': 1} |