Skip to content

Commit

Permalink
TC-DA-1.2: Better error messages
Browse files Browse the repository at this point in the history
Test: Added a bad der file in the cd-certs dir, saw failure on
      ToT, no failure with this fix.
  • Loading branch information
cecille committed Oct 4, 2024
1 parent 58e7da1 commit 607fab9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/python_testing/TC_DA_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,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 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 607fab9

Please sign in to comment.