Skip to content

Commit 607fab9

Browse files
committed
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.
1 parent 58e7da1 commit 607fab9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/python_testing/TC_DA_1_2.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,12 @@ async def test_TC_DA_1_2(self):
383383
if '.der' not in filename:
384384
continue
385385
with open(os.path.join(cd_cert_dir, filename), 'rb') as f:
386-
cert = x509.load_der_x509_certificate(f.read())
386+
logging.info(f'Parsing CD signing certificate file: {filename}')
387+
try:
388+
cert = x509.load_der_x509_certificate(f.read())
389+
except ValueError:
390+
logging.info(f'File is not a valid certificate, skipping')
391+
pass
387392
pub = cert.public_key()
388393
ski = x509.SubjectKeyIdentifier.from_public_key(pub).digest
389394
certs[ski] = pub

0 commit comments

Comments
 (0)