diff --git a/docs/transactions.md b/docs/transactions.md index 47cd93587..71b21d26e 100644 --- a/docs/transactions.md +++ b/docs/transactions.md @@ -1152,7 +1152,7 @@ This transaction adds a NOC root certificate owned by the Vendor. - CLI Command: - `dcld tx pki add-noc-x509-root-cert --certificate= --from=` -### ADD_X509_ROOT_CERTIFICATE +### ADD_NOC_X509_CERTIFICATE **Status: Implemented** @@ -1164,7 +1164,9 @@ already present on the ledger. - the provided certificate must be a non-root certificate: - `Issuer` != `Subject` - `Authority Key Identifier` != `Subject Key Identifier` - - `VID of NOC root certificate` == `VID of account` + - the root certificate must be a NOC certificate and added by the same vendor + - `isNoc` field of the root certificate must be set to true + - `VID of root certificate` == `VID of account` - no existing certificate with the same `:` combination. - if certificates with the same `:` combination already exist: - the existing certificate must be NOC non-root certificate diff --git a/integration_tests/cli/pki-noc-certs.sh b/integration_tests/cli/pki-noc-certs.sh index c64addc40..1f1e29993 100755 --- a/integration_tests/cli/pki-noc-certs.sh +++ b/integration_tests/cli/pki-noc-certs.sh @@ -2,16 +2,16 @@ set -euo pipefail source integration_tests/cli/common.sh noc_root_cert_1_path="integration_tests/constants/noc_root_cert_1" -noc_root_cert_1_subject="MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" +noc_root_cert_1_subject="MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMQ==" noc_root_cert_1_subject_key_id="44:EB:4C:62:6B:25:48:CD:A2:B3:1C:87:41:5A:08:E7:2B:B9:83:26" -noc_root_cert_1_serial_number="1" -noc_root_cert_1_subject_as_text="CN=www.example.com,OU=Testing Division,O=Example Company,L=New York,ST=New York,C=US" +noc_root_cert_1_serial_number="47211865327720222621302679792296833381734533449" +noc_root_cert_1_subject_as_text="CN=NOC-1,OU=Testing Division,O=Example Company,L=Tashkent,ST=Some State,C=UZ" noc_root_cert_2_path="integration_tests/constants/noc_root_cert_2" -noc_root_cert_2_subject="MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" +noc_root_cert_2_subject="MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMg==" noc_root_cert_2_subject_key_id="CF:E6:DD:37:2B:4C:B2:B9:A9:F2:75:30:1C:AA:B1:37:1B:11:7F:1B" -noc_root_cert_2_serial_number="2" -noc_root_cert_2_subject_as_text="CN=www.example.com,OU=Testing Division,O=Example Company,L=New York,ST=New York,C=US" +noc_root_cert_2_serial_number="332802481233145945539125204504842614737181725760" +noc_root_cert_2_subject_as_text="CN=NOC-2,OU=Testing Division,O=Example Company,L=Tashkent,ST=Some State,C=UZ" noc_root_cert_3_path="integration_tests/constants/noc_root_cert_3" noc_root_cert_3_subject="MFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDjAMBgNVBAMMBU5PQy0z" @@ -20,14 +20,14 @@ noc_root_cert_3_serial_number="38457288443253426021793906708335409501754677187" noc_root_cert_3_subject_as_text="CN=NOC-3,O=Internet Widgits Pty Ltd,ST=Some-State,C=AU" noc_cert_1_path="integration_tests/constants/noc_cert_1" -noc_cert_1_subject="MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" +noc_cert_1_subject="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMQ==" noc_cert_1_subject_key_id="02:72:6E:BC:BB:EF:D6:BD:8D:9B:42:AE:D4:3C:C0:55:5F:66:3A:B3" -noc_cert_1_serial_number="3" +noc_cert_1_serial_number="674670448117546613288490437900193266085116131998" noc_cert_2_path="integration_tests/constants/noc_cert_2" -noc_cert_2_subject="MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" +noc_cert_2_subject="MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMg==" noc_cert_2_subject_key_id="87:48:A2:33:12:1F:51:5C:93:E6:90:40:4A:2C:AB:9E:D6:19:E5:AD" -noc_cert_2_serial_number="4" +noc_cert_2_serial_number="361372967010167010646904372658654439710639340814" trustee_account="jack" second_trustee_account="alice" diff --git a/integration_tests/constants/noc_cert_1 b/integration_tests/constants/noc_cert_1 index 7967dc51e..911db9e48 100644 --- a/integration_tests/constants/noc_cert_1 +++ b/integration_tests/constants/noc_cert_1 @@ -1,14 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICOTCCAd+gAwIBAgIBAzAKBggqhkjOPQQDAjCBgjELMAkGA1UEBhMCVVMxETAP -BgNVBAgMCE5ldyBZb3JrMREwDwYDVQQHDAhOZXcgWW9yazEYMBYGA1UECgwPRXhh -bXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRgwFgYDVQQD -DA93d3cuZXhhbXBsZS5jb20wIBcNMjQwMzAxMDY0NDE4WhgPMzAyMzA3MDMwNjQ0 -MThaMIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcM -CE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRl -c3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTBZMBMGByqG -SM49AgEGCCqGSM49AwEHA0IABM49jq9u+/yejw1wh19r8xuQl6kWRRx85jKbSBqM -vbKmHxr/CTRGliov4z4oniiNrvSgor+KAGYSK1EPhUHeZdCjQjBAMB0GA1UdDgQW -BBQCcm68u+/WvY2bQq7UPMBVX2Y6szAfBgNVHSMEGDAWgBRE60xiayVIzaKzHIdB -WgjnK7mDJjAKBggqhkjOPQQDAgNIADBFAiAE9y8XdiA4kxwtY2vDS4HVkdoj5wyS -P3NimycxtXsj9AIhALjQsYWHp7+kr75SgNIKgav7Fr3fxEFvWca8oWMxM1PA +MIICQzCCAemgAwIBAgIUP0yGNyaeIwFgI9DPRAb6XUcZPQ4wCgYIKoZIzj0EAwIw +ejELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3RhdGUxETAPBgNVBAcMCFRh +c2hrZW50MRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3Rp +bmcgRGl2aXNpb24xDjAMBgNVBAMMBU5PQy0yMCAXDTI0MDMwNTA2MzAwMFoYDzMw +MjMwNzA3MDYzMDAwWjCBgjELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3Rh +dGUxEzARBgNVBAcMClNvbWUgU3RhdGUxGDAWBgNVBAoMD0V4YW1wbGUgQ29tcGFu +eTEZMBcGA1UECwwQVGVzdGluZyBEaXZpc2lvbjEUMBIGA1UEAwwLTk9DLWNoaWxk +LTIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT5HyWO2u+fC+hEv1kUzmzj+lro +RTN6WZOytOr439wO9nAAIx20PlvLsxbRZkLDZ61wXESG9uimTCxnUTFlr9m9o0Iw +QDAdBgNVHQ4EFgQUh0iiMxIfUVyT5pBASiyrntYZ5a0wHwYDVR0jBBgwFoAUz+bd +NytMsrmp8nUwHKqxNxsRfxswCgYIKoZIzj0EAwIDSAAwRQIgV9R3OgmjB/YTFk2N +6ojiUIh8+OjlGca5B//lyzaq/0ICIQDGB7S1/LrmDdN1OJBUYrwFhEcJMl2cdvcW +BQTbJS3ZSQ== -----END CERTIFICATE----- \ No newline at end of file diff --git a/integration_tests/constants/noc_cert_2 b/integration_tests/constants/noc_cert_2 index fa6908761..0e34c9347 100644 --- a/integration_tests/constants/noc_cert_2 +++ b/integration_tests/constants/noc_cert_2 @@ -1,14 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICODCCAd+gAwIBAgIBBDAKBggqhkjOPQQDAjCBgjELMAkGA1UEBhMCVVMxETAP -BgNVBAgMCE5ldyBZb3JrMREwDwYDVQQHDAhOZXcgWW9yazEYMBYGA1UECgwPRXhh -bXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRgwFgYDV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BBggqhkjOPQMBBwNCAATOPY6vbvv8no8NcIdfa/MbkJep +FkUcfOYym0gajL2yph8a/wk0RpYqL+M+KJ4oja70oKK/igBmEitRD4VB3mXQo0Iw +QDAdBgNVHQ4EFgQUAnJuvLvv1r2Nm0Ku1DzAVV9mOrMwHwYDVR0jBBgwFoAUROtM +YmslSM2isxyHQVoI5yu5gyYwCgYIKoZIzj0EAwIDSAAwRQIhAOhW3b4ekIdwqn0R +olz9kHN89goHOoRGTXAXUDkWptO1AiAbh5P/xEJZDKZbsUM9IFUyzG2xAk3+GOFQ +LhNMpjD/KQ== -----END CERTIFICATE----- \ No newline at end of file diff --git a/integration_tests/constants/noc_constants.go b/integration_tests/constants/noc_constants.go index e35dede56..5b95b9056 100644 --- a/integration_tests/constants/noc_constants.go +++ b/integration_tests/constants/noc_constants.go @@ -2,35 +2,35 @@ package testconstants const ( NocRootCert1 = `-----BEGIN CERTIFICATE----- -MIICRzCCAe2gAwIBAgIBATAKBggqhkjOPQQDAjCBgjELMAkGA1UEBhMCVVMxETAP -BgNVBAgMCE5ldyBZb3JrMREwDwYDVQQHDAhOZXcgWW9yazEYMBYGA1UECgwPRXhh -bXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRgwFgYDVQQD -DA93d3cuZXhhbXBsZS5jb20wIBcNMjQwMzAxMDYzMjU3WhgPMzAyMzA3MDMwNjMy -NTdaMIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcM -CE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRl -c3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTBZMBMGByqG -SM49AgEGCCqGSM49AwEHA0IABArFtQOcSk7+Km31LFKe+G0DZZCVehmS+fW/j4Ki -8quz9TzLSSty+zZorFL3bE9XWK9bDMwxCumbmo5KZCH3ld6jUDBOMB0GA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87:41:5A:08:E7:2B:B9:83:26" - NocRootCert1SerialNumber = "1" - NocRootCert1SubjectAsText = "CN=www.example.com,OU=Testing Division,O=Example Company,L=New York,ST=New York,C=US" + NocRootCert1SerialNumber = "47211865327720222621302679792296833381734533449" + NocRootCert1SubjectAsText = "CN=NOC-1,OU=Testing Division,O=Example Company,L=Tashkent,ST=Some State,C=UZ" - NocRootCert2Subject = "MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" + NocRootCert2Subject = "MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMg==" NocRootCert2SubjectKeyID = "CF:E6:DD:37:2B:4C:B2:B9:A9:F2:75:30:1C:AA:B1:37:1B:11:7F:1B" - NocRootCert2SerialNumber = "2" - NocRootCert2SubjectAsText = "CN=www.example.com,OU=Testing Division,O=Example Company,L=New York,ST=New York,C=US" + NocRootCert2SerialNumber = "332802481233145945539125204504842614737181725760" + NocRootCert2SubjectAsText = "CN=NOC-2,OU=Testing Division,O=Example Company,L=Tashkent,ST=Some State,C=UZ" NocRootCert3Subject = "MFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDjAMBgNVBAMMBU5PQy0z" NocRootCert3SubjectKeyID = "88:0D:06:D9:64:22:29:34:78:7F:8C:3B:AE:F5:08:93:86:8F:0D:20" NocRootCert3SerialNumber = "38457288443253426021793906708335409501754677187" NocRootCert3SubjectAsText = "CN=NOC-3,O=Internet Widgits Pty Ltd,ST=Some-State,C=AU" - NocCert1Subject = "MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" + NocCert1Subject = "MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMQ==" + NocCert1Issuer = "MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMQ==" NocCert1SubjectKeyID = "02:72:6E:BC:BB:EF:D6:BD:8D:9B:42:AE:D4:3C:C0:55:5F:66:3A:B3" - NocCert1SerialNumber = "3" - NocCert1SubjectAsText = "CN=www.example.com,OU=Testing Division,O=Example Company,L=New York,ST=New York,C=US" + NocCert1SerialNumber = "674670448117546613288490437900193266085116131998" + NocCert1SubjectAsText = "CN=NOC-child-1,OU=Testing Division,O=Example Company,L=Some State,ST=Some State,C=UZ" - NocCert2Subject = "MIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbQ==" + NocCert2Subject = "MIGCMQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0ZTETMBEGA1UEBwwKU29tZSBTdGF0ZTEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRQwEgYDVQQDDAtOT0MtY2hpbGQtMg==" + NocCert2Issuer = "MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMg==" NocCert2SubjectKeyID = "87:48:A2:33:12:1F:51:5C:93:E6:90:40:4A:2C:AB:9E:D6:19:E5:AD" - NocCert2SerialNumber = "4" - NocCert2SubjectAsText = "CN=www.example.com,OU=Testing Division,O=Example Company,L=New York,ST=New York,C=US" + NocCert2SerialNumber = "361372967010167010646904372658654439710639340814" + NocCert2SubjectAsText = "CN=NOC-child-2,OU=Testing Division,O=Example Company,L=Some State,ST=Some State,C=UZ" ) diff --git a/integration_tests/constants/noc_root_cert_1 b/integration_tests/constants/noc_root_cert_1 index 2d2cf7e54..37073e955 100644 --- a/integration_tests/constants/noc_root_cert_1 +++ b/integration_tests/constants/noc_root_cert_1 @@ -1,15 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICRzCCAe2gAwIBAgIBATAKBggqhkjOPQQDAjCBgjELMAkGA1UEBhMCVVMxETAP -BgNVBAgMCE5ldyBZb3JrMREwDwYDVQQHDAhOZXcgWW9yazEYMBYGA1UECgwPRXhh -bXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRgwFgYDVQQD -DA93d3cuZXhhbXBsZS5jb20wIBcNMjQwMzAxMDYzMjU3WhgPMzAyMzA3MDMwNjMy -NTdaMIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBA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UROtMYmslSM2isxyHQVoI5yu5gyYwHwYDVR0jBBgwFoAUROtMYmslSM2isxyH +QVoI5yu5gyYwDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNJADBGAiEAuieAwmim +npvmoTg56q4mrS0P8OywMwpdoKalWTyiaJICIQDoeyqpCZA8E6GpudrsBk4oiNOQ +v2eIe9+M9tp4hvDATQ== -----END CERTIFICATE----- \ No newline at end of file diff --git a/integration_tests/constants/noc_root_cert_2 b/integration_tests/constants/noc_root_cert_2 index f05cd88f3..18c76c1ec 100644 --- a/integration_tests/constants/noc_root_cert_2 +++ b/integration_tests/constants/noc_root_cert_2 @@ -1,15 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICRzCCAe2gAwIBAgIBAjAKBggqhkjOPQQDAjCBgjELMAkGA1UEBhMCVVMxETAP -BgNVBAgMCE5ldyBZb3JrMREwDwYDVQQHDAhOZXcgWW9yazEYMBYGA1UECgwPRXhh -bXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMRgwFgYDVQQD -DA93d3cuZXhhbXBsZS5jb20wIBcNMjQwMzAxMDYzOTI3WhgPMzAyMzA3MDMwNjM5 -MjdaMIGCMQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcM -CE5ldyBZb3JrMRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRl -c3RpbmcgRGl2aXNpb24xGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTBZMBMGByqG -SM49AgEGCCqGSM49AwEHA0IABHcmU8d5SWWFBGs0V6w1ILbrdxBdYlxV4myrbcIL -6iEKqP/Gf+boeNNvgI6pbGEVuydl4QGjZY3fplNhmXPcIbmjUDBOMB0GA1UdDgQW -BBTP5t03K0yyuanydTAcqrE3GxF/GzAfBgNVHSMEGDAWgBTP5t03K0yyuanydTAc -qrE3GxF/GzAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0gAMEUCIA0VRYFLNitp -0lffEXkPOwJ3RCJkxw4+TNiAZNhrs8QeAiEAh8124FgTDHwGCrQRFfYHVkCCayMK -7C3/hnmN19Uan88= +MIICSDCCAe6gAwIBAgIUOkthH5Kwr/0WLpXgtK2vtuWZ1EAwCgYIKoZIzj0EAwIw +ejELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3RhdGUxETAPBgNVBAcMCFRh +c2hrZW50MRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3Rp +bmcgRGl2aXNpb24xDjAMBgNVBAMMBU5PQy0yMCAXDTI0MDMwNTA2MjY0M1oYDzMw +MjMwNzA3MDYyNjQzWjB6MQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0 +ZTERMA8GA1UEBwwIVGFzaGtlbnQxGDAWBgNVBAoMD0V4YW1wbGUgQ29tcGFueTEZ +MBcGA1UECwwQVGVzdGluZyBEaXZpc2lvbjEOMAwGA1UEAwwFTk9DLTIwWTATBgcq +hkjOPQIBBggqhkjOPQMBBwNCAAR3JlPHeUllhQRrNFesNSC263cQXWJcVeJsq23C +C+ohCqj/xn/m6HjTb4COqWxhFbsnZeEBo2WN36ZTYZlz3CG5o1AwTjAdBgNVHQ4E +FgQUz+bdNytMsrmp8nUwHKqxNxsRfxswHwYDVR0jBBgwFoAUz+bdNytMsrmp8nUw +HKqxNxsRfxswDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAjQqbTDzu +XEc9jAaYSES/K1Wc+jCfKyUnX7+JJKt7wf0CIEhJyAE9FsbfXX/HBAAP7YJ0KB4N +/hlZdLMxeJ6r2K/E -----END CERTIFICATE----- \ No newline at end of file diff --git a/x/pki/client/cli/query_noc_certificates.go b/x/pki/client/cli/query_noc_certificates.go index f20a654b7..016c42738 100644 --- a/x/pki/client/cli/query_noc_certificates.go +++ b/x/pki/client/cli/query_noc_certificates.go @@ -15,7 +15,7 @@ import ( func CmdListNocCertificates() *cobra.Command { cmd := &cobra.Command{ Use: "all-noc-x509-certs", - Short: "Gets all NOC certificates", + Short: "Gets all NOC non-root certificates", RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) @@ -49,7 +49,7 @@ func CmdShowNocCertificates() *cobra.Command { var vid int32 cmd := &cobra.Command{ Use: "noc-x509-certs", - Short: "Gets NOC certificates by VID", + Short: "Gets NOC non-root certificates by VID", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) diff --git a/x/pki/client/cli/tx_add_noc_x_509_cert.go b/x/pki/client/cli/tx_add_noc_x_509_cert.go index 040cf2a69..383413a73 100644 --- a/x/pki/client/cli/tx_add_noc_x_509_cert.go +++ b/x/pki/client/cli/tx_add_noc_x_509_cert.go @@ -18,7 +18,7 @@ var _ = strconv.Itoa(0) func CmdAddNocX509Cert() *cobra.Command { cmd := &cobra.Command{ Use: "add-noc-x509-cert", - Short: "Adds NOC certificate", + Short: "Adds NOC non-root certificate", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/pki/handler_add_noc_cert_test.go b/x/pki/handler_add_noc_cert_test.go index a9fffbd5b..93a8b2f27 100644 --- a/x/pki/handler_add_noc_cert_test.go +++ b/x/pki/handler_add_noc_cert_test.go @@ -70,7 +70,7 @@ func TestHandler_AddNocX509Cert_AddNew(t *testing.T) { // check that unique certificate key registered require.True(t, - setup.Keeper.IsUniqueCertificatePresent(setup.Ctx, testconstants.NocCert1Subject, testconstants.NocCert1SerialNumber)) + setup.Keeper.IsUniqueCertificatePresent(setup.Ctx, testconstants.NocCert1Issuer, testconstants.NocCert1SerialNumber)) } func TestHandler_AddNocX509Cert_Renew(t *testing.T) { @@ -83,11 +83,6 @@ func TestHandler_AddNocX509Cert_Renew(t *testing.T) { // add NOC root certificate addNocRootCertificate(setup, accAddress, testconstants.NocRootCert1, vid) - // add the new NOC certificate - addNocX509Cert := types.NewMsgAddNocX509Cert(accAddress.String(), testconstants.NocCert1) - _, err := setup.Handler(setup.Ctx, addNocX509Cert) - require.NoError(t, err) - // Store the NOC certificate newNocCertificate := types.NewNocCertificate( testconstants.NocCert1, @@ -115,16 +110,21 @@ func TestHandler_AddNocX509Cert_Renew(t *testing.T) { } setup.Keeper.SetUniqueCertificate(setup.Ctx, uniqueCertificate) + // add the new NOC certificate + addNocX509Cert := types.NewMsgAddNocX509Cert(accAddress.String(), testconstants.NocCert1) + _, err := setup.Handler(setup.Ctx, addNocX509Cert) + require.NoError(t, err) + // query noc certificate by Subject and SKID approvedCertificates, err := queryApprovedCertificates(setup, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) require.NoError(t, err) require.Equal(t, len(approvedCertificates.Certs), 2) - require.Equal(t, &newNocCertificate, approvedCertificates.Certs[1]) + require.Equal(t, &newNocCertificate, approvedCertificates.Certs[0]) // query noc certificate by Subject approvedCertificatesBySubject, err := queryApprovedCertificatesBySubject(setup, newNocCertificate.Subject) require.NoError(t, err) - require.Equal(t, 2, len(approvedCertificatesBySubject.SubjectKeyIds)) + require.Equal(t, 1, len(approvedCertificatesBySubject.SubjectKeyIds)) // query noc certificate by SKID approvedCertificatesBySubjectKeyID, err := queryAllApprovedCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId)