(self)
| 1621 | {'x509_ca': 1, 'crl': 0, 'x509': 2}) |
| 1622 | |
| 1623 | def test_get_ca_certs(self): |
| 1624 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 1625 | self.assertEqual(ctx.get_ca_certs(), []) |
| 1626 | # CERTFILE is not flagged as X509v3 Basic Constraints: CA:TRUE |
| 1627 | ctx.load_verify_locations(CERTFILE) |
| 1628 | self.assertEqual(ctx.get_ca_certs(), []) |
| 1629 | # but CAFILE_CACERT is a CA cert |
| 1630 | ctx.load_verify_locations(CAFILE_CACERT) |
| 1631 | self.assertEqual(ctx.get_ca_certs(), |
| 1632 | [{'issuer': ((('organizationName', 'Root CA'),), |
| 1633 | (('organizationalUnitName', 'http://www.cacert.org'),), |
| 1634 | (('commonName', 'CA Cert Signing Authority'),), |
| 1635 | (('emailAddress', 'support@cacert.org'),)), |
| 1636 | 'notAfter': 'Mar 29 12:29:49 2033 GMT', |
| 1637 | 'notBefore': 'Mar 30 12:29:49 2003 GMT', |
| 1638 | 'serialNumber': '00', |
| 1639 | 'crlDistributionPoints': ('https://www.cacert.org/revoke.crl',), |
| 1640 | 'subject': ((('organizationName', 'Root CA'),), |
| 1641 | (('organizationalUnitName', 'http://www.cacert.org'),), |
| 1642 | (('commonName', 'CA Cert Signing Authority'),), |
| 1643 | (('emailAddress', 'support@cacert.org'),)), |
| 1644 | 'version': 3}]) |
| 1645 | |
| 1646 | with open(CAFILE_CACERT) as f: |
| 1647 | pem = f.read() |
| 1648 | der = ssl.PEM_cert_to_DER_cert(pem) |
| 1649 | self.assertEqual(ctx.get_ca_certs(True), [der]) |
| 1650 | |
| 1651 | def test_load_default_certs(self): |
| 1652 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
nothing calls this directly
no test coverage detected