Skip to content

Commit

Permalink
Fix failure to parse DER encoded cert
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulder committed Mar 18, 2024
1 parent 91447ec commit a8f975c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cepces/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,17 @@ def _resolve_chain(self, data, child=None):
oid = x509.oid.AuthorityInformationAccessOID

# Load the certificate.
cert = x509.load_pem_x509_certificate(
data.encode(),
default_backend(),
)
try:
cert = x509.load_pem_x509_certificate(
data.encode(),
default_backend(),
)
except ValueError:
# The cert may be DER encoded instead
cert = x509.load_der_x509_certificate(
data.encode(),
default_backend(),
)

# If no child is present, this is the first cert and thus cannot be
# verified yet.
Expand Down

0 comments on commit a8f975c

Please sign in to comment.