(path)
| 13 | |
| 14 | |
| 15 | def load_certificate(path): |
| 16 | _, ext = os.path.splitext(path) |
| 17 | with open(path, "rb") as f: |
| 18 | if ext == ".pem": |
| 19 | return x509.load_pem_x509_certificate(f.read(), default_backend()) |
| 20 | else: |
| 21 | return x509.load_der_x509_certificate(f.read(), default_backend()) |
| 22 | |
| 23 | |
| 24 | def x509_from_der(data): |