Skip to content

Commit ccaa990

Browse files
committed
[nrfconnect] Fix factory data script after certificate renaming
The development certificate names now include the vendor ID component. Also, fix a syntax error due to using "is not" for literals.
1 parent a13d2a0 commit ccaa990

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

config/nrfconnect/chip-module/generate_factory_data.cmake

+7-3
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,19 @@ endif()
6060

6161
# for development purpose user can use default certs instead of generating or providing them
6262
if(CONFIG_CHIP_FACTORY_DATA_USE_DEFAULT_CERTS)
63+
# convert decimal VID to its hexadecimal representation to find out certification files in repository
64+
math(EXPR LOCAL_VID "${CONFIG_CHIP_DEVICE_VENDOR_ID}" OUTPUT_FORMAT HEXADECIMAL)
65+
string(SUBSTRING ${LOCAL_VID} 2 -1 raw_vid)
66+
string(TOUPPER ${raw_vid} raw_vid_upper)
6367
# convert decimal PID to its hexadecimal representation to find out certification files in repository
6468
math(EXPR LOCAL_PID "${CONFIG_CHIP_DEVICE_PRODUCT_ID}" OUTPUT_FORMAT HEXADECIMAL)
6569
string(SUBSTRING ${LOCAL_PID} 2 -1 raw_pid)
6670
string(TOUPPER ${raw_pid} raw_pid_upper)
6771
# all certs are located in ${CHIP_ROOT}/credentials/development/attestation
6872
# it can be used during development without need to generate new certifications
69-
string(APPEND script_args "--dac_cert \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_pid_upper}-Cert.der\"\n")
70-
string(APPEND script_args "--dac_key \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_pid_upper}-Key.der\"\n")
71-
string(APPEND script_args "--pai_cert \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-PAI-noPID-Cert.der\"\n")
73+
string(APPEND script_args "--dac_cert \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_vid_upper}-${raw_pid_upper}-Cert.der\"\n")
74+
string(APPEND script_args "--dac_key \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_vid_upper}-${raw_pid_upper}-Key.der\"\n")
75+
string(APPEND script_args "--pai_cert \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-PAI-${raw_vid_upper}-noPID-Cert.der\"\n")
7276
elseif(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER)
7377
string(APPEND script_args "--dac_cert \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT}\"\n")
7478
string(APPEND script_args "--dac_key \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY}\"\n")

docs/guides/nrfconnect_factory_data_configuration.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ $ python scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py \
304304
--date "2022-02-02" \
305305
--hw_ver 1 \
306306
--hw_ver_str "prerelase" \
307-
--dac_cert "credentials/development/attestation/Matter-Development-DAC-8006-Cert.der" \
308-
--dac_key "credentials/development/attestation/Matter-Development-DAC-8006-Key.der" \
309-
--pai_cert "credentials/development/attestation/Matter-Development-PAI-noPID-Cert.der" \
307+
--dac_cert "credentials/development/attestation/Matter-Development-DAC-FFF1-8006-Cert.der" \
308+
--dac_key "credentials/development/attestation/Matter-Development-DAC-FFF1-8006-Key.der" \
309+
--pai_cert "credentials/development/attestation/Matter-Development-PAI-FFF1-noPID-Cert.der" \
310310
--spake2_it 1000 \
311311
--spake2_salt "U1BBS0UyUCBLZXkgU2FsdA==" \
312312
--discriminator 0xF00 \

scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def gen_test_certs(chip_cert_exe: str,
171171

172172
# convert to .der files
173173
for cert_k, cert_v in new_certificates.items():
174-
action_type = "convert-cert" if cert_k.find("CERT") is not -1 else "convert-key"
174+
action_type = "convert-cert" if cert_k.find("CERT") != -1 else "convert-key"
175175
log.info(cert_v + ".der")
176176
cmd = [chip_cert_exe, action_type,
177177
cert_v + ".pem",

0 commit comments

Comments
 (0)