(self, cert_path, cert=None)
| 72 | return None |
| 73 | |
| 74 | def __init__(self, cert_path, cert=None): |
| 75 | if cert_path is not None: |
| 76 | self.cert_path = cert_path |
| 77 | # load certificate and private key |
| 78 | if cert_path.startswith("http"): |
| 79 | cert_data = self.get_plain(cert_path, 1) |
| 80 | else: |
| 81 | cert_data = MDCertUtil._load_binary_file(cert_path) |
| 82 | |
| 83 | for file_type in (OpenSSL.crypto.FILETYPE_PEM, OpenSSL.crypto.FILETYPE_ASN1): |
| 84 | try: |
| 85 | self.cert = OpenSSL.crypto.load_certificate(file_type, cert_data) |
| 86 | except Exception as error: |
| 87 | self.error = error |
| 88 | if cert is not None: |
| 89 | self.cert = cert |
| 90 | |
| 91 | if self.cert is None: |
| 92 | raise self.error |
| 93 | |
| 94 | def get_issuer(self): |
| 95 | return self.cert.get_issuer() |
nothing calls this directly
no test coverage detected