diff --git a/src/xmlsec/crypto.py b/src/xmlsec/crypto.py index 0e47c10..af3fd18 100644 --- a/src/xmlsec/crypto.py +++ b/src/xmlsec/crypto.py @@ -358,6 +358,8 @@ def _get_cert_by_fp(self, fp): def _cert_fingerprint(cert_pem): if "-----BEGIN CERTIFICATE" in cert_pem: + if isinstance(cert_pem, six.text_type): + cert_pem = cert_pem.encode() cert = load_pem_x509_certificate(cert_pem, backend=default_backend()) else: cert = load_der_x509_certificate(base64.standard_b64decode(cert_pem), backend=default_backend())