Skip to content

Commit 91fe61c

Browse files
authored
Merge pull request #38 from openSUSE/dmulder/bug1196658
Fix failure to parse DER encoded cert
2 parents 91447ec + a8f975c commit 91fe61c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cepces/core.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,17 @@ def _resolve_chain(self, data, child=None):
282282
oid = x509.oid.AuthorityInformationAccessOID
283283

284284
# Load the certificate.
285-
cert = x509.load_pem_x509_certificate(
286-
data.encode(),
287-
default_backend(),
288-
)
285+
try:
286+
cert = x509.load_pem_x509_certificate(
287+
data.encode(),
288+
default_backend(),
289+
)
290+
except ValueError:
291+
# The cert may be DER encoded instead
292+
cert = x509.load_der_x509_certificate(
293+
data.encode(),
294+
default_backend(),
295+
)
289296

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

0 commit comments

Comments
 (0)