Skip to content

Commit

Permalink
Fix crypto._cert_fingerprint
Browse files Browse the repository at this point in the history
Ensure first parameter to load_pem_x509_certificate is always bytes
  • Loading branch information
zmousm authored May 19, 2024
1 parent 739191d commit f2e8c0e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/xmlsec/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit f2e8c0e

Please sign in to comment.