@@ -5,13 +5,19 @@ root_cert_1_path="integration_tests/constants/noc_root_cert_1"
5
5
root_cert_subject=" MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMQ=="
6
6
root_cert_subject_key_id=" 44:EB:4C:62:6B:25:48:CD:A2:B3:1C:87:41:5A:08:E7:2B:B9:83:26"
7
7
root_cert_1_serial_number=" 47211865327720222621302679792296833381734533449"
8
+
9
+ root_cert_1_copy_path=" integration_tests/constants/noc_root_cert_1_copy"
10
+ root_cert_1_copy_serial_number=" 460647353168152946606945669687905527879095841977"
11
+
8
12
root_cert_vid=65521
13
+
9
14
intermediate_cert_1_path=" integration_tests/constants/noc_cert_1"
10
15
intermediate_cert_2_path=" integration_tests/constants/noc_cert_1_copy"
11
16
intermediate_cert_subject=" MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMQ=="
12
17
intermediate_cert_subject_key_id=" 02:72:6E:BC:BB:EF:D6:BD:8D:9B:42:AE:D4:3C:C0:55:5F:66:3A:B3"
13
18
intermediate_cert_1_serial_number=" 631388393741945881054190991612463928825155142122"
14
19
intermediate_cert_2_serial_number=" 169445068204646961882009388640343665944683778293"
20
+
15
21
leaf_cert_path=" integration_tests/constants/noc_leaf_cert_1"
16
22
leaf_cert_subject=" MIGBMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRMwEQYDVQQDDApOT0MtbGVhZi0x"
17
23
leaf_cert_subject_key_id=" 77:1F:DB:C4:4C:B1:29:7E:3C:EB:3E:D8:2A:38:0B:63:06:07:00:01"
@@ -21,7 +27,7 @@ trustee_account="jack"
21
27
22
28
test_divider
23
29
24
- echo " REMOVE NOC ICA CERTIFICATES"
30
+ echo " REMOVING the NOC and ICA CERTIFICATES"
25
31
26
32
vendor_account_65521=vendor_account_$root_cert_vid
27
33
echo " Create Vendor account - $vendor_account_65521 "
@@ -206,4 +212,105 @@ response_does_not_contain "$result" "\"serialNumber\": \"$intermediate_cert_1_se
206
212
response_does_not_contain " $result " " \" serialNumber\" : \" $intermediate_cert_2_serial_number \" "
207
213
response_does_not_contain " $result " " \" serialNumber\" : \" $leaf_cert_serial_number "
208
214
215
+ echo " Add second NOC root certificate"
216
+ result=$( echo " $passphrase " | dcld tx pki add-noc-x509-root-cert --certificate=" $root_cert_1_copy_path " --from $vendor_account_65521 --yes)
217
+ result=$( get_txn_result " $result " )
218
+ check_response " $result " " \" code\" : 0"
219
+
220
+ echo " Re-add an ICA certificate"
221
+ result=$( echo " $passphrase " | dcld tx pki add-noc-x509-ica-cert --certificate=" $intermediate_cert_1_path " --from $vendor_account_65521 --yes)
222
+ result=$( get_txn_result " $result " )
223
+ check_response " $result " " \" code\" : 0"
224
+
225
+ echo " Check that root cert is added. Request all approved certificates."
226
+ result=$( dcld query pki all-x509-certs)
227
+ echo $result | jq
228
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_serial_number \" "
229
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number \" "
230
+
231
+ echo " Try to remove NOC root certificate with invalid serialNumber"
232
+ result=$( echo " $passphrase " | dcld tx pki remove-noc-x509-root-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " --serial-number=" invalid" --from=$vendor_account_65521 --yes)
233
+ result=$( get_txn_result " $result " )
234
+ check_response " $result " " \" code\" : 404"
235
+
236
+ echo " Try to remove NOC root certificate when sender is not Vendor account"
237
+ result=$( echo " $passphrase " | dcld tx pki remove-noc-x509-root-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " --serial-number=" $root_cert_1_serial_number " --from=$trustee_account --yes)
238
+ result=$( get_txn_result " $result " )
239
+ check_response " $result " " \" code\" : 4"
240
+
241
+ echo " Try to remove NOC root certificate using a vendor account with other VID"
242
+ result=$( echo " $passphrase " | dcld tx pki remove-noc-x509-root-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " --serial-number=" $root_cert_1_serial_number " --from=$vendor_account_65522 --yes)
243
+ result=$( get_txn_result " $result " )
244
+ check_response " $result " " \" code\" : 4"
245
+
246
+ echo " Revoke NOC root certificate with serialNumber $root_cert_1_serial_number "
247
+ result=$( echo " $passphrase " | dcld tx pki revoke-noc-x509-root-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " --serial-number=" $root_cert_1_serial_number " --from=$vendor_account_65521 --yes)
248
+ result=$( get_txn_result " $result " )
249
+ check_response " $result " " \" code\" : 0"
250
+
251
+ echo " Request all revoked certificates should contain NOC root certificate with serialNumber $root_cert_1_serial_number "
252
+ result=$( dcld query pki all-revoked-x509-certs)
253
+ echo $result | jq
254
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_serial_number \" "
255
+
256
+ echo " Remove NOC root certificate with serialNumber $root_cert_1_serial_number "
257
+ result=$( echo " $passphrase " | dcld tx pki remove-noc-x509-root-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " --serial-number=" $root_cert_1_serial_number " --from=$vendor_account_65521 --yes)
258
+ result=$( get_txn_result " $result " )
259
+ check_response " $result " " \" code\" : 0"
260
+
261
+ echo " Request all certificates should contain only one NOC root certificate"
262
+ result=$( dcld query pki all-x509-certs)
263
+ echo $result | jq
264
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number \" "
265
+ check_response " $result " " \" serialNumber\" : \" $intermediate_cert_1_serial_number \" "
266
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_serial_number \" "
267
+
268
+ echo " Request NOC certificates by VID should contain one NOC root certificate"
269
+ result=$( dcld query pki noc-x509-root-certs --vid=" $root_cert_vid " )
270
+ echo $result | jq
271
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number \" "
272
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_serial_number \" "
273
+
274
+ echo " Request approved certificates by NOC root's subject and subjectKeyId should contain only one root certificate"
275
+ result=$( dcld query pki x509-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " )
276
+ echo $result | jq
277
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number \" "
278
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_serial_number \" "
279
+
280
+ echo " Re-add NOC root certificate"
281
+ result=$( echo " $passphrase " | dcld tx pki add-noc-x509-root-cert --certificate=" $root_cert_1_path " --from $vendor_account_65521 --yes)
282
+ result=$( get_txn_result " $result " )
283
+ check_response " $result " " \" code\" : 0"
284
+
285
+ echo " Check that root cert is added. Request all approved certificates."
286
+ result=$( dcld query pki all-x509-certs)
287
+ echo $result | jq
288
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_serial_number \" "
289
+ check_response " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number \" "
290
+
291
+ echo " Remove NOC root certificates"
292
+ result=$( echo " $passphrase " | dcld tx pki remove-noc-x509-root-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " --from=$vendor_account_65521 --yes)
293
+ result=$( get_txn_result " $result " )
294
+ check_response " $result " " \" code\" : 0"
295
+
296
+ echo " Request approved NOC root certificates should be empty"
297
+ result=$( dcld query pki x509-cert --subject=" $root_cert_subject " --subject-key-id=" $root_cert_subject_key_id " )
298
+ echo $result | jq
299
+ check_response " $result " " Not Found"
300
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_serial_number "
301
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number "
302
+
303
+ echo " Request NOC root certificates by VID should be empty"
304
+ result=$( dcld query pki noc-x509-root-certs --vid=" $root_cert_vid " )
305
+ echo $result | jq
306
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_serial_number "
307
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number "
308
+
309
+ echo " Request all certificates should contain only ICA certificate"
310
+ result=$( dcld query pki all-x509-certs)
311
+ echo $result | jq
312
+ check_response " $result " " \" serialNumber\" : \" $intermediate_cert_1_serial_number \" "
313
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_serial_number "
314
+ response_does_not_contain " $result " " \" serialNumber\" : \" $root_cert_1_copy_serial_number "
315
+
209
316
test_divider
0 commit comments