Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TC-DA-1.2: Make the CD certificate dir configurable #28697

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/python_testing/TC_DA_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def parse_ids_from_certs(dac: x509.Certificate, pai: x509.Certificate) -> tuple(

return dac_vid, dac_pid, pai_vid, pai_pid

# To set the directory for the CD certificates use
# --string-arg cd_cert_dir:'your_directory_name'
# ex. --string-arg cd_cert_dir:'credentials/development/cd-certs'
# default is 'credentials/development/cd-certs'.


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

cd_cert_dir = self.user_params.get("cd_cert_dir", 'credentials/development/cd-certs')

self.print_step(0, "Commissioning, already done")

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

self.print_step("8.9", "Check signature")
signature_cd = bytes(signer_info['signature'])
# TODO: Cecille - this path needs to be set as an input
cert_dir = 'credentials/development/cd-certs'
certs = {}
for filename in os.listdir(cert_dir):
for filename in os.listdir(cd_cert_dir):
if '.der' not in filename:
continue
with open(os.path.join(cert_dir, filename), 'rb') as f:
with open(os.path.join(cd_cert_dir, filename), 'rb') as f:
cert = x509.load_der_x509_certificate(f.read())
pub = cert.public_key()
ski = x509.SubjectKeyIdentifier.from_public_key(pub).digest
Expand Down