Skip to content

Commit 1390966

Browse files
cecillerestyled-commits
authored andcommitted
TC-DA-1.2: Make the CD certificate dir configurable (#28697)
* Make the CD certificate dir configurable * Restyled by autopep8 --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 1f82b28 commit 1390966

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/python_testing/TC_DA_1_2.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def parse_ids_from_certs(dac: x509.Certificate, pai: x509.Certificate) -> tuple(
9696

9797
return dac_vid, dac_pid, pai_vid, pai_pid
9898

99+
# To set the directory for the CD certificates use
100+
# --string-arg cd_cert_dir:'your_directory_name'
101+
# ex. --string-arg cd_cert_dir:'credentials/development/cd-certs'
102+
# default is 'credentials/development/cd-certs'.
103+
99104

100105
class TC_DA_1_2(MatterBaseTest):
101106
@async_test_body
@@ -109,6 +114,8 @@ async def test_TC_DA_1_2(self):
109114
if pics_origin_pid != pics_origin_vid:
110115
asserts.fail("MCORE.DA.CERTDECL_ORIGIN_PRODUCTID and MCORE.DA.CERTDECL_ORIGIN_VENDORID PICS codes must match")
111116

117+
cd_cert_dir = self.user_params.get("cd_cert_dir", 'credentials/development/cd-certs')
118+
112119
self.print_step(0, "Commissioning, already done")
113120

114121
opcreds = Clusters.Objects.OperationalCredentials
@@ -319,13 +326,11 @@ async def test_TC_DA_1_2(self):
319326

320327
self.print_step("8.9", "Check signature")
321328
signature_cd = bytes(signer_info['signature'])
322-
# TODO: Cecille - this path needs to be set as an input
323-
cert_dir = 'credentials/development/cd-certs'
324329
certs = {}
325-
for filename in os.listdir(cert_dir):
330+
for filename in os.listdir(cd_cert_dir):
326331
if '.der' not in filename:
327332
continue
328-
with open(os.path.join(cert_dir, filename), 'rb') as f:
333+
with open(os.path.join(cd_cert_dir, filename), 'rb') as f:
329334
cert = x509.load_der_x509_certificate(f.read())
330335
pub = cert.public_key()
331336
ski = x509.SubjectKeyIdentifier.from_public_key(pub).digest

0 commit comments

Comments
 (0)