Skip to content

Commit

Permalink
Merge pull request #38 from openSUSE/dmulder/bug1196658
Browse files Browse the repository at this point in the history
Fix failure to parse DER encoded cert
  • Loading branch information
dmulder authored Mar 18, 2024
2 parents 91447ec + a8f975c commit 91fe61c
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 91fe61c

Please sign in to comment.