Skip to content

Commit

Permalink
TC-DA-1.2: Better error messages (project-chip#35916)
Browse files Browse the repository at this point in the history
* TC-DA-1.2: Better error messages

Test: Added a bad der file in the cd-certs dir, saw failure on
      ToT, no failure with this fix.

* whoops, forgot to add this change

* linter
  • Loading branch information
cecille authored Oct 15, 2024
1 parent fe500cf commit e7ff441
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/python_testing/TC_DA_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# quiet: true
# === END CI TEST ARGUMENTS ===

import logging
import os
import random
import re
Expand Down Expand Up @@ -391,7 +392,12 @@ async def test_TC_DA_1_2(self):
if '.der' not in filename:
continue
with open(os.path.join(cd_cert_dir, filename), 'rb') as f:
cert = x509.load_der_x509_certificate(f.read())
logging.info(f'Parsing CD signing certificate file: {filename}')
try:
cert = x509.load_der_x509_certificate(f.read())
except ValueError:
logging.info(f'File {filename} is not a valid certificate, skipping')
pass
pub = cert.public_key()
ski = x509.SubjectKeyIdentifier.from_public_key(pub).digest
certs[ski] = pub
Expand Down

0 comments on commit e7ff441

Please sign in to comment.