@@ -71,7 +71,7 @@ Script tool
71
71
call ` chip-cert ` to generate test certificates and verify certificates.
72
72
73
73
Please run below command to compile ` chip-cert ` tool under ` connnectedhomeip `
74
- repo.
74
+ repo for Linux platform .
75
75
76
76
``` shell
77
77
./scripts/build/build_examples.py --target linux-x64-chip-cert build
@@ -111,24 +111,47 @@ repo.
111
111
112
112
Please reference to ` --help ` for more detail.
113
113
114
- ## Generate with default test certificates
114
+ ## Generate with default configuration
115
115
116
- - Run following command to generate all plain text factory data
116
+ - Default setting uses the following parameters
117
+
118
+ - PAI certification:
119
+ [ test PAI certification] ( ../../../credentials/test/attestation/Chip-Test-PAI-FFF1-8000-Key.pem )
120
+
121
+ - Vendor ID for DAC: 0xFFF1; Vendor ID for CD: 0x130d
122
+
123
+ - Product ID for DAC: 0x8000, Product ID for CD: 0x1001
124
+
125
+ * Run following command to generate all plain text factory data
117
126
118
127
Please create output folder first. Here takes ` out/test-cert ` as example.
119
128
120
129
``` shell
121
130
./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert
122
131
```
123
132
124
- - Run following command to generate factory data which encrypt private of
133
+ - Check DAC certificate. Here takes ` out_130d_1001_106_dac_cert.pem` as
134
+ generated test certificate.
135
+
136
+ ` ` ` shell
137
+ openssl x509 -noout -text -in out/test-cert/out_130d_1001_106_dac_cert.pem
138
+ ` ` `
139
+
140
+ - Check Certification Declare. Here takes ` out_130d_1001_cd.der` as
141
+ generated test certificate.
142
+
143
+ ` ` ` shell
144
+ ./out/linux-x64-chip-cert/chip-cert print-cd out/test-cert/out_130d_1001_cd.der
145
+ ` ` `
146
+
147
+ * Run following command to generate factory data which encrypt private of
125
148
device attestation data
126
149
127
150
` ` ` shell
128
151
./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --key < hex string of 16 bytes>
129
152
` ` `
130
153
131
- > An example of hex string of 16 bytes: 12345678123456781234567812345678
154
+ > An example of hex string of 16 bytes: 12345678123456781234567812345678.
132
155
133
156
After command executes successfully, the output folder will has files as below:
134
157
@@ -153,20 +176,26 @@ After command executes successfully, the output folder will has files as below:
153
176
Self-defined PAA/PAI certificates may use in development and test scenario. But,
154
177
user should know it has limit to work with real ecosystem.
155
178
156
- - Export environment variables in terminal for easy operations
179
+ - Export environment variables in terminal for certificates generation
157
180
158
181
```
159
- export TEST_CERT_VENDOR_ID=130D # Vendor ID hex string
160
- export TEST_CERT_CN=BFLB # Common Name
182
+ export TEST_CERT_VENDOR_ID=130D # Vendor ID hex string
183
+ export TEST_CERT_PRODUCT_ID=1001 # Product ID hex string
184
+ export TEST_CERT_CN=BFLB # Common Name
161
185
```
162
186
163
187
- Generate PAA certificate and key to ` out/cert` folder.
164
188
165
189
` ` ` shell
166
- mkdir out/test-cert
167
190
./out/linux-x64-chip-cert/chip-cert gen-att-cert --type a --subject-cn " ${TEST_CERT_CN} PAA 01" --valid-from " 2020-10-15 14:23:43" --lifetime 7305 --out-key out/test-cert/Chip-PAA-Key-${TEST_CERT_VENDOR_ID} .pem --out out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID} .pem --subject-vid ${TEST_CERT_VENDOR_ID}
168
191
` ` `
169
192
193
+ - Check PAA certificate
194
+
195
+ ` ` ` shell
196
+ openssl x509 -noout -text -in out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID} .pem
197
+ ` ` `
198
+
170
199
- Convert PAA PEM format file to PAA DER format file
171
200
172
201
` ` ` shell
@@ -182,14 +211,84 @@ user should know it has limit to work with real ecosystem.
182
211
./out/linux-x64-chip-cert/chip-cert gen-att-cert --type i --subject-cn " ${TEST_CERT_CN} PAI 01" --subject-vid ${TEST_CERT_VENDOR_ID} --valid-from " 2020-10-15 14:23:43" --lifetime 7305 --ca-key out/test-cert/Chip-PAA-Key-${TEST_CERT_VENDOR_ID} .pem --ca-cert out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID} .pem --out-key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID} .pem --out out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID} .pem
183
212
` ` `
184
213
185
- - Generate ` MFD ` in plain text data
214
+ - Check PAI certificate
186
215
187
- ` ` ` shell
188
- ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --paa_cert out/test-cert/Chip-PAA-Cert- ${TEST_CERT_VENDOR_ID} .pem --paa_key out/test-cert/Chip-PAA-Key- ${TEST_CERT_VENDOR_ID} .pem --pai_cert out/test-cert/Chip-PAI-Cert- ${TEST_CERT_VENDOR_ID} .pem --pai_key out/test-cert/Chip-PAI-Key -${TEST_CERT_VENDOR_ID} .pem
189
- ` ` `
216
+ ` ` ` shell
217
+ openssl x509 -noout -text -in out/test-cert/Chip-PAI-Cert -${TEST_CERT_VENDOR_ID} .pem
218
+ ` ` `
190
219
191
- > Appending ` --key < hex string of 16 bytes> ` option to enable encrypt
192
- > private key of attestation device data.
220
+ - Generate ` MFD` in plain text data with same VID/PID in DAC and CD
221
+
222
+ - Use same environment variables ` TEST_CERT_VENDOR_ID` and
223
+ ` TEST_CERT_PRODUCT_ID` for CD.
224
+
225
+ ` ` ` shell
226
+ ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --paa_cert out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID} .pem --paa_key out/test-cert/Chip-PAA-Key-${TEST_CERT_VENDOR_ID} .pem --pai_cert out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID} .pem --pai_key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID} .pem --dac_pid 0x${TEST_CERT_PRODUCT_ID} --vendor_id 0x${TEST_CERT_VENDOR_ID} --product_id 0x${TEST_CERT_PRODUCT_ID}
227
+ ` ` `
228
+
229
+ > Appending ` --key < hex string of 16 bytes> ` option to enable encrypt
230
+ > private key of attestation device data.
231
+
232
+ - Check DAC certificate. Here takes ` out_130d_1001_1349_dac_cert.pem` as
233
+ generated test certification.
234
+
235
+ ` ` ` shell
236
+ openssl x509 -noout -text -in out/test-cert/out_130d_1001_1349_dac_cert.pem
237
+ ` ` `
238
+
239
+ - Check PAA/PAI/DAC certificate chain.
240
+
241
+ ` ` ` shell
242
+ ./out/linux-x64-chip-cert/chip-cert validate-att-cert --dac out/test-cert/out_130d_1001_1349_dac_cert.pem --pai out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID} .pem --paa out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID} .pem
243
+ ` ` `
244
+
245
+ - Check Certification Declare. Here takes ` out_130d_1001_cd.der` as
246
+ generated test certification.
247
+
248
+ ` ` ` shell
249
+ ./out/linux-x64-chip-cert/chip-cert print-cd out/test-cert/out_130d_1001_cd.der
250
+ ` ` `
251
+
252
+ - Generate ` MFD` in plain text data with different VID/PID in DAC and CD
253
+
254
+ - Export vendor ID and product ID for CD
255
+
256
+ ` ` ` shell
257
+ export TEST_CD_VENDOR_ID=730D # Vendor ID hex string
258
+ export TEST_CD_PRODUCT_ID=7001 # Product ID hex string
259
+ ` ` `
260
+
261
+ - Run script to generate DAC/CD and ` MFD` .
262
+
263
+ ` ` ` shell
264
+ ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --paa_cert out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID} .pem --paa_key out/test-cert/Chip-PAA-Key-${TEST_CERT_VENDOR_ID} .pem --pai_cert out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID} .pem --pai_key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID} .pem --dac_pid 0x${TEST_CERT_PRODUCT_ID} --vendor_id 0x${TEST_CD_VENDOR_ID} --product_id 0x${TEST_CD_PRODUCT_ID}
265
+ ` ` `
266
+
267
+ > Appending ` --key < hex string of 16 bytes> ` option to enable encrypt
268
+ > private key of attestation device data.
269
+ >
270
+ > Please use --` vendor_name` and ` --product_name` to change vendor name
271
+ > and product name.
272
+
273
+ - Check DAC certificate. Here takes ` out_130d_1001_1349_dac_cert.pem` as
274
+ generated test certification.
275
+
276
+ ` ` ` shell
277
+ openssl x509 -noout -text -in out/test-cert/out_130d_1001_1349_dac_cert.pem
278
+ ` ` `
279
+
280
+ - Check PAA/PAI/DAC certificate chain.
281
+
282
+ ` ` ` shell
283
+ ./out/linux-x64-chip-cert/chip-cert validate-att-cert --dac out/test-cert/out_130d_1001_1349_dac_cert.pem --pai out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID} .pem --paa out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID} .pem
284
+ ` ` `
285
+
286
+ - Check Certification Declare. Here takes ` out_730D_7001_cd.der` as
287
+ generated test certification.
288
+
289
+ ` ` ` shell
290
+ ./out/linux-x64-chip-cert/chip-cert print-cd out/test-cert/out_130d_1001_cd.der
291
+ ` ` `
193
292
194
293
# # Generate with self-defined DAC certificate and key
195
294
@@ -200,14 +299,14 @@ user should know it has limit to work with real ecosystem.
200
299
201
300
```
202
301
export TEST_CERT_VENDOR_ID=130D # Vendor ID hex string
203
- export TEST_CERT_PRODUCT_ID=1001 # Vendor ID hex string
302
+ export TEST_CERT_PRODUCT_ID=1001 # Product ID hex string
204
303
export TEST_CERT_CN=BFLB # Common Name
205
304
```
206
305
207
306
- Generate DAC certificate and key
208
307
209
308
` ` ` shell
210
- out/linux-x64-chip-cert/chip-cert gen-att-cert --type d --subject-cn " ${TEST_CERT_CN} PAI 01" --subject-vid ${TEST_CERT_VENDOR_ID} --subject-pid ${TEST_CERT_VENDOR_ID } --valid-from " 2020-10-16 14:23:43" --lifetime 5946 --ca-key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID} .pem --ca-cert out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID} .pem --out-key out/test-cert/Chip-DAC-Key-${TEST_CERT_VENDOR_ID} -${TEST_CERT_PRODUCT_ID} .pem --out out/test-cert/Chip-DAC-Cert-${TEST_CERT_VENDOR_ID} -${TEST_CERT_PRODUCT_ID} .pem
309
+ out/linux-x64-chip-cert/chip-cert gen-att-cert --type d --subject-cn " ${TEST_CERT_CN} PAI 01" --subject-vid ${TEST_CERT_VENDOR_ID} --subject-pid ${TEST_CERT_PRODUCT_ID } --valid-from " 2020-10-16 14:23:43" --lifetime 5946 --ca-key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID} .pem --ca-cert out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID} .pem --out-key out/test-cert/Chip-DAC-Key-${TEST_CERT_VENDOR_ID} -${TEST_CERT_PRODUCT_ID} .pem --out out/test-cert/Chip-DAC-Cert-${TEST_CERT_VENDOR_ID} -${TEST_CERT_PRODUCT_ID} .pem
211
310
` ` `
212
311
213
312
> ** Note** , ` --valid-from` and ` --lifetime` should be in ` --valid-from` and
@@ -238,12 +337,5 @@ key.
238
337
> If ` MFD` file has cipher text data, please append
239
338
> ` --key < hex string of 16 bytes> ` option to program to this key to efuse.
240
339
241
- - Limits on BL IOT SDK
242
-
243
- If developer would like to program ` MFD` with all plain text data, option
244
- ` --key < hex string of 16 bytes> ` needs pass to script, otherwise, flash tool
245
- will raise an error. And SoC BL602, BL702 and BL702L use BL IOT SDK for
246
- Matter Application.
247
-
248
340
Please free contact to ` Bouffalo Lab` for DAC provider service and higher
249
341
security solution, such as SoC inside certificate requesting.
0 commit comments