Skip to content

Commit 1232824

Browse files
vijspull[bot]
authored andcommitted
Implemented trust store and added official DCL trusted PAAs (#16125)
1 parent 268ce13 commit 1232824

35 files changed

+504
-35
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/python
2+
3+
#
4+
# Copyright (c) 2022 Project CHIP Authors
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
# Script that was used to fetch CHIP Development Product Attestation Authority (PAA)
20+
# certificates from DCL.
21+
# The script expects the path to the dcld tool binary as an input argument.
22+
#
23+
# Usage example when the script is run from the CHIP SDK root directory:
24+
# python ./credentials/development/fetch-development-paa-certs-from-dcl.py /path/to/dcld
25+
#
26+
# The result will be stored in:
27+
# credentials/development/paa-root-certs
28+
#
29+
30+
import os
31+
import sys
32+
import subprocess
33+
import copy
34+
import re
35+
from cryptography.hazmat.primitives import serialization
36+
from cryptography import x509
37+
38+
39+
def parse_paa_root_certs(cmdpipe, paa_list):
40+
"""
41+
example output of a query to all x509 root certs in DCL:
42+
43+
certs:
44+
- subject: CN=Non Production ONLY - XFN PAA Class 3
45+
subject_key_id: F8:99:A9:D5:AD:71:71:E4:C3:81:7F:14:10:7F:78:F0:D9:F7:62:E9
46+
- subject: CN=Matter Development PAA
47+
subject_key_id: FA:92:CF:9:5E:FA:42:E1:14:30:65:16:32:FE:FE:1B:2C:77:A7:C8
48+
- subject: CN=Matter PAA 1,O=Google,C=US,1.3.6.1.4.1.37244.2.1=#130436303036
49+
subject_key_id: B0:0:56:81:B8:88:62:89:62:80:E1:21:18:A1:A8:BE:9:DE:93:21
50+
- subject: CN=Matter Test PAA,1.3.6.1.4.1.37244.2.1=#130431323544
51+
subject_key_id: E2:90:8D:36:9C:3C:A3:C1:13:BB:9:E2:4D:C1:CC:C5:A6:66:91:D4
52+
53+
Brief:
54+
This method will search for the first line that contains ': ' char sequence.
55+
From there, it assumes every 2 lines contain subject and subject key id info of
56+
a valid PAA root certificate.
57+
The paa_list parameter will contain a list of all valid PAA Root certificates
58+
from DCL.
59+
"""
60+
61+
result = {}
62+
63+
while True:
64+
line = cmdpipe.stdout.readline()
65+
if not line:
66+
break
67+
else:
68+
if b': ' in line:
69+
key, value = line.split(b': ')
70+
result[key.strip(b' -')] = value.strip()
71+
parse_paa_root_certs.counter += 1
72+
if parse_paa_root_certs.counter % 2 == 0:
73+
paa_list.append(copy.deepcopy(result))
74+
75+
76+
def write_paa_root_cert(cmdpipe, subject):
77+
filename = 'paa-root-certs/dcld_mirror_' + \
78+
re.sub('[^a-zA-Z0-9_-]', '', re.sub('[=, ]', '_', subject))
79+
with open(filename + '.pem', 'wb+') as outfile:
80+
while True:
81+
line = cmdpipe.stdout.readline()
82+
if not line:
83+
break
84+
else:
85+
if b'pem_cert: |' in line:
86+
while True:
87+
line = cmdpipe.stdout.readline()
88+
outfile.write(line.strip(b' \t'))
89+
if b'-----END CERTIFICATE-----' in line:
90+
break
91+
# convert pem file to der
92+
with open(filename + '.pem', 'rb') as infile:
93+
pem_certificate = x509.load_pem_x509_certificate(infile.read())
94+
with open(filename + '.der', 'wb+') as outfile:
95+
der_certificate = pem_certificate.public_bytes(
96+
serialization.Encoding.DER)
97+
outfile.write(der_certificate)
98+
99+
100+
def main():
101+
if len(sys.argv) == 2:
102+
dcld = sys.argv[1]
103+
else:
104+
sys.exit(
105+
"Error: Please specify exactly one input argument; the path to the dcld tool binary")
106+
107+
previous_dir = os.getcwd()
108+
abspath = os.path.dirname(sys.argv[0])
109+
os.chdir(abspath)
110+
111+
os.makedirs('paa-root-certs', exist_ok=True)
112+
113+
cmdpipe = subprocess.Popen([dcld, 'query', 'pki', 'all-x509-root-certs'],
114+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
115+
116+
paa_list = []
117+
parse_paa_root_certs.counter = 0
118+
parse_paa_root_certs(cmdpipe, paa_list)
119+
120+
for paa in paa_list:
121+
cmdpipe = subprocess.Popen(
122+
[dcld, 'query', 'pki', 'x509-cert', '-u',
123+
paa[b'subject'].decode("utf-8"), '-k', paa[b'subject_key_id'].decode("utf-8")],
124+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
125+
write_paa_root_cert(cmdpipe, paa[b'subject'].decode("utf-8"))
126+
127+
os.chdir(previous_dir)
128+
129+
130+
if __name__ == "__main__":
131+
main()
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIBvTCCAWSgAwIBAgIITqjoMYLUHBwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP
3+
TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMTA2Mjgx
4+
NDIzNDNaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg
5+
UEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH
6+
A0IABLbLY3KIfyko9brIGqnZOuJDHK2p154kL2UXfvnO2TKijs0Duq9qj8oYShpQ
7+
NUKWDUU/MD8fGUIddR6Pjxqam3WjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD
8+
VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAfBgNV
9+
HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBQ
10+
qoAC9NkyqaAFOPZTaK0P/8jvu8m+t9pWmDXPmqdRDgIgI7rI/g8j51RFtlM5CBpH
11+
mUkpxyqvChVI1A0DTVFLJd4=
12+
-----END CERTIFICATE-----
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIBkTCCATegAwIBAgIHC4+6qN2G7jAKBggqhkjOPQQDAjAaMRgwFgYDVQQDDA9N
3+
YXR0ZXIgVGVzdCBQQUEwIBcNMjEwNjI4MTQyMzQzWhgPOTk5OTEyMzEyMzU5NTla
4+
MBoxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQTBZMBMGByqGSM49AgEGCCqGSM49
5+
AwEHA0IABBDvAqgah7aBIfuo0xl4+AejF+UKqKgoRGgokUuTPejt1KXDnJ/3Gkzj
6+
ZH/X9iZTt9JJX8ukwPR/h2iAA54HIEqjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEw
7+
DgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR4XOcFuGuPTm/Hk6pgy0PqaWiC1TAf
8+
BgNVHSMEGDAWgBR4XOcFuGuPTm/Hk6pgy0PqaWiC1TAKBggqhkjOPQQDAgNIADBF
9+
AiEAue/bPqBqUuwL8B5h2u0sLRVt22zwFBAdq3mPrAX6R+UCIGAGHT411g2dSw1E
10+
ja12EvfoXFguP8MS3Bh5TdNzcV5d
11+
-----END CERTIFICATE-----
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIBoDCCAUagAwIBAgIIV9Oi0B4xgZAwCgYIKoZIzj0EAwIwITEfMB0GA1UEAwwW
3+
TWF0dGVyIERldmVsb3BtZW50IFBBQTAgFw0yMTA2MjgxNDIzNDNaGA85OTk5MTIz
4+
MTIzNTk1OVowITEfMB0GA1UEAwwWTWF0dGVyIERldmVsb3BtZW50IFBBQTBZMBMG
5+
ByqGSM49AgEGCCqGSM49AwEHA0IABBsPJZQuPZKr1nBMGieBoDjsUyEsTatYsL48
6+
QL37SSMjQhx53MetcBgQBxINyG8KiSU9iZPrN6tlLvjbE3XlsUWjZjBkMBIGA1Ud
7+
EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBT6ks8JXvpC
8+
4RQwZRYy/v4bLHenyDAfBgNVHSMEGDAWgBT6ks8JXvpC4RQwZRYy/v4bLHenyDAK
9+
BggqhkjOPQQDAgNIADBFAiBQp5AzZLZT/w6kY9xoSobdJccxo57+s8IM0t7RtmB+
10+
LwIhAK/U7UtqmeX4xVIdcB68+f1TuTlP2A/FmZL/Plu7tgo1
11+
-----END CERTIFICATE-----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIB7TCCAZOgAwIBAgIBATAKBggqhkjOPQQDAjBLMQswCQYDVQQGEwJVUzEPMA0G
3+
A1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFBIDExFDASBgorBgEEAYKi
4+
fAIBDAQ2MDA2MCAXDTIxMTIwODIwMjYwM1oYDzIxMjExMjA4MjAyNjAzWjBLMQsw
5+
CQYDVQQGEwJVUzEPMA0GA1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFB
6+
IDExFDASBgorBgEEAYKifAIBDAQ2MDA2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD
7+
QgAE8iZX+exx8NDV7jYKorx3EcsD1gessexUTSimIfvFI2PySlReMjJDVCGIzXor
8+
hTYFOzwMAx4b6ogNMIUmcW7uT6NmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAOBgNV
9+
HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLAAVoG4iGKJYoDhIRihqL4J3pMhMB8GA1Ud
10+
IwQYMBaAFLAAVoG4iGKJYoDhIRihqL4J3pMhMAoGCCqGSM49BAMCA0gAMEUCIQCV
11+
c26cVlyqjhQfcgN3udpne6zZQdyVMNLRWZn3EENBkAIgasUeFU8zaUt8bKNWd0k+
12+
4RQp5Cp5wYzrE8AxJ9BiA/E=
13+
-----END CERTIFICATE-----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIByjCCAXCgAwIBAgIUFkdW6XaPDQDsJ3530eRkiOtYbWQwCgYIKoZIzj0EAwIw
3+
MDEuMCwGA1UEAwwlTm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3Mg
4+
MzAgFw0yMTEyMTQwMzI3MzZaGA8yMDUxMTIwNzAzMjczNlowMDEuMCwGA1UEAwwl
5+
Tm9uIFByb2R1Y3Rpb24gT05MWSAtIFhGTiBQQUEgQ2xhc3MgMzBZMBMGByqGSM49
6+
AgEGCCqGSM49AwEHA0IABB+Unq8KdMuQ6xWFKtAVGreDGzDlyLrpuSIZ86eMswgu
7+
4xvjijYN6iljia1HjxVTTRdieROa7mpoLD7qEUC5yjmjZjBkMBIGA1UdEwEB/wQI
8+
MAYBAf8CAQEwHwYDVR0jBBgwFoAU+Jmp1a1xceTDgX8UEH948Nn3YukwHQYDVR0O
9+
BBYEFPiZqdWtcXHkw4F/FBB/ePDZ92LpMA4GA1UdDwEB/wQEAwIBhjAKBggqhkjO
10+
PQQDAgNIADBFAiBYIsjeauI2nDknU1ThEDzyGfg4F9tLSkiuTrTJGr5EqQIhAMFX
11+
bxTzgOfx0RPgpEU8syFEYyXCBcv4hV14rWddc08G
12+
-----END CERTIFICATE-----

examples/chip-tool/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static_library("chip-tool-utils") {
7676
"${chip_root}/src/app/tests/suites/commands/system",
7777
"${chip_root}/src/app/tests/suites/pics",
7878
"${chip_root}/src/controller/data_model",
79+
"${chip_root}/src/credentials:file_attestation_trust_store",
7980
"${chip_root}/src/lib",
8081
"${chip_root}/src/platform",
8182
"${chip_root}/third_party/inipp",

examples/chip-tool/commands/common/CHIPCommand.cpp

+28-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include <controller/CHIPDeviceControllerFactory.h>
2222
#include <core/CHIPBuildConfig.h>
23+
#include <credentials/attestation_verifier/FileAttestationTrustStore.h>
2324
#include <lib/core/CHIPVendorIdentifiers.hpp>
2425
#include <lib/support/CodeUtils.h>
2526
#include <lib/support/ScopedBuffer.h>
@@ -36,6 +37,22 @@ constexpr chip::FabricId kIdentityAlphaFabricId = 1;
3637
constexpr chip::FabricId kIdentityBetaFabricId = 2;
3738
constexpr chip::FabricId kIdentityGammaFabricId = 3;
3839

40+
namespace {
41+
const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStore(const char * paaTrustStorePath)
42+
{
43+
static chip::Credentials::FileAttestationTrustStore attestationTrustStore{ paaTrustStorePath };
44+
45+
if (attestationTrustStore.IsInitialized())
46+
{
47+
return &attestationTrustStore;
48+
}
49+
else
50+
{
51+
return nullptr;
52+
}
53+
}
54+
} // namespace
55+
3956
CHIP_ERROR CHIPCommand::Run()
4057
{
4158
StartTracing();
@@ -58,8 +75,17 @@ CHIP_ERROR CHIPCommand::Run()
5875
factoryInitParams.listenPort = port;
5976
ReturnLogErrorOnFailure(DeviceControllerFactory::GetInstance().Init(factoryInitParams));
6077

61-
// TODO(issue #15209): Replace this trust store with file-based trust store
62-
const chip::Credentials::AttestationTrustStore * trustStore = chip::Credentials::GetTestAttestationTrustStore();
78+
const chip::Credentials::AttestationTrustStore * trustStore =
79+
GetTestFileAttestationTrustStore(mPaaTrustStorePath.HasValue() ? mPaaTrustStorePath.Value() : ".");
80+
if (trustStore == nullptr)
81+
{
82+
ChipLogError(chipTool, "No PAAs found in path: %s", mPaaTrustStorePath.HasValue() ? mPaaTrustStorePath.Value() : ".");
83+
ChipLogError(chipTool,
84+
"Please specify a valid path containing trusted PAA certificates using [--paa-trust-store-path paa/file/path] "
85+
"argument");
86+
87+
return CHIP_ERROR_INVALID_ARGUMENT;
88+
}
6389

6490
ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityNull, kIdentityNullFabricId, trustStore));
6591
ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityAlpha, kIdentityAlphaFabricId, trustStore));

scripts/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ click
5151
# scripts/idl
5252
lark
5353
stringcase
54+
55+
cryptography

scripts/tests/chiptest/test_definition.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from random import randrange
2525

2626
TEST_NODE_ID = '0x12344321'
27+
DEVELOPMENT_PAA_LIST = './credentials/development/paa-root-certs'
2728

2829

2930
class App:
@@ -240,11 +241,13 @@ def Run(self, runner, apps_register, paths: ApplicationPaths):
240241
app.start(str(randrange(1, 4096)))
241242

242243
runner.RunSubprocess(
243-
tool_cmd + ['pairing', 'qrcode', TEST_NODE_ID, app.setupCode],
244+
tool_cmd + ['pairing', 'qrcode', TEST_NODE_ID, app.setupCode] +
245+
['--paa-trust-store-path', DEVELOPMENT_PAA_LIST],
244246
name='PAIR', dependencies=[apps_register])
245247

246248
runner.RunSubprocess(
247-
tool_cmd + ['tests', self.run_name],
249+
tool_cmd + ['tests', self.run_name] +
250+
['--paa-trust-store-path', DEVELOPMENT_PAA_LIST],
248251
name='TEST', dependencies=[apps_register])
249252

250253
except Exception:

scripts/tests/run_python_test.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
DEFAULT_CHIP_ROOT = os.path.abspath(
3232
os.path.join(os.path.dirname(__file__), '..', '..'))
3333

34+
MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs"
35+
3436

3537
def EnqueueLogOutput(fp, tag, q):
3638
for line in iter(fp.readline, b''):
@@ -88,7 +90,7 @@ def main(app: str, factoryreset: bool, app_args: str, script: str, script_args:
8890
DumpProgramOutputToQueue(
8991
log_cooking_threads, "\33[34mAPP \33[0m", app_process, log_queue)
9092

91-
script_command = ["/usr/bin/env", "python3", script,
93+
script_command = ["/usr/bin/env", "python3", script, "--paa-trust-store-path", os.path.join(DEFAULT_CHIP_ROOT, MATTER_DEVELOPMENT_PAA_ROOT_CERTS),
9294
'--log-format', '%(message)s'] + shlex.split(script_args)
9395
logging.info(f"Execute: {script_command}")
9496
test_script_process = subprocess.Popen(

scripts/tools/check_includes_config.py

+3
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@
128128
'src/app/clusters/media-playback-server/media-playback-delegate.h': {'list'},
129129
'src/app/clusters/target-navigator-server/target-navigator-delegate.h': {'list'},
130130

131+
'src/credentials/attestation_verifier/FileAttestationTrustStore.h': {'vector'},
132+
'src/credentials/attestation_verifier/FileAttestationTrustStore.cpp': {'string'},
133+
131134
'src/setup_payload/AdditionalDataPayload.h': {'string'},
132135
'src/setup_payload/AdditionalDataPayloadParser.cpp': {'vector'},
133136
'src/setup_payload/Base38Decode.h': {'string', 'vector'},

src/controller/python/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ shared_library("ChipDeviceCtrl") {
9999
]
100100

101101
if (chip_controller) {
102-
public_deps += [ "${chip_root}/src/controller/data_model" ]
102+
public_deps += [
103+
"${chip_root}/src/controller/data_model",
104+
"${chip_root}/src/credentials:file_attestation_trust_store",
105+
]
103106
} else {
104107
public_deps += [ "$chip_data_model" ]
105108
}

src/controller/python/OpCredsBinding.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
3939
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h>
40+
#include <credentials/attestation_verifier/FileAttestationTrustStore.h>
4041

4142
using namespace chip;
4243

@@ -48,6 +49,15 @@ using Py_GenerateNOCChainFunc = void (*)(void * pyContext, const char *
4849
using Py_SetNodeIdForNextNOCRequest = void (*)(void * pyContext, NodeId nodeId);
4950
using Py_SetFabricIdForNextNOCRequest = void (*)(void * pyContext, FabricId fabricId);
5051

52+
namespace {
53+
const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStore(const char * paaTrustStorePath)
54+
{
55+
static chip::Credentials::FileAttestationTrustStore attestationTrustStore{ paaTrustStorePath };
56+
57+
return &attestationTrustStore;
58+
}
59+
} // namespace
60+
5161
namespace chip {
5262
namespace Controller {
5363
namespace Python {
@@ -129,7 +139,8 @@ void * pychip_OpCreds_InitializeDelegate(void * pyContext, uint32_t fabricCreden
129139

130140
ChipError::StorageType pychip_OpCreds_AllocateController(OpCredsContext * context,
131141
chip::Controller::DeviceCommissioner ** outDevCtrl, uint8_t fabricIndex,
132-
FabricId fabricId, chip::NodeId nodeId, bool useTestCommissioner)
142+
FabricId fabricId, chip::NodeId nodeId, const char * paaTrustStorePath,
143+
bool useTestCommissioner)
133144
{
134145
ChipLogDetail(Controller, "Creating New Device Controller");
135146

@@ -139,8 +150,8 @@ ChipError::StorageType pychip_OpCreds_AllocateController(OpCredsContext * contex
139150
VerifyOrReturnError(devCtrl != nullptr, CHIP_ERROR_NO_MEMORY.AsInteger());
140151

141152
// Initialize device attestation verifier
142-
// TODO: Replace testingRootStore with a AttestationTrustStore that has the necessary official PAA roots available
143-
const chip::Credentials::AttestationTrustStore * testingRootStore = chip::Credentials::GetTestAttestationTrustStore();
153+
const chip::Credentials::AttestationTrustStore * testingRootStore = GetTestFileAttestationTrustStore(
154+
paaTrustStorePath == nullptr ? "./credentials/development/paa-root-certs" : paaTrustStorePath);
144155
SetDeviceAttestationVerifier(GetDefaultDACVerifier(testingRootStore));
145156

146157
chip::Crypto::P256Keypair ephemeralKey;

src/controller/python/chip-device-ctrl.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ def __init__(self, rendezvousAddr=None, controllerNodeId=1, bluetoothAdapter=Non
182182
self.chipStack = ChipStack.ChipStack(
183183
bluetoothAdapter=bluetoothAdapter, persistentStoragePath='/tmp/chip-device-ctrl-storage.json')
184184
self.fabricAdmin = FabricAdmin.FabricAdmin()
185-
self.devCtrl = self.fabricAdmin.NewController(controllerNodeId, True)
185+
self.devCtrl = self.fabricAdmin.NewController(
186+
nodeId=controllerNodeId, useTestCommissioner=True)
186187

187188
self.commissionableNodeCtrl = ChipCommissionableNodeCtrl.ChipCommissionableNodeController(
188189
self.chipStack)

src/controller/python/chip/ChipDeviceCtrl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class DCState(enum.IntEnum):
8484
class ChipDeviceController():
8585
activeList = set()
8686

87-
def __init__(self, opCredsContext: ctypes.c_void_p, fabricId: int, fabricIndex: int, nodeId: int, useTestCommissioner: bool = False):
87+
def __init__(self, opCredsContext: ctypes.c_void_p, fabricId: int, fabricIndex: int, nodeId: int, paaTrustStorePath: str = "", useTestCommissioner: bool = False):
8888
self.state = DCState.NOT_INITIALIZED
8989
self.devCtrl = None
9090
self._ChipStack = builtins.chipStack
@@ -96,7 +96,7 @@ def __init__(self, opCredsContext: ctypes.c_void_p, fabricId: int, fabricIndex:
9696

9797
res = self._ChipStack.Call(
9898
lambda: self._dmLib.pychip_OpCreds_AllocateController(ctypes.c_void_p(
99-
opCredsContext), pointer(devCtrl), fabricIndex, fabricId, nodeId, useTestCommissioner)
99+
opCredsContext), pointer(devCtrl), fabricIndex, fabricId, nodeId, ctypes.c_char_p(None if len(paaTrustStorePath) is 0 else str.encode(paaTrustStorePath)), useTestCommissioner)
100100
)
101101

102102
if res != 0:

0 commit comments

Comments
 (0)