diff --git a/docker-compose.yml b/docker-compose.yml index 6a518c325..e1775c8f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -122,4 +122,4 @@ networks: ipam: driver: default config: - - subnet: 192.167.10.0/16 + - subnet: 192.167.10.0/24 diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 84c130786..eb09da0db 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -9260,6 +9260,290 @@ paths: type: string tags: - Query + /dcl/pki/noc-certificates: + get: + summary: Queries a list of NocCertificates items. + operationId: NocCertificatesAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocCertificates: + type: array + items: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean + pagination: + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /dcl/pki/noc-certificates/{vid}: + get: + summary: Queries a NocCertificates by index. + operationId: NocCertificates + responses: + '200': + description: A successful response. + schema: + type: object + properties: + nocCertificates: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: vid + in: path + required: true + type: integer + format: int32 + tags: + - Query /dcl/pki/noc-root-certificates: get: summary: Queries a list of NocRootCertificates items. @@ -9540,8 +9824,8 @@ paths: - name: vid in: path required: true - type: string - format: uint64 + type: integer + format: int32 tags: - Query /dcl/pki/proposed-certificates: @@ -20945,6 +21229,68 @@ definitions: format: int64 info: type: string + zigbeealliance.distributedcomplianceledger.pki.NocCertificates: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean zigbeealliance.distributedcomplianceledger.pki.NocRootCertificates: type: object properties: @@ -21234,6 +21580,98 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } + zigbeealliance.distributedcomplianceledger.pki.QueryAllNocCertificatesResponse: + type: object + properties: + nocCertificates: + type: array + items: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean + pagination: + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } zigbeealliance.distributedcomplianceledger.pki.QueryAllNocRootCertificatesResponse: type: object properties: @@ -21811,6 +22249,71 @@ definitions: type: string subjectKeyId: type: string + zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesResponse: + type: object + properties: + nocCertificates: + type: object + properties: + vid: + type: integer + format: int32 + certs: + type: array + items: + type: object + properties: + pemCert: + type: string + serialNumber: + type: string + issuer: + type: string + authorityKeyId: + type: string + rootSubject: + type: string + rootSubjectKeyId: + type: string + isRoot: + type: boolean + owner: + type: string + subject: + type: string + subjectKeyId: + type: string + approvals: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + subjectAsText: + type: string + rejects: + type: array + items: + type: object + properties: + address: + type: string + time: + type: string + format: int64 + info: + type: string + vid: + type: integer + format: int32 + isNoc: + type: boolean zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesResponse: type: object properties: diff --git a/docs/transactions.md b/docs/transactions.md index 24c515401..71b21d26e 100644 --- a/docs/transactions.md +++ b/docs/transactions.md @@ -1152,6 +1152,37 @@ This transaction adds a NOC root certificate owned by the Vendor. - CLI Command: - `dcld tx pki add-noc-x509-root-cert --certificate= --from=` +### ADD_NOC_X509_CERTIFICATE + +**Status: Implemented** + +This transaction adds a NOC non-root certificate owned by the Vendor signed by a chain of certificates which must be +already present on the ledger. + +- Who can send: Vendor account +- Validation: + - the provided certificate must be a non-root certificate: + - `Issuer` != `Subject` + - `Authority Key Identifier` != `Subject Key Identifier` + - 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 + - the sender's VID must match the vid field of the existing certificates. + - the signature (self-signature) and expiration date must be valid. +- Parameters: + - cert: `string` - The NOC non-root Certificate, encoded in X.509v3 PEM format. Can be a PEM string or a file path. +- In State: + - `pki/ApprovedCertificates/value//` + - `pki/ApprovedCertificatesBySubject/value/` + - `pki/ApprovedCertificatesBySubjectKeyID/value/` + - `pki/NOCCertificates/value/` + - `pki/ChildCertificates/value//` +- CLI Command: + - `dcld tx pki add-noc-x509-cert --certificate= --from=` + ### GET_X509_CERT **Status: Implemented** @@ -1464,6 +1495,34 @@ Retrieve a list of all of NOC root certificates - REST API: - GET `/dcl/pki/noc-root-certificates` +### GET_NOC_X509_CERTS_BY_VID + +**Status: Implemented** + +Retrieve NOC non-root certificates associated with a specific VID. + +- Who can send: Any account +- Parameters: + - vid: `uint16` - Vendor ID (positive non-zero) +- CLI Command: + - `dcld query pki noc-x509-certs --vid=` +- REST API: + - GET `/dcl/pki/noc-certificates/{vid}` + +### GET_ALL_NOC_X509_CERTS + +**Status: Implemented** + +Retrieve a list of all of NOC non-root certificates + +- Who can send: Any account +- Parameters: + - Common pagination parameters +- CLI Command: + - `dcld query pki all-noc-x509-certs` +- REST API: + - GET `/dcl/pki/noc-certificates` + ## AUTH ### PROPOSE_ADD_ACCOUNT diff --git a/integration_tests/cli/pki-noc-certs.sh b/integration_tests/cli/pki-noc-certs.sh index 84d23ef11..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="MFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDjAMBgNVBAMMBU5PQy0x" +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="217369606639495620450806539821422258966012867792" -noc_root_cert_1_subject_as_text="CN=NOC-1,O=Internet Widgits Pty Ltd,ST=Some-State,C=AU" +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="MFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDjAMBgNVBAMMBU5PQy0y" +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="720401643293243343104681760462974770802745092176" -noc_root_cert_2_subject_as_text="CN=NOC-2,O=Internet Widgits Pty Ltd,ST=Some-State,C=AU" +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" @@ -19,6 +19,16 @@ noc_root_cert_3_subject_key_id="88:0D:06:D9:64:22:29:34:78:7F:8C:3B:AE:F5:08:93: 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="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="674670448117546613288490437900193266085116131998" + +noc_cert_2_path="integration_tests/constants/noc_cert_2" +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="361372967010167010646904372658654439710639340814" + trustee_account="jack" second_trustee_account="alice" @@ -92,7 +102,7 @@ echo $result | jq test_divider -echo "Try to add inermidiate cert using add-noc-x509-root-cert command" +echo "Try to add intermediate cert using add-noc-x509-root-cert command" intermediate_path="integration_tests/constants/intermediate_cert" result=$(echo "$passphrase" | dcld tx pki add-noc-x509-root-cert --certificate="$intermediate_path" --from $vendor_account --yes) check_response "$result" "\"code\": 414" @@ -173,4 +183,58 @@ check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" check_response "$result" "\"subjectAsText\": \"$noc_root_cert_1_subject_as_text\"" +echo "Add first NOC certificate by vendor with VID = $vid" +result=$(echo "$passphrase" | dcld tx pki add-noc-x509-cert --certificate="$noc_cert_1_path" --from $vendor_account --yes) +check_response "$result" "\"code\": 0" + +echo "Request NOC certificate by VID = $vid" +result=$(dcld query pki noc-x509-certs --vid="$vid") +echo $result | jq +check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" +check_response "$result" "\"vid\": $vid" + +test_divider + +echo "Request all child certificates by Subject and SubjectKeyID" +result=$(dcld query pki all-child-x509-certs --subject="$noc_root_cert_1_subject" --subject-key-id="$noc_root_cert_1_subject_key_id") +echo $result | jq +check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" + +echo "Try to add intermediate with different VID = $vid_2" +result=$(echo "$passphrase" | dcld tx pki add-noc-x509-cert --certificate="$noc_cert_2_path" --from $vendor_account_2 --yes) +check_response "$result" "\"code\": 439" + +test_divider + +echo "Add second NOC certificate by vendor with VID = $vid" +result=$(echo "$passphrase" | dcld tx pki add-noc-x509-cert --certificate="$noc_cert_2_path" --from $vendor_account --yes) +check_response "$result" "\"code\": 0" + +echo "Request all NOC certificates" +result=$(dcld query pki all-noc-x509-certs) +echo $result | jq +check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" +check_response "$result" "\"subject\": \"$noc_cert_2_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_cert_2_serial_number\"" +check_response "$result" "\"vid\": $vid" + +echo "Request all approved certificates" +result=$(dcld query pki all-x509-certs) +check_response "$result" "\"subject\": \"$noc_root_cert_1_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_root_cert_1_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_root_cert_1_serial_number\"" +check_response "$result" "\"subject\": \"$noc_cert_1_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_cert_1_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_cert_1_serial_number\"" +check_response "$result" "\"subject\": \"$noc_cert_2_subject\"" +check_response "$result" "\"subjectKeyId\": \"$noc_cert_2_subject_key_id\"" +check_response "$result" "\"serialNumber\": \"$noc_cert_2_serial_number\"" +echo $result | jq + test_divider \ No newline at end of file diff --git a/integration_tests/constants/noc_cert_1 b/integration_tests/constants/noc_cert_1 new file mode 100644 index 000000000..0e34c9347 --- /dev/null +++ b/integration_tests/constants/noc_cert_1 @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICQzCCAemgAwIBAgIUdi1E6xKBzdiOtwcjbQ/7wusqOp4wCgYIKoZIzj0EAwIw +ejELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3RhdGUxETAPBgNVBAcMCFRh +c2hrZW50MRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3Rp +bmcgRGl2aXNpb24xDjAMBgNVBAMMBU5PQy0xMCAXDTI0MDMwNTA2Mjg1NVoYDzMw +MjMwNzA3MDYyODU1WjCBgjELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3Rh +dGUxEzARBgNVBAcMClNvbWUgU3RhdGUxGDAWBgNVBAoMD0V4YW1wbGUgQ29tcGFu +eTEZMBcGA1UECwwQVGVzdGluZyBEaXZpc2lvbjEUMBIGA1UEAwwLTk9DLWNoaWxk +LTEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATOPY6vbvv8no8NcIdfa/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_cert_2 b/integration_tests/constants/noc_cert_2 new file mode 100644 index 000000000..911db9e48 --- /dev/null +++ b/integration_tests/constants/noc_cert_2 @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +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_constants.go b/integration_tests/constants/noc_constants.go index 4807fe2b3..5b95b9056 100644 --- a/integration_tests/constants/noc_constants.go +++ b/integration_tests/constants/noc_constants.go @@ -1,36 +1,38 @@ package testconstants const ( - NocRootCert1 = ` ------BEGIN CERTIFICATE----- -MIICATCCAaegAwIBAgIUJhMwtZzr6dGO6tqHmuDi4Bz/tNAwCgYIKoZIzj0EAwIw -VTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu -dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEOMAwGA1UEAwwFTk9DLTEwIBcNMjQwMjE0 -MTQ0NzI1WhgPMzAyMzA2MTcxNDQ3MjVaMFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQI -DApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQx -DjAMBgNVBAMMBU5PQy0xMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECsW1A5xK -Tv4qbfUsUp74bQNlkJV6GZL59b+PgqLyq7P1PMtJK3L7NmisUvdsT1dYr1sMzDEK -6ZuajkpkIfeV3qNTMFEwHQYDVR0OBBYEFETrTGJrJUjNorMch0FaCOcruYMmMB8G -A1UdIwQYMBaAFETrTGJrJUjNorMch0FaCOcruYMmMA8GA1UdEwEB/wQFMAMBAf8w -CgYIKoZIzj0EAwIDSAAwRQIgS4gxVvmQghH93BbG3RRpJ07Re5+gTFAo5qfVTtDo -teUCIQCQwlaPb8U8S0ee3Iz1gg4LOTxZ/IWyCzPpCteAEKcl+w== ------END CERTIFICATE----- - ` - NocRootCert2 = ` ------BEGIN CERTIFICATE----- -MIICATCCAaegAwIBAgIUfi/tSwkm8n1SVPVYvpmRj7WDKFAwCgYIKoZIzj0EAwIw -VTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu -dGVybmV0IFdpZGdpdHMgUHR5IEx0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wEB/zAKBggqhkjOPQQDAgNIADBFAiEAjQqbTDzu +XEc9jAaYSES/K1Wc+jCfKyUnX7+JJKt7wf0CIEhJyAE9FsbfXX/HBAAP7YJ0KB4N +/hlZdLMxeJ6r2K/E +-----END CERTIFICATE-----` + NocRootCert3 = ` -----BEGIN CERTIFICATE----- MIICAjCCAaegAwIBAgIUBrx8BUhP5Vi8W79pFDlqwkIw18MwCgYIKoZIzj0EAwIw @@ -47,18 +49,62 @@ F5UqAiEAshHfXxUpdfxqiLoTjQjkNf0AHVYBFhLdB+iIFspwTyg= -----END CERTIFICATE----- ` - NocRootCert1Subject = "MFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDjAMBgNVBAMMBU5PQy0x" + NocCert1 = `-----BEGIN CERTIFICATE----- +MIICQzCCAemgAwIBAgIUdi1E6xKBzdiOtwcjbQ/7wusqOp4wCgYIKoZIzj0EAwIw +ejELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3RhdGUxETAPBgNVBAcMCFRh +c2hrZW50MRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3Rp +bmcgRGl2aXNpb24xDjAMBgNVBAMMBU5PQy0xMCAXDTI0MDMwNTA2Mjg1NVoYDzMw +MjMwNzA3MDYyODU1WjCBgjELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3Rh +dGUxEzARBgNVBAcMClNvbWUgU3RhdGUxGDAWBgNVBAoMD0V4YW1wbGUgQ29tcGFu +eTEZMBcGA1UECwwQVGVzdGluZyBEaXZpc2lvbjEUMBIGA1UEAwwLTk9DLWNoaWxk +LTEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATOPY6vbvv8no8NcIdfa/MbkJep +FkUcfOYym0gajL2yph8a/wk0RpYqL+M+KJ4oja70oKK/igBmEitRD4VB3mXQo0Iw +Q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ATE-----` + + NocRootCert1Subject = "MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMQ==" NocRootCert1SubjectKeyID = "44:EB:4C:62:6B:25:48:CD:A2:B3:1C:87:41:5A:08:E7:2B:B9:83:26" - NocRootCert1SerialNumber = "217369606639495620450806539821422258966012867792" - NocRootCert1SubjectAsText = "CN=NOC-1,O=Internet Widgits Pty Ltd,ST=Some-State,C=AU" + NocRootCert1SerialNumber = "47211865327720222621302679792296833381734533449" + NocRootCert1SubjectAsText = "CN=NOC-1,OU=Testing Division,O=Example Company,L=Tashkent,ST=Some State,C=UZ" - NocRootCert2Subject = "MFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDjAMBgNVBAMMBU5PQy0y" + NocRootCert2Subject = "MHoxCzAJBgNVBAYTAlVaMRMwEQYDVQQIDApTb21lIFN0YXRlMREwDwYDVQQHDAhUYXNoa2VudDEYMBYGA1UECgwPRXhhbXBsZSBDb21wYW55MRkwFwYDVQQLDBBUZXN0aW5nIERpdmlzaW9uMQ4wDAYDVQQDDAVOT0MtMg==" NocRootCert2SubjectKeyID = "CF:E6:DD:37:2B:4C:B2:B9:A9:F2:75:30:1C:AA:B1:37:1B:11:7F:1B" - NocRootCert2SerialNumber = "720401643293243343104681760462974770802745092176" - NocRootCert2SubjectAsText = "CN=NOC-2,O=Internet Widgits Pty Ltd,ST=Some-State,C=AU" + 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 = "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 = "674670448117546613288490437900193266085116131998" + NocCert1SubjectAsText = "CN=NOC-child-1,OU=Testing Division,O=Example Company,L=Some State,ST=Some State,C=UZ" + + 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 = "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 f7fc29626..37073e955 100644 --- a/integration_tests/constants/noc_root_cert_1 +++ b/integration_tests/constants/noc_root_cert_1 @@ -1,13 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICATCCAaegAwIBAgIUJhMwtZzr6dGO6tqHmuDi4Bz/tNAwCgYIKoZIzj0EAwIw -VTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu -dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEOMAwGA1UEAwwFTk9DLTEwIBcNMjQwMjE0 -MTQ0NzI1WhgPMzAyMzA2MTcxNDQ3MjVaMFUxCzAJBgNVBAYTAkFVMRMwEQYDVQQI -DApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQx -DjAMBgNVBAMMBU5PQy0xMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECsW1A5xK -Tv4qbfUsUp74bQNlkJV6GZL59b+PgqLyq7P1PMtJK3L7NmisUvdsT1dYr1sMzDEK -6ZuajkpkIfeV3qNTMFEwHQYDVR0OBBYEFETrTGJrJUjNorMch0FaCOcruYMmMB8G -A1UdIwQYMBaAFETrTGJrJUjNorMch0FaCOcruYMmMA8GA1UdEwEB/wQFMAMBAf8w -CgYIKoZIzj0EAwIDSAAwRQIgS4gxVvmQghH93BbG3RRpJ07Re5+gTFAo5qfVTtDo -teUCIQCQwlaPb8U8S0ee3Iz1gg4LOTxZ/IWyCzPpCteAEKcl+w== ------END CERTIFICATE----- +MIICSTCCAe6gAwIBAgIUCEUNonYXYz/yzJZQRCalSOGDyUkwCgYIKoZIzj0EAwIw +ejELMAkGA1UEBhMCVVoxEzARBgNVBAgMClNvbWUgU3RhdGUxETAPBgNVBAcMCFRh +c2hrZW50MRgwFgYDVQQKDA9FeGFtcGxlIENvbXBhbnkxGTAXBgNVBAsMEFRlc3Rp +bmcgRGl2aXNpb24xDjAMBgNVBAMMBU5PQy0xMCAXDTI0MDMwNTA2MjYzNloYDzMw +MjMwNzA3MDYyNjM2WjB6MQswCQYDVQQGEwJVWjETMBEGA1UECAwKU29tZSBTdGF0 +ZTERMA8GA1UEBwwIVGFzaGtlbnQxGDAWBgNVBAoMD0V4YW1wbGUgQ29tcGFueTEZ +MBcGA1UECwwQVGVzdGluZyBEaXZpc2lvbjEOMAwGA1UEAwwFTk9DLTEwWTATBgcq +hkjOPQIBBggqhkjOPQMBBwNCAAQKxbUDnEpO/ipt9SxSnvhtA2WQlXoZkvn1v4+C +ovKrs/U8y0krcvs2aKxS92xPV1ivWwzMMQrpm5qOSmQh95Xeo1AwTjAdBgNVHQ4E +FgQUROtMYmslSM2isxyHQVoI5yu5gyYwHwYDVR0jBBgwFoAUROtMYmslSM2isxyH +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 bb2c5630f..18c76c1ec 100644 --- a/integration_tests/constants/noc_root_cert_2 +++ b/integration_tests/constants/noc_root_cert_2 @@ -1,13 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICATCCAa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wIVGFzaGtlbnQxGDAWBgNVBAoMD0V4YW1wbGUgQ29tcGFueTEZ +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/integration_tests/grpc_rest/pki/noc_cert_helper.go b/integration_tests/grpc_rest/pki/noc_cert_helper.go index 7867413be..ab1608646 100644 --- a/integration_tests/grpc_rest/pki/noc_cert_helper.go +++ b/integration_tests/grpc_rest/pki/noc_cert_helper.go @@ -49,6 +49,33 @@ func GetAllNocX509RootCerts(suite *utils.TestSuite) (res []pkitypes.NocRootCerti return res, nil } +func GetAllNocX509Certs(suite *utils.TestSuite) (res []pkitypes.NocCertificates, err error) { + if suite.Rest { + var resp pkitypes.QueryAllNocCertificatesResponse + err := suite.QueryREST("/dcl/pki/noc-certificates/", &resp) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } else { + grpcConn := suite.GetGRPCConn() + defer grpcConn.Close() + + // This creates a gRPC client to query the x/pki service. + pkiClient := pkitypes.NewQueryClient(grpcConn) + resp, err := pkiClient.NocCertificatesAll( + context.Background(), + &pkitypes.QueryAllNocCertificatesRequest{}, + ) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } + + return res, nil +} + func GetNocX509RootCerts(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocRootCertificates, error) { var res pkitypes.NocRootCertificates if suite.Rest { @@ -77,6 +104,34 @@ func GetNocX509RootCerts(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocR return &res, nil } +func GetNocX509Certs(suite *utils.TestSuite, vendorID int32) (*pkitypes.NocCertificates, error) { + var res pkitypes.NocCertificates + if suite.Rest { + var resp pkitypes.QueryGetNocCertificatesResponse + err := suite.QueryREST(fmt.Sprintf("/dcl/pki/noc-certificates/%v", vendorID), &resp) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } else { + grpcConn := suite.GetGRPCConn() + defer grpcConn.Close() + + // This creates a gRPC client to query the x/pki service. + pkiClient := pkitypes.NewQueryClient(grpcConn) + resp, err := pkiClient.NocCertificates( + context.Background(), + &pkitypes.QueryGetNocCertificatesRequest{Vid: vendorID}, + ) + if err != nil { + return nil, err + } + res = resp.GetNocCertificates() + } + + return &res, nil +} + //nolint:funlen func NocCertDemo(suite *utils.TestSuite) { // All requests return empty or 404 value @@ -133,7 +188,7 @@ func NocCertDemo(suite *utils.TestSuite) { ) require.NotNil(suite.T, vendor2Account) - // Try to add inermidiate cert + // Try to add intermediate cert msgAddNocRootCertificate := pkitypes.MsgAddNocX509RootCert{ Signer: vendor1Account.Address, Cert: testconstants.IntermediateCertPem, @@ -222,4 +277,63 @@ func NocCertDemo(suite *utils.TestSuite) { require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, certsBySubjectKeyID[0].Certs[0].SubjectKeyId) require.Equal(suite.T, testconstants.NocRootCert1Subject, certsBySubjectKeyID[0].Certs[0].Subject) require.Equal(suite.T, testconstants.NocRootCert1SubjectAsText, certsBySubjectKeyID[0].Certs[0].SubjectAsText) + + // Add intermediate NOC certificate + msgAddNocCertificate := pkitypes.MsgAddNocX509Cert{ + Signer: vendor1Account.Address, + Cert: testconstants.NocCert1, + } + _, err = suite.BuildAndBroadcastTx([]sdk.Msg{&msgAddNocCertificate}, vendor1Name, vendor1Account) + require.NoError(suite.T, err) + + // Request certificate by VID1 + nocCert, _ := GetNocX509Certs(suite, vid1) + require.Equal(suite.T, 1, len(nocCert.Certs)) + require.Equal(suite.T, testconstants.NocCert1Subject, nocCert.Certs[0].Subject) + require.Equal(suite.T, testconstants.NocCert1SubjectKeyID, nocCert.Certs[0].SubjectKeyId) + + // Request Child certificates list + childCertificates, _ := GetAllChildX509Certs(suite, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + require.Equal(suite.T, testconstants.NocRootCert1Subject, childCertificates.Issuer) + require.Equal(suite.T, testconstants.NocRootCert1SubjectKeyID, childCertificates.AuthorityKeyId) + require.Equal(suite.T, testconstants.NocCert1Subject, childCertificates.CertIds[0].Subject) + require.Equal(suite.T, testconstants.NocCert1SubjectKeyID, childCertificates.CertIds[0].SubjectKeyId) + + // Try to add third intermediate NOC certificate with different vid + msgAddNocCertificate = pkitypes.MsgAddNocX509Cert{ + Signer: vendor1Account.Address, + Cert: testconstants.NocCert2, + } + _, err = suite.BuildAndBroadcastTx([]sdk.Msg{&msgAddNocCertificate}, vendor2Name, vendor2Account) + require.Error(suite.T, err) + + // Add second intermediate NOC certificate + msgAddNocCertificate = pkitypes.MsgAddNocX509Cert{ + Signer: vendor1Account.Address, + Cert: testconstants.NocCert2, + } + _, err = suite.BuildAndBroadcastTx([]sdk.Msg{&msgAddNocCertificate}, vendor1Name, vendor1Account) + require.NoError(suite.T, err) + + // Request certificate by VID1 + nocCerts, _ := GetAllNocX509Certs(suite) + require.Equal(suite.T, 1, len(nocCerts)) + require.Equal(suite.T, 2, len(nocCerts[0].Certs)) + + // Request NOC certificate by Subject and SubjectKeyID + certs, _ := GetX509Cert(suite, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + require.Equal(suite.T, testconstants.NocCert1Subject, certs.Subject) + require.Equal(suite.T, testconstants.NocCert1SubjectKeyID, certs.SubjectKeyId) + require.Equal(suite.T, 1, len(certs.Certs)) + require.Equal(suite.T, testconstants.NocCert1, certs.Certs[0].PemCert) + require.Equal(suite.T, vendor1Account.Address, certs.Certs[0].Owner) + require.False(suite.T, certs.Certs[0].IsRoot) + + certs, _ = GetX509Cert(suite, testconstants.NocCert2Subject, testconstants.NocCert2SubjectKeyID) + require.Equal(suite.T, testconstants.NocCert2Subject, certs.Subject) + require.Equal(suite.T, testconstants.NocCert2SubjectKeyID, certs.SubjectKeyId) + require.Equal(suite.T, 1, len(certs.Certs)) + require.Equal(suite.T, testconstants.NocCert2, certs.Certs[0].PemCert) + require.Equal(suite.T, vendor1Account.Address, certs.Certs[0].Owner) + require.False(suite.T, certs.Certs[0].IsRoot) } diff --git a/proto/pki/genesis.proto b/proto/pki/genesis.proto index a95a496e7..f32cc26ba 100644 --- a/proto/pki/genesis.proto +++ b/proto/pki/genesis.proto @@ -15,6 +15,7 @@ import "pki/pki_revocation_distribution_point.proto"; import "pki/pki_revocation_distribution_points_by_issuer_subject_key_id.proto"; import "pki/approved_certificates_by_subject_key_id.proto"; import "pki/noc_root_certificates.proto"; +import "pki/noc_certificates.proto"; // this line is used by starport scaffolding # genesis/proto/import import "gogoproto/gogo.proto"; @@ -36,5 +37,6 @@ message GenesisState { repeated PkiRevocationDistributionPointsByIssuerSubjectKeyID PkiRevocationDistributionPointsByIssuerSubjectKeyIDList = 12 [(gogoproto.nullable) = false]; repeated ApprovedCertificatesBySubjectKeyId approvedCertificatesBySubjectKeyIdList = 13 [(gogoproto.nullable) = false]; repeated NocRootCertificates nocRootCertificatesList = 14 [(gogoproto.nullable) = false]; + repeated NocCertificates nocCertificatesList = 15 [(gogoproto.nullable) = false]; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/pki/noc_certificates.proto b/proto/pki/noc_certificates.proto new file mode 100644 index 000000000..d09bd6f99 --- /dev/null +++ b/proto/pki/noc_certificates.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package zigbeealliance.distributedcomplianceledger.pki; + +option go_package = "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"; + +import "gogoproto/gogo.proto"; +import "pki/certificate.proto"; + +message NocCertificates { + int32 vid = 1 [(gogoproto.moretags) = "validate:\"gte=1,lte=65535\""]; + repeated Certificate certs = 2; +} diff --git a/proto/pki/query.proto b/proto/pki/query.proto index ca1c0d93f..f8b438860 100644 --- a/proto/pki/query.proto +++ b/proto/pki/query.proto @@ -15,6 +15,7 @@ import "pki/rejected_certificate.proto"; import "pki/pki_revocation_distribution_point.proto"; import "pki/pki_revocation_distribution_points_by_issuer_subject_key_id.proto"; import "pki/noc_root_certificates.proto"; +import "pki/noc_certificates.proto"; // this line is used by starport scaffolding # 1 import "gogoproto/gogo.proto"; @@ -120,6 +121,16 @@ service Query { option (google.api.http).get = "/dcl/pki/noc-root-certificates"; } +// Queries a NocCertificates by index. + rpc NocCertificates(QueryGetNocCertificatesRequest) returns (QueryGetNocCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/noc-certificates/{vid}"; + } + + // Queries a list of NocCertificates items. + rpc NocCertificatesAll(QueryAllNocCertificatesRequest) returns (QueryAllNocCertificatesResponse) { + option (google.api.http).get = "/dcl/pki/noc-certificates"; + } + // this line is used by starport scaffolding # 2 } @@ -278,7 +289,7 @@ message QueryGetPkiRevocationDistributionPointsByIssuerSubjectKeyIDResponse { } message QueryGetNocRootCertificatesRequest { - uint64 vid = 1; + int32 vid = 1; } @@ -295,4 +306,21 @@ message QueryAllNocRootCertificatesResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } +message QueryGetNocCertificatesRequest { + int32 vid = 1; +} + +message QueryGetNocCertificatesResponse { + NocCertificates nocCertificates = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllNocCertificatesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllNocCertificatesResponse { + repeated NocCertificates nocCertificates = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + // this line is used by starport scaffolding # 3 diff --git a/proto/pki/tx.proto b/proto/pki/tx.proto index 007262621..a6d687277 100644 --- a/proto/pki/tx.proto +++ b/proto/pki/tx.proto @@ -23,6 +23,7 @@ service Msg { rpc AssignVid(MsgAssignVid) returns (MsgAssignVidResponse); rpc AddNocX509RootCert(MsgAddNocX509RootCert) returns (MsgAddNocX509RootCertResponse); rpc RemoveX509Cert(MsgRemoveX509Cert) returns (MsgRemoveX509CertResponse); + rpc AddNocX509Cert(MsgAddNocX509Cert) returns (MsgAddNocX509CertResponse); // this line is used by starport scaffolding # proto/tx/rpc } @@ -178,4 +179,12 @@ message MsgRemoveX509Cert { message MsgRemoveX509CertResponse { } +message MsgAddNocX509Cert { + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.moretags) = "validate:\"required\""]; + string cert = 2 [(gogoproto.moretags) = "validate:\"required,max=10485760\""]; +} + +message MsgAddNocX509CertResponse { +} + // this line is used by starport scaffolding # proto/tx/message \ No newline at end of file diff --git a/scripts/starport/upgrade-0.44/07.pki_types.sh b/scripts/starport/upgrade-0.44/07.pki_types.sh index afd2be532..4eda7e98f 100755 --- a/scripts/starport/upgrade-0.44/07.pki_types.sh +++ b/scripts/starport/upgrade-0.44/07.pki_types.sh @@ -18,6 +18,7 @@ starport scaffold --module pki message add-pki-revocation-distribution-point vid starport scaffold --module pki message update-pki-revocation-distribution-point vid:uint label crlSignerCertificate issuerSubjectKeyID dataURL dataFileSize:uint dataDigest dataDigestType:uint --signer signer starport scaffold --module pki message delete-pki-revocation-distribution-point vid:uint label issuerSubjectKeyID --signer signer starport scaffold --module pki message AddNocX509RootCert cert --signer signer +starport scaffold --module pki message AddNocX509Cert cert --signer signer # CRUD data types starport scaffold --module pki map ApprovedCertificates certs:strings --index subject,subjectKeyId --no-message @@ -35,6 +36,7 @@ starport scaffold --module pki map ApprovedCertificatesBySubjectKeyId certs:stri starport scaffold --module pki map RejectedCertificate pemCert serialNumber owner approvals:strings --index subject,subjectKeyId --no-message #starport scaffold --module pki map AllProposedCertificates --index subject,subjectKeyId --no-message starport scaffold --module pki map NocRootCertificates certs:strings --index vid:uint --no-message +starport scaffold --module pki map NocCertificates certs:strings --index vid:uint --no-message # Allow colons (:) in subject ID part in REST URLs # TODO: need to copy the generated query.pb.gw.go into the correct folder diff --git a/types/pki/errors.go b/types/pki/errors.go index 29f71e0d7..553b0e881 100644 --- a/types/pki/errors.go +++ b/types/pki/errors.go @@ -194,6 +194,12 @@ func NewErrProvidedNocCertButExistingNotNoc(subject string, subjectKeyID string) subject, subjectKeyID) } +func NewErrRootOfNocCertIsNotNoc(subject string, subjectKeyID string) error { + return sdkerrors.Wrapf(ErrInappropriateCertificateType, + "Root of the provided certificate with subject (%v) and subjectKeyID (%v) is not a NOC certificate", + subject, subjectKeyID) +} + func NewErrProvidedNotNocCertButExistingNoc(subject string, subjectKeyID string) error { return sdkerrors.Wrapf(ErrInappropriateCertificateType, "The existing certificate with the same combination of subject (%v) and subjectKeyID (%v) is a NOC certificate", diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts index 065d05655..b68eb5c97 100755 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/index.ts @@ -10,6 +10,7 @@ import { Certificate } from "./module/types/pki/certificate" import { CertificateIdentifier } from "./module/types/pki/certificate_identifier" import { ChildCertificates } from "./module/types/pki/child_certificates" import { Grant } from "./module/types/pki/grant" +import { NocCertificates } from "./module/types/pki/noc_certificates" import { NocRootCertificates } from "./module/types/pki/noc_root_certificates" import { PkiRevocationDistributionPoint } from "./module/types/pki/pki_revocation_distribution_point" import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from "./module/types/pki/pki_revocation_distribution_points_by_issuer_subject_key_id" @@ -21,7 +22,7 @@ import { RevokedRootCertificates } from "./module/types/pki/revoked_root_certifi import { UniqueCertificate } from "./module/types/pki/unique_certificate" -export { ApprovedCertificates, ApprovedCertificatesBySubject, ApprovedCertificatesBySubjectKeyId, ApprovedRootCertificates, Certificate, CertificateIdentifier, ChildCertificates, Grant, NocRootCertificates, PkiRevocationDistributionPoint, PkiRevocationDistributionPointsByIssuerSubjectKeyID, ProposedCertificate, ProposedCertificateRevocation, RejectedCertificate, RevokedCertificates, RevokedRootCertificates, UniqueCertificate }; +export { ApprovedCertificates, ApprovedCertificatesBySubject, ApprovedCertificatesBySubjectKeyId, ApprovedRootCertificates, Certificate, CertificateIdentifier, ChildCertificates, Grant, NocCertificates, NocRootCertificates, PkiRevocationDistributionPoint, PkiRevocationDistributionPointsByIssuerSubjectKeyID, ProposedCertificate, ProposedCertificateRevocation, RejectedCertificate, RevokedCertificates, RevokedRootCertificates, UniqueCertificate }; async function initTxClient(vuexGetters) { return await txClient(vuexGetters['common/wallet/signer'], { @@ -78,6 +79,8 @@ const getDefaultState = () => { PkiRevocationDistributionPointsByIssuerSubjectKeyID: {}, NocRootCertificates: {}, NocRootCertificatesAll: {}, + NocCertificates: {}, + NocCertificatesAll: {}, _Structure: { ApprovedCertificates: getStructure(ApprovedCertificates.fromPartial({})), @@ -88,6 +91,7 @@ const getDefaultState = () => { CertificateIdentifier: getStructure(CertificateIdentifier.fromPartial({})), ChildCertificates: getStructure(ChildCertificates.fromPartial({})), Grant: getStructure(Grant.fromPartial({})), + NocCertificates: getStructure(NocCertificates.fromPartial({})), NocRootCertificates: getStructure(NocRootCertificates.fromPartial({})), PkiRevocationDistributionPoint: getStructure(PkiRevocationDistributionPoint.fromPartial({})), PkiRevocationDistributionPointsByIssuerSubjectKeyID: getStructure(PkiRevocationDistributionPointsByIssuerSubjectKeyID.fromPartial({})), @@ -239,6 +243,18 @@ export default { } return state.NocRootCertificatesAll[JSON.stringify(params)] ?? {} }, + getNocCertificates: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.NocCertificates[JSON.stringify(params)] ?? {} + }, + getNocCertificatesAll: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.NocCertificatesAll[JSON.stringify(params)] ?? {} + }, getTypeStructure: (state) => (type) => { return state._Structure[type].fields @@ -722,8 +738,56 @@ export default { } }, - - async sendMsgRejectAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { + + + + + + + async QueryNocCertificates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const queryClient=await initQueryClient(rootGetters) + let value= (await queryClient.queryNocCertificates( key.vid)).data + + + commit('QUERY', { query: 'NocCertificates', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryNocCertificates', payload: { options: { all }, params: {...key},query }}) + return getters['getNocCertificates']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new SpVuexError('QueryClient:QueryNocCertificates', 'API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryNocCertificatesAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const queryClient=await initQueryClient(rootGetters) + let value= (await queryClient.queryNocCertificatesAll(query)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await queryClient.queryNocCertificatesAll({...query, 'pagination.key':( value).pagination.next_key})).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'NocCertificatesAll', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryNocCertificatesAll', payload: { options: { all }, params: {...key},query }}) + return getters['getNocCertificatesAll']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new SpVuexError('QueryClient:QueryNocCertificatesAll', 'API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgRevokeX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { try { const txClient=await initTxClient(rootGetters) const msg = await txClient.msgRejectAddX509RootCert(value) @@ -796,6 +860,22 @@ export default { }else{ throw new SpVuexError('TxClient:MsgProposeAddX509RootCert:Send', 'Could not broadcast Tx: '+ e.message) } + } + } + }, + async sendMsgAddNocX509Cert({ rootGetters }, { value, fee = [], memo = '' }) { + try { + const txClient=await initTxClient(rootGetters) + const msg = await txClient.msgAddNocX509Cert(value) + const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee, + gas: "200000" }, memo}) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new SpVuexError('TxClient:MsgAddNocX509Cert:Init', 'Could not initialize signing client. Wallet is required.') + }else{ + throw new SpVuexError('TxClient:MsgAddNocX509Cert:Send', 'Could not broadcast Tx: '+ e.message) + } } }, async sendMsgApproveAddX509RootCert({ rootGetters }, { value, fee = [], memo = '' }) { diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts index 3d84c6f79..69eb33aa3 100755 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts @@ -17,6 +17,7 @@ import { MsgAddX509Cert } from "./types/pki/tx"; import { MsgApproveRevokeX509RootCert } from "./types/pki/tx"; import { MsgProposeRevokeX509RootCert } from "./types/pki/tx"; import { MsgRemoveX509Cert } from "./types/pki/tx"; +import { MsgAddNocX509Cert } from "./types/pki/tx"; const types = [ @@ -33,6 +34,7 @@ const types = [ ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", MsgApproveRevokeX509RootCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", MsgProposeRevokeX509RootCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", MsgRemoveX509Cert], + ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509Cert", MsgAddNocX509Cert], ]; export const MissingWalletError = new Error("wallet is required"); @@ -77,6 +79,7 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = msgApproveRevokeX509RootCert: (data: MsgApproveRevokeX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", value: MsgApproveRevokeX509RootCert.fromPartial( data ) }), msgProposeRevokeX509RootCert: (data: MsgProposeRevokeX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", value: MsgProposeRevokeX509RootCert.fromPartial( data ) }), msgRemoveX509Cert: (data: MsgRemoveX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", value: MsgRemoveX509Cert.fromPartial( data ) }), + msgAddNocX509Cert: (data: MsgAddNocX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509Cert", value: MsgAddNocX509Cert.fromPartial( data ) }), }; }; diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts index 846217c49..119fbaecb 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts @@ -30,6 +30,12 @@ export interface PkiNocRootCertificates { certs?: PkiCertificate[]; } +export interface PkiNocCertificates { + /** @format int32 */ + vid?: number; + certs?: PkiCertificate[]; +} + export interface PkiCertificate { pemCert?: string; serialNumber?: string; @@ -69,6 +75,8 @@ export interface PkiGrant { info?: string; } +export type PkiMsgAddNocX509CertResponse = object; + export type PkiMsgAddNocX509RootCertResponse = object; export type PkiMsgAddPkiRevocationDistributionPointResponse = object; @@ -176,6 +184,20 @@ export interface PkiQueryAllNocRootCertificatesResponse { pagination?: V1Beta1PageResponse; } +export interface PkiQueryAllNocCertificatesResponse { + nocCertificates?: PkiNocCertificates[]; + + /** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ + pagination?: V1Beta1PageResponse; +} export interface PkiQueryAllPkiRevocationDistributionPointResponse { PkiRevocationDistributionPoint?: PkiPkiRevocationDistributionPoint[]; @@ -272,6 +294,10 @@ export interface PkiQueryGetNocRootCertificatesResponse { nocRootCertificates?: PkiNocRootCertificates; } +export interface PkiQueryGetNocCertificatesResponse { + nocCertificates?: PkiNocRootCertificates; +} + export interface PkiQueryGetPkiRevocationDistributionPointResponse { PkiRevocationDistributionPoint?: PkiPkiRevocationDistributionPoint; } @@ -703,6 +729,48 @@ export class Api extends HttpClient + this.request({ + path: `/dcl/pki/noc-certificates`, + method: "GET", + query: query, + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryNocCertificates + * @summary Queries a NocCertificates by index. + * @request GET:/dcl/pki/noc_certificates/{vid} + */ + queryNocCertificates = (vid: string, params: RequestParams = {}) => + this.request({ + path: `/dcl/pki/noc-certificates/${vid}`, + method: "GET", + format: "json", + ...params, + }); + /** * No description * diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts index 1cc0feb52..1a0e50af0 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/genesis.ts @@ -13,6 +13,7 @@ import { PkiRevocationDistributionPoint } from '../pki/pki_revocation_distributi import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from '../pki/pki_revocation_distribution_points_by_issuer_subject_key_id' import { ApprovedCertificatesBySubjectKeyId } from '../pki/approved_certificates_by_subject_key_id' import { NocRootCertificates } from '../pki/noc_root_certificates' +import { NocCertificates } from '../pki/noc_certificates' import { Writer, Reader } from 'protobufjs/minimal' export const protobufPackage = 'zigbeealliance.distributedcomplianceledger.pki' @@ -32,8 +33,9 @@ export interface GenesisState { PkiRevocationDistributionPointList: PkiRevocationDistributionPoint[] pkiRevocationDistributionPointsByIssuerSubjectKeyIDList: PkiRevocationDistributionPointsByIssuerSubjectKeyID[] approvedCertificatesBySubjectKeyIdList: ApprovedCertificatesBySubjectKeyId[] - /** this line is used by starport scaffolding # genesis/proto/state */ nocRootCertificatesList: NocRootCertificates[] + /** this line is used by starport scaffolding # genesis/proto/state */ + nocCertificatesList: NocCertificates[] } const baseGenesisState: object = {} @@ -82,6 +84,9 @@ export const GenesisState = { for (const v of message.nocRootCertificatesList) { NocRootCertificates.encode(v!, writer.uint32(114).fork()).ldelim() } + for (const v of message.nocCertificatesList) { + NocCertificates.encode(v!, writer.uint32(122).fork()).ldelim() + } return writer }, @@ -101,6 +106,7 @@ export const GenesisState = { message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] message.approvedCertificatesBySubjectKeyIdList = [] message.nocRootCertificatesList = [] + message.nocCertificatesList = [] while (reader.pos < end) { const tag = reader.uint32() switch (tag >>> 3) { @@ -148,6 +154,9 @@ export const GenesisState = { case 14: message.nocRootCertificatesList.push(NocRootCertificates.decode(reader, reader.uint32())) break + case 15: + message.nocCertificatesList.push(NocCertificates.decode(reader, reader.uint32())) + break default: reader.skipType(tag & 7) break @@ -170,6 +179,7 @@ export const GenesisState = { message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] message.approvedCertificatesBySubjectKeyIdList = [] message.nocRootCertificatesList = [] + message.nocCertificatesList = [] if (object.approvedCertificatesList !== undefined && object.approvedCertificatesList !== null) { for (const e of object.approvedCertificatesList) { message.approvedCertificatesList.push(ApprovedCertificates.fromJSON(e)) @@ -243,6 +253,11 @@ export const GenesisState = { message.nocRootCertificatesList.push(NocRootCertificates.fromJSON(e)) } } + if (object.nocCertificatesList !== undefined && object.nocCertificatesList !== null) { + for (const e of object.nocCertificatesList) { + message.nocCertificatesList.push(NocCertificates.fromJSON(e)) + } + } return message }, @@ -316,6 +331,11 @@ export const GenesisState = { } else { obj.nocRootCertificatesList = [] } + if (message.nocCertificatesList) { + obj.nocCertificatesList = message.nocCertificatesList.map((e) => (e ? NocCertificates.toJSON(e) : undefined)) + } else { + obj.nocCertificatesList = [] + } return obj }, @@ -333,6 +353,7 @@ export const GenesisState = { message.pkiRevocationDistributionPointsByIssuerSubjectKeyIDList = [] message.approvedCertificatesBySubjectKeyIdList = [] message.nocRootCertificatesList = [] + message.nocCertificatesList = [] if (object.approvedCertificatesList !== undefined && object.approvedCertificatesList !== null) { for (const e of object.approvedCertificatesList) { message.approvedCertificatesList.push(ApprovedCertificates.fromPartial(e)) @@ -406,6 +427,11 @@ export const GenesisState = { message.nocRootCertificatesList.push(NocRootCertificates.fromPartial(e)) } } + if (object.nocCertificatesList !== undefined && object.nocCertificatesList !== null) { + for (const e of object.nocCertificatesList) { + message.nocCertificatesList.push(NocCertificates.fromPartial(e)) + } + } return message } } diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/noc_certificates.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/noc_certificates.ts new file mode 100644 index 000000000..973937e61 --- /dev/null +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/noc_certificates.ts @@ -0,0 +1,100 @@ +/* eslint-disable */ +import { Certificate } from '../pki/certificate' +import { Writer, Reader } from 'protobufjs/minimal' + +export const protobufPackage = 'zigbeealliance.distributedcomplianceledger.pki' + +export interface NocCertificates { + vid: number + certs: Certificate[] +} + +const baseNocCertificates: object = { vid: 0 } + +export const NocCertificates = { + encode(message: NocCertificates, writer: Writer = Writer.create()): Writer { + if (message.vid !== 0) { + writer.uint32(8).int32(message.vid) + } + for (const v of message.certs) { + Certificate.encode(v!, writer.uint32(18).fork()).ldelim() + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): NocCertificates { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseNocCertificates } as NocCertificates + message.certs = [] + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.vid = reader.int32() + break + case 2: + message.certs.push(Certificate.decode(reader, reader.uint32())) + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): NocCertificates { + const message = { ...baseNocCertificates } as NocCertificates + message.certs = [] + if (object.vid !== undefined && object.vid !== null) { + message.vid = Number(object.vid) + } else { + message.vid = 0 + } + if (object.certs !== undefined && object.certs !== null) { + for (const e of object.certs) { + message.certs.push(Certificate.fromJSON(e)) + } + } + return message + }, + + toJSON(message: NocCertificates): unknown { + const obj: any = {} + message.vid !== undefined && (obj.vid = message.vid) + if (message.certs) { + obj.certs = message.certs.map((e) => (e ? Certificate.toJSON(e) : undefined)) + } else { + obj.certs = [] + } + return obj + }, + + fromPartial(object: DeepPartial): NocCertificates { + const message = { ...baseNocCertificates } as NocCertificates + message.certs = [] + if (object.vid !== undefined && object.vid !== null) { + message.vid = object.vid + } else { + message.vid = 0 + } + if (object.certs !== undefined && object.certs !== null) { + for (const e of object.certs) { + message.certs.push(Certificate.fromPartial(e)) + } + } + return message + } +} + +type Builtin = Date | Function | Uint8Array | string | number | undefined +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts index ccf6a5ecd..ba30e1a5c 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/query.ts @@ -13,6 +13,7 @@ import { RejectedCertificate } from '../pki/rejected_certificate' import { PkiRevocationDistributionPoint } from '../pki/pki_revocation_distribution_point' import { PkiRevocationDistributionPointsByIssuerSubjectKeyID } from '../pki/pki_revocation_distribution_points_by_issuer_subject_key_id' import { NocRootCertificates } from '../pki/noc_root_certificates' +import { NocCertificates } from '../pki/noc_certificates' export const protobufPackage = 'zigbeealliance.distributedcomplianceledger.pki' @@ -181,6 +182,23 @@ export interface QueryAllNocRootCertificatesResponse { pagination: PageResponse | undefined } +export interface QueryGetNocCertificatesRequest { + vid: number +} + +export interface QueryGetNocCertificatesResponse { + nocCertificates: NocCertificates | undefined +} + +export interface QueryAllNocCertificatesRequest { + pagination: PageRequest | undefined +} + +export interface QueryAllNocCertificatesResponse { + nocCertificates: NocCertificates[] + pagination: PageResponse | undefined +} + const baseQueryGetApprovedCertificatesRequest: object = { subject: '', subjectKeyId: '' } export const QueryGetApprovedCertificatesRequest = { @@ -2615,6 +2633,250 @@ export const QueryAllNocRootCertificatesResponse = { } } +const baseQueryGetNocCertificatesRequest: object = { vid: 0 } + +export const QueryGetNocCertificatesRequest = { + encode(message: QueryGetNocCertificatesRequest, writer: Writer = Writer.create()): Writer { + if (message.vid !== 0) { + writer.uint32(8).int32(message.vid) + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): QueryGetNocCertificatesRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseQueryGetNocCertificatesRequest } as QueryGetNocCertificatesRequest + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.vid = reader.int32() + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): QueryGetNocCertificatesRequest { + const message = { ...baseQueryGetNocCertificatesRequest } as QueryGetNocCertificatesRequest + if (object.vid !== undefined && object.vid !== null) { + message.vid = Number(object.vid) + } else { + message.vid = 0 + } + return message + }, + + toJSON(message: QueryGetNocCertificatesRequest): unknown { + const obj: any = {} + message.vid !== undefined && (obj.vid = message.vid) + return obj + }, + + fromPartial(object: DeepPartial): QueryGetNocCertificatesRequest { + const message = { ...baseQueryGetNocCertificatesRequest } as QueryGetNocCertificatesRequest + if (object.vid !== undefined && object.vid !== null) { + message.vid = object.vid + } else { + message.vid = 0 + } + return message + } +} + +const baseQueryGetNocCertificatesResponse: object = {} + +export const QueryGetNocCertificatesResponse = { + encode(message: QueryGetNocCertificatesResponse, writer: Writer = Writer.create()): Writer { + if (message.nocCertificates !== undefined) { + NocCertificates.encode(message.nocCertificates, writer.uint32(10).fork()).ldelim() + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): QueryGetNocCertificatesResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseQueryGetNocCertificatesResponse } as QueryGetNocCertificatesResponse + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.nocCertificates = NocCertificates.decode(reader, reader.uint32()) + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): QueryGetNocCertificatesResponse { + const message = { ...baseQueryGetNocCertificatesResponse } as QueryGetNocCertificatesResponse + if (object.nocCertificates !== undefined && object.nocCertificates !== null) { + message.nocCertificates = NocCertificates.fromJSON(object.nocCertificates) + } else { + message.nocCertificates = undefined + } + return message + }, + + toJSON(message: QueryGetNocCertificatesResponse): unknown { + const obj: any = {} + message.nocCertificates !== undefined && (obj.nocCertificates = message.nocCertificates ? NocCertificates.toJSON(message.nocCertificates) : undefined) + return obj + }, + + fromPartial(object: DeepPartial): QueryGetNocCertificatesResponse { + const message = { ...baseQueryGetNocCertificatesResponse } as QueryGetNocCertificatesResponse + if (object.nocCertificates !== undefined && object.nocCertificates !== null) { + message.nocCertificates = NocCertificates.fromPartial(object.nocCertificates) + } else { + message.nocCertificates = undefined + } + return message + } +} + +const baseQueryAllNocCertificatesRequest: object = {} + +export const QueryAllNocCertificatesRequest = { + encode(message: QueryAllNocCertificatesRequest, writer: Writer = Writer.create()): Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim() + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): QueryAllNocCertificatesRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseQueryAllNocCertificatesRequest } as QueryAllNocCertificatesRequest + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()) + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): QueryAllNocCertificatesRequest { + const message = { ...baseQueryAllNocCertificatesRequest } as QueryAllNocCertificatesRequest + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromJSON(object.pagination) + } else { + message.pagination = undefined + } + return message + }, + + toJSON(message: QueryAllNocCertificatesRequest): unknown { + const obj: any = {} + message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined) + return obj + }, + + fromPartial(object: DeepPartial): QueryAllNocCertificatesRequest { + const message = { ...baseQueryAllNocCertificatesRequest } as QueryAllNocCertificatesRequest + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination) + } else { + message.pagination = undefined + } + return message + } +} + +const baseQueryAllNocCertificatesResponse: object = {} + +export const QueryAllNocCertificatesResponse = { + encode(message: QueryAllNocCertificatesResponse, writer: Writer = Writer.create()): Writer { + for (const v of message.nocCertificates) { + NocCertificates.encode(v!, writer.uint32(10).fork()).ldelim() + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim() + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): QueryAllNocCertificatesResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseQueryAllNocCertificatesResponse } as QueryAllNocCertificatesResponse + message.nocCertificates = [] + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.nocCertificates.push(NocCertificates.decode(reader, reader.uint32())) + break + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()) + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): QueryAllNocCertificatesResponse { + const message = { ...baseQueryAllNocCertificatesResponse } as QueryAllNocCertificatesResponse + message.nocCertificates = [] + if (object.nocCertificates !== undefined && object.nocCertificates !== null) { + for (const e of object.nocCertificates) { + message.nocCertificates.push(NocCertificates.fromJSON(e)) + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromJSON(object.pagination) + } else { + message.pagination = undefined + } + return message + }, + + toJSON(message: QueryAllNocCertificatesResponse): unknown { + const obj: any = {} + if (message.nocCertificates) { + obj.nocCertificates = message.nocCertificates.map((e) => (e ? NocCertificates.toJSON(e) : undefined)) + } else { + obj.nocCertificates = [] + } + message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined) + return obj + }, + + fromPartial(object: DeepPartial): QueryAllNocCertificatesResponse { + const message = { ...baseQueryAllNocCertificatesResponse } as QueryAllNocCertificatesResponse + message.nocCertificates = [] + if (object.nocCertificates !== undefined && object.nocCertificates !== null) { + for (const e of object.nocCertificates) { + message.nocCertificates.push(NocCertificates.fromPartial(e)) + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination) + } else { + message.pagination = undefined + } + return message + } +} + /** Query defines the gRPC querier service. */ export interface Query { /** Queries a ApprovedCertificates by index. */ @@ -2657,6 +2919,10 @@ export interface Query { NocRootCertificates(request: QueryGetNocRootCertificatesRequest): Promise /** Queries a list of NocRootCertificates items. */ NocRootCertificatesAll(request: QueryAllNocRootCertificatesRequest): Promise + /** Queries a NocCertificates by index. */ + NocCertificates(request: QueryGetNocCertificatesRequest): Promise + /** Queries a list of NocCertificates items. */ + NocCertificatesAll(request: QueryAllNocCertificatesRequest): Promise } export class QueryClientImpl implements Query { @@ -2779,6 +3045,18 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Query', 'NocRootCertificatesAll', data) return promise.then((data) => QueryAllNocRootCertificatesResponse.decode(new Reader(data))) } + + NocCertificates(request: QueryGetNocCertificatesRequest): Promise { + const data = QueryGetNocCertificatesRequest.encode(request).finish() + const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Query', 'NocCertificates', data) + return promise.then((data) => QueryGetNocCertificatesResponse.decode(new Reader(data))) + } + + NocCertificatesAll(request: QueryAllNocCertificatesRequest): Promise { + const data = QueryAllNocCertificatesRequest.encode(request).finish() + const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Query', 'NocCertificatesAll', data) + return promise.then((data) => QueryAllNocCertificatesResponse.decode(new Reader(data))) + } } interface Rpc { diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts index 3eb776561..0c0fe02d0 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts @@ -143,6 +143,13 @@ export interface MsgRemoveX509Cert { export interface MsgRemoveX509CertResponse {} +export interface MsgAddNocX509Cert { + signer: string + cert: string +} + +export interface MsgAddNocX509CertResponse {} + const baseMsgProposeAddX509RootCert: object = { signer: '', cert: '', info: '', time: 0, vid: 0 } export const MsgProposeAddX509RootCert = { @@ -2412,6 +2419,116 @@ export const MsgRemoveX509CertResponse = { } } +const baseMsgAddNocX509Cert: object = { signer: '', cert: '' } + +export const MsgAddNocX509Cert = { + encode(message: MsgAddNocX509Cert, writer: Writer = Writer.create()): Writer { + if (message.signer !== '') { + writer.uint32(10).string(message.signer) + } + if (message.cert !== '') { + writer.uint32(18).string(message.cert) + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): MsgAddNocX509Cert { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseMsgAddNocX509Cert } as MsgAddNocX509Cert + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.signer = reader.string() + break + case 2: + message.cert = reader.string() + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): MsgAddNocX509Cert { + const message = { ...baseMsgAddNocX509Cert } as MsgAddNocX509Cert + if (object.signer !== undefined && object.signer !== null) { + message.signer = String(object.signer) + } else { + message.signer = '' + } + if (object.cert !== undefined && object.cert !== null) { + message.cert = String(object.cert) + } else { + message.cert = '' + } + return message + }, + + toJSON(message: MsgAddNocX509Cert): unknown { + const obj: any = {} + message.signer !== undefined && (obj.signer = message.signer) + message.cert !== undefined && (obj.cert = message.cert) + return obj + }, + + fromPartial(object: DeepPartial): MsgAddNocX509Cert { + const message = { ...baseMsgAddNocX509Cert } as MsgAddNocX509Cert + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer + } else { + message.signer = '' + } + if (object.cert !== undefined && object.cert !== null) { + message.cert = object.cert + } else { + message.cert = '' + } + return message + } +} + +const baseMsgAddNocX509CertResponse: object = {} + +export const MsgAddNocX509CertResponse = { + encode(_: MsgAddNocX509CertResponse, writer: Writer = Writer.create()): Writer { + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): MsgAddNocX509CertResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseMsgAddNocX509CertResponse } as MsgAddNocX509CertResponse + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(_: any): MsgAddNocX509CertResponse { + const message = { ...baseMsgAddNocX509CertResponse } as MsgAddNocX509CertResponse + return message + }, + + toJSON(_: MsgAddNocX509CertResponse): unknown { + const obj: any = {} + return obj + }, + + fromPartial(_: DeepPartial): MsgAddNocX509CertResponse { + const message = { ...baseMsgAddNocX509CertResponse } as MsgAddNocX509CertResponse + return message + } +} + /** Msg defines the Msg service. */ export interface Msg { ProposeAddX509RootCert(request: MsgProposeAddX509RootCert): Promise @@ -2426,9 +2543,9 @@ export interface Msg { DeletePkiRevocationDistributionPoint(request: MsgDeletePkiRevocationDistributionPoint): Promise AssignVid(request: MsgAssignVid): Promise AddNocX509RootCert(request: MsgAddNocX509RootCert): Promise - /** this line is used by starport scaffolding # proto/tx/rpc */ - /** this line is used by starport scaffolding # proto/tx/rpc */ RemoveX509Cert(request: MsgRemoveX509Cert): Promise + AddNocX509Cert(request: MsgAddNocX509Cert): Promise + /** this line is used by starport scaffolding # proto/tx/rpc */ } export class MsgClientImpl implements Msg { @@ -2513,6 +2630,12 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Msg', 'RemoveX509Cert', data) return promise.then((data) => MsgRemoveX509CertResponse.decode(new Reader(data))) } + + AddNocX509Cert(request: MsgAddNocX509Cert): Promise { + const data = MsgAddNocX509Cert.encode(request).finish() + const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Msg', 'AddNocX509Cert', data) + return promise.then((data) => MsgAddNocX509CertResponse.decode(new Reader(data))) + } } interface Rpc { diff --git a/x/pki/client/cli/query.go b/x/pki/client/cli/query.go index 95135537e..a94064d9e 100644 --- a/x/pki/client/cli/query.go +++ b/x/pki/client/cli/query.go @@ -41,6 +41,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdShowPkiRevocationDistributionPointsByIssuerSubjectKeyID()) cmd.AddCommand(CmdListNocRootCertificates()) cmd.AddCommand(CmdShowNocRootCertificates()) + cmd.AddCommand(CmdListNocCertificates()) + cmd.AddCommand(CmdShowNocCertificates()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/pki/client/cli/query_noc_certificates.go b/x/pki/client/cli/query_noc_certificates.go new file mode 100644 index 000000000..016c42738 --- /dev/null +++ b/x/pki/client/cli/query_noc_certificates.go @@ -0,0 +1,75 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func CmdListNocCertificates() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-noc-x509-certs", + Short: "Gets all NOC non-root certificates", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllNocCertificatesRequest{ + Pagination: pageReq, + } + + res, err := queryClient.NocCertificatesAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowNocCertificates() *cobra.Command { + var vid int32 + cmd := &cobra.Command{ + Use: "noc-x509-certs", + 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) + + var res types.NocCertificates + + return cli.QueryWithProof( + clientCtx, + pkitypes.StoreKey, + types.NocCertificatesKeyPrefix, + types.NocCertificatesKey(vid), + &res, + ) + }, + } + + cmd.Flags().Int32Var(&vid, FlagVid, 0, "Vendor ID (positive non-zero)") + flags.AddQueryFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(FlagVid) + + return cmd +} diff --git a/x/pki/client/cli/query_noc_certificates_test.go b/x/pki/client/cli/query_noc_certificates_test.go new file mode 100644 index 000000000..46f7dc7a1 --- /dev/null +++ b/x/pki/client/cli/query_noc_certificates_test.go @@ -0,0 +1,164 @@ +package cli_test + +// +// import ( +// "fmt" +// "strconv" +// "testing" +// +// "github.com/cosmos/cosmos-sdk/client/flags" +// clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" +// "github.com/stretchr/testify/require" +// tmcli "github.com/tendermint/tendermint/libs/cli" +// "google.golang.org/grpc/codes" +// "google.golang.org/grpc/status" +// +// "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/network" +// "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" +// pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" +// "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/client/cli" +// "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +//) +// +//// Prevent strconv unused error +// var _ = strconv.IntSize +// +// func networkWithNocCertificatesObjects(t *testing.T, n int) (*network.Network, []types.NocCertificates) { +// t.Helper() +// cfg := network.DefaultConfig() +// state := types.GenesisState{} +// require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[pkitypes.ModuleName], &state)) +// +// for i := 0; i < n; i++ { +// nocCertificates := types.NocCertificates{ +// Vid: int32(i), +// } +// nullify.Fill(&nocCertificates) +// state.NocCertificatesList = append(state.NocCertificatesList, nocCertificates) +// } +// buf, err := cfg.Codec.MarshalJSON(&state) +// require.NoError(t, err) +// cfg.GenesisState[pkitypes.ModuleName] = buf +// return network.New(t, cfg), state.NocCertificatesList +//} +// +// func TestShowNocCertificates(t *testing.T) { +// net, objs := networkWithNocCertificatesObjects(t, 2) +// +// ctx := net.Validators[0].ClientCtx +// common := []string{ +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// } +// for _, tc := range []struct { +// desc string +// idVid int32 +// +// args []string +// err error +// obj types.NocCertificates +// }{ +// { +// desc: "found", +// idVid: objs[0].Vid, +// +// args: common, +// obj: objs[0], +// }, +// { +// desc: "not found", +// idVid: 100000, +// +// args: common, +// err: status.Error(codes.InvalidArgument, "not found"), +// }, +// } { +// tc := tc +// t.Run(tc.desc, func(t *testing.T) { +// args := []string{ +// strconv.Itoa(int(tc.idVid)), +// } +// args = append(args, tc.args...) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowNocCertificates(), args) +// if tc.err != nil { +// stat, ok := status.FromError(tc.err) +// require.True(t, ok) +// require.ErrorIs(t, stat.Err(), tc.err) +// } else { +// require.NoError(t, err) +// var resp types.QueryGetNocCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.NotNil(t, resp.NocCertificates) +// require.Equal(t, +// nullify.Fill(&tc.obj), +// nullify.Fill(&resp.NocCertificates), +// ) +// } +// }) +// } +//} +// +// func TestListNocCertificates(t *testing.T) { +// net, objs := networkWithNocCertificatesObjects(t, 5) +// +// ctx := net.Validators[0].ClientCtx +// request := func(next []byte, offset, limit uint64, total bool) []string { +// args := []string{ +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// } +// if next == nil { +// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) +// } else { +// args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) +// } +// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) +// if total { +// args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) +// } +// return args +// } +// t.Run("ByOffset", func(t *testing.T) { +// step := 2 +// for i := 0; i < len(objs); i += step { +// args := request(nil, uint64(i), uint64(step), false) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListNocCertificates(), args) +// require.NoError(t, err) +// var resp types.QueryAllNocCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.LessOrEqual(t, len(resp.NocCertificates), step) +// require.Subset(t, +// nullify.Fill(objs), +// nullify.Fill(resp.NocCertificates), +// ) +// } +// }) +// t.Run("ByKey", func(t *testing.T) { +// step := 2 +// var next []byte +// for i := 0; i < len(objs); i += step { +// args := request(next, 0, uint64(step), false) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListNocCertificates(), args) +// require.NoError(t, err) +// var resp types.QueryAllNocCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.LessOrEqual(t, len(resp.NocCertificates), step) +// require.Subset(t, +// nullify.Fill(objs), +// nullify.Fill(resp.NocCertificates), +// ) +// next = resp.Pagination.NextKey +// } +// }) +// t.Run("Total", func(t *testing.T) { +// args := request(nil, 0, uint64(len(objs)), true) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListNocCertificates(), args) +// require.NoError(t, err) +// var resp types.QueryAllNocCertificatesResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.NoError(t, err) +// require.Equal(t, len(objs), int(resp.Pagination.Total)) +// require.ElementsMatch(t, +// nullify.Fill(objs), +// nullify.Fill(resp.NocCertificates), +// ) +// }) +//} diff --git a/x/pki/client/cli/tx.go b/x/pki/client/cli/tx.go index c0fdf7954..784e4bd01 100644 --- a/x/pki/client/cli/tx.go +++ b/x/pki/client/cli/tx.go @@ -35,6 +35,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdAssignVid()) cmd.AddCommand(CmdAddNocX509RootCert()) cmd.AddCommand(CmdRemoveX509Cert()) + cmd.AddCommand(CmdAddNocX509Cert()) // this line is used by starport scaffolding # 1 return 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 new file mode 100644 index 000000000..383413a73 --- /dev/null +++ b/x/pki/client/cli/tx_add_noc_x_509_cert.go @@ -0,0 +1,56 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/cli" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +var _ = strconv.Itoa(0) + +func CmdAddNocX509Cert() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-noc-x509-cert", + Short: "Adds NOC non-root certificate", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + cert, err := cli.ReadFromFile(viper.GetString(FlagCertificate)) + if err != nil { + return err + } + + msg := types.NewMsgAddNocX509Cert( + clientCtx.GetFromAddress().String(), + cert, + ) + // validate basic will be called in GenerateOrBroadcastTxCLI + err = tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + if cli.IsWriteInsteadReadRPCError(err) { + return clientCtx.PrintString(cli.LightClientProxyForWriteRequests) + } + + return err + }, + } + + cmd.Flags().StringP(FlagCertificate, FlagCertificateShortcut, "", + "PEM encoded certificate (string or path to file containing data)") + cli.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + _ = cmd.MarkFlagRequired(FlagCertificate) + + return cmd +} diff --git a/x/pki/genesis.go b/x/pki/genesis.go index 70304317a..5f6faf38b 100644 --- a/x/pki/genesis.go +++ b/x/pki/genesis.go @@ -65,6 +65,10 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.NocRootCertificatesList { k.SetNocRootCertificates(ctx, elem) } + // Set all the nocCertificates + for _, elem := range genState.NocCertificatesList { + k.SetNocCertificates(ctx, elem) + } // this line is used by starport scaffolding # genesis/module/init } @@ -94,6 +98,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList = k.GetAllPkiRevocationDistributionPointsByIssuerSubjectKeyID(ctx) genesis.ApprovedCertificatesBySubjectKeyIdList = k.GetAllApprovedCertificatesBySubjectKeyID(ctx) genesis.NocRootCertificatesList = k.GetAllNocRootCertificates(ctx) + genesis.NocCertificatesList = k.GetAllNocCertificates(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/pki/genesis_test.go b/x/pki/genesis_test.go index 2c22f37ac..a289a73b5 100644 --- a/x/pki/genesis_test.go +++ b/x/pki/genesis_test.go @@ -142,6 +142,14 @@ func TestGenesis(t *testing.T) { Vid: 1, }, }, + NocCertificatesList: []types.NocCertificates{ + { + Vid: 0, + }, + { + Vid: 1, + }, + }, // this line is used by starport scaffolding # genesis/test/state } @@ -164,5 +172,6 @@ func TestGenesis(t *testing.T) { require.ElementsMatch(t, genesisState.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList, got.PkiRevocationDistributionPointsByIssuerSubjectKeyIDList) require.ElementsMatch(t, genesisState.ApprovedCertificatesBySubjectKeyIdList, got.ApprovedCertificatesBySubjectKeyIdList) require.ElementsMatch(t, genesisState.NocRootCertificatesList, got.NocRootCertificatesList) + require.ElementsMatch(t, genesisState.NocCertificatesList, got.NocCertificatesList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/pki/handler.go b/x/pki/handler.go index 670a9308c..1d81f8fa7 100644 --- a/x/pki/handler.go +++ b/x/pki/handler.go @@ -70,6 +70,10 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgRemoveX509Cert: res, err := msgServer.RemoveX509Cert(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgAddNocX509Cert: + res, err := msgServer.AddNocX509Cert(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) // this line is used by starport scaffolding # 1 default: diff --git a/x/pki/handler_add_noc_cert_test.go b/x/pki/handler_add_noc_cert_test.go new file mode 100644 index 000000000..d83d667d0 --- /dev/null +++ b/x/pki/handler_add_noc_cert_test.go @@ -0,0 +1,410 @@ +package pki + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + + testconstants "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/constants" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + dclauthtypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/dclauth/types" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func TestHandler_AddNocX509Cert_SenderNotVendor(t *testing.T) { + setup := Setup(t) + + addNocX509Cert := types.NewMsgAddNocX509Cert(setup.Trustee1.String(), testconstants.NocCert1) + _, err := setup.Handler(setup.Ctx, addNocX509Cert) + + require.Error(t, err) + require.True(t, sdkerrors.ErrUnauthorized.Is(err)) +} + +func TestHandler_AddNocX509Cert_AddNew(t *testing.T) { + setup := Setup(t) + + accAddress := GenerateAccAddress() + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, vid) + + // add NOC root certificate + addNocRootCertificate(setup, accAddress, testconstants.NocRootCert1, vid) + + // add the new NOC certificate + nocX509Cert := types.NewMsgAddNocX509Cert(accAddress.String(), testconstants.NocCert1) + _, err := setup.Handler(setup.Ctx, nocX509Cert) + require.NoError(t, err) + + // query noc root certificate by Subject and SKID + approvedCertificate, err := querySingleApprovedCertificate(setup, testconstants.NocCert1Subject, testconstants.NocCert1SubjectKeyID) + require.NoError(t, err) + require.Equal(t, testconstants.NocCert1Subject, approvedCertificate.Subject) + require.Equal(t, testconstants.NocCert1SubjectKeyID, approvedCertificate.SubjectKeyId) + require.Equal(t, testconstants.NocCert1SerialNumber, approvedCertificate.SerialNumber) + + // query noc root certificate by SubjectKeyID + approvedCertificatesBySubjectKeyID, err := queryAllApprovedCertificatesBySubjectKeyID(setup, testconstants.NocCert1SubjectKeyID) + require.NoError(t, err) + require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID)) + require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID[0].Certs)) + require.Equal(t, testconstants.NocCert1SerialNumber, approvedCertificatesBySubjectKeyID[0].Certs[0].SerialNumber) + + // query noc root certificate by VID + nocRootCertificate, err := querySingleNocCertificate(setup, vid) + require.NoError(t, err) + require.Equal(t, testconstants.NocCert1SerialNumber, nocRootCertificate.SerialNumber) + + // check that child certificates of issuer contains certificate identifier + issuerChildren, _ := queryChildCertificates( + setup, testconstants.NocRootCert1Subject, testconstants.NocRootCert1SubjectKeyID) + require.Equal(t, 1, len(issuerChildren.CertIds)) + require.Equal(t, + &types.CertificateIdentifier{ + Subject: testconstants.NocCert1Subject, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + }, + issuerChildren.CertIds[0]) + + // check that unique certificate key registered + require.True(t, + setup.Keeper.IsUniqueCertificatePresent(setup.Ctx, testconstants.NocCert1Issuer, testconstants.NocCert1SerialNumber)) +} + +func TestHandler_AddNocX509Cert_Renew(t *testing.T) { + setup := Setup(t) + + accAddress := GenerateAccAddress() + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, testconstants.Vid) + + // add NOC root certificate + addNocRootCertificate(setup, accAddress, testconstants.NocRootCert1, vid) + + // Store the NOC certificate + newNocCertificate := types.NewNocCertificate( + testconstants.NocCert1, + testconstants.NocCert1Subject, + testconstants.NocCert1SubjectAsText, + testconstants.NocCert1SubjectKeyID, + testconstants.NocCert1SerialNumber, + testconstants.NocRootCert1Subject, + testconstants.NocRootCert1SubjectKeyID, + testconstants.NocRootCert1Subject, + testconstants.NocRootCert1SubjectKeyID, + accAddress.String(), + vid, + ) + newNocCertificate.SerialNumber = testconstants.TestSerialNumber + + setup.Keeper.AddApprovedCertificate(setup.Ctx, newNocCertificate) + setup.Keeper.AddApprovedCertificateBySubjectKeyID(setup.Ctx, newNocCertificate) + setup.Keeper.AddApprovedCertificateBySubject(setup.Ctx, newNocCertificate.Subject, newNocCertificate.SubjectKeyId) + setup.Keeper.AddNocCertificate(setup.Ctx, newNocCertificate) + uniqueCertificate := types.UniqueCertificate{ + Issuer: newNocCertificate.Issuer, + SerialNumber: newNocCertificate.SerialNumber, + Present: true, + } + 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[0]) + + // query noc certificate by Subject + approvedCertificatesBySubject, err := queryApprovedCertificatesBySubject(setup, newNocCertificate.Subject) + require.NoError(t, err) + require.Equal(t, 1, len(approvedCertificatesBySubject.SubjectKeyIds)) + + // query noc certificate by SKID + approvedCertificatesBySubjectKeyID, err := queryAllApprovedCertificatesBySubjectKeyID(setup, newNocCertificate.SubjectKeyId) + require.NoError(t, err) + require.Equal(t, 1, len(approvedCertificatesBySubjectKeyID)) + require.Equal(t, 2, len(approvedCertificatesBySubjectKeyID[0].Certs)) + require.Equal(t, testconstants.NocCert1Subject, approvedCertificatesBySubjectKeyID[0].Certs[0].Subject) + require.Equal(t, testconstants.NocCert1SubjectKeyID, approvedCertificatesBySubjectKeyID[0].Certs[0].SubjectKeyId) + require.Equal(t, vid, approvedCertificatesBySubjectKeyID[0].Certs[0].Vid) + + // query noc certificate by VID + nocCertificates, err := queryNocCertificates(setup, testconstants.Vid) + require.NoError(t, err) + require.Equal(t, len(nocCertificates.Certs), 2) + require.Equal(t, testconstants.NocCert1Subject, nocCertificates.Certs[0].Subject) + require.Equal(t, testconstants.NocCert1SubjectKeyID, nocCertificates.Certs[0].SubjectKeyId) + require.Equal(t, vid, nocCertificates.Certs[0].Vid) +} + +func TestHandler_AddNocX509Cert_Root_VID_Does_Not_Equal_To_AccountVID(t *testing.T) { + setup := Setup(t) + + accAddress := GenerateAccAddress() + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, vid) + + // add NOC root certificate + addNocRootCertificate(setup, accAddress, testconstants.NocRootCert1, vid) + + newAccAddress := GenerateAccAddress() + setup.AddAccount(newAccAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, 1111) + + // try to add NOC certificate + nocX509Cert := types.NewMsgAddNocX509Cert(newAccAddress.String(), testconstants.NocCert1) + _, err := setup.Handler(setup.Ctx, nocX509Cert) + require.Error(t, err) + require.True(t, pkitypes.ErrCertVidNotEqualAccountVid.Is(err)) +} + +func TestHandler_AddNocX509Cert_ForInvalidCertificate(t *testing.T) { + setup := Setup(t) + + accAddress := GenerateAccAddress() + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, vid) + + // add x509 certificate + addX509Cert := types.NewMsgAddNocX509Cert(accAddress.String(), testconstants.StubCertPem) + _, err := setup.Handler(setup.Ctx, addX509Cert) + require.Error(t, err) + require.True(t, pkitypes.ErrInvalidCertificate.Is(err)) +} + +func TestHandler_AddXNoc509Cert_ForNocRootCertificate(t *testing.T) { + setup := Setup(t) + + accAddress := GenerateAccAddress() + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, vid) + + // try to add root certificate x509 certificate + addX509Cert := types.NewMsgAddX509Cert(accAddress.String(), testconstants.NocRootCert1) + _, err := setup.Handler(setup.Ctx, addX509Cert) + require.Error(t, err) + require.True(t, pkitypes.ErrInappropriateCertificateType.Is(err)) +} + +func TestHandler_AddXNoc509Cert_ForRootNonNocCertificate(t *testing.T) { + setup := Setup(t) + + accAddress := GenerateAccAddress() + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, vid) + + // store root certificate + rootCertOptions := &rootCertOptions{ + pemCert: testconstants.RootCertWithVid, + info: testconstants.Info, + subject: testconstants.RootCertWithVidSubject, + subjectKeyID: testconstants.RootCertWithVidSubjectKeyID, + vid: testconstants.RootCertWithVidVid, + } + proposeAndApproveRootCertificate(setup, setup.Trustee1, rootCertOptions) + + // try to add root certificate x509 certificate + addX509Cert := types.NewMsgAddNocX509Cert(accAddress.String(), testconstants.IntermediateCertWithVid1) + _, err := setup.Handler(setup.Ctx, addX509Cert) + require.Error(t, err) + require.ErrorIs(t, err, pkitypes.ErrInappropriateCertificateType) +} + +func TestHandler_AddXNoc509Cert_WhenNocRootCertIsAbsent(t *testing.T) { + setup := Setup(t) + + accAddress := GenerateAccAddress() + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, vid) + + // add the new NOC certificate + addNocX509Cert := types.NewMsgAddNocX509Cert(accAddress.String(), testconstants.NocCert1) + _, err := setup.Handler(setup.Ctx, addNocX509Cert) + + require.ErrorIs(t, err, pkitypes.ErrInvalidCertificate) +} + +func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) { + accAddress := GenerateAccAddress() + + cases := []struct { + name string + existingCert *types.Certificate + nocCert string + err error + }{ + { + name: "Duplicate", + existingCert: &types.Certificate{ + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: testconstants.NocCert1SerialNumber, + IsRoot: false, + IsNoc: true, + Vid: testconstants.Vid, + }, + nocCert: testconstants.NocCert1, + err: pkitypes.ErrCertificateAlreadyExists, + }, + { + name: "ExistingIsRootCert", + existingCert: &types.Certificate{ + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: testconstants.NocRootCert1SerialNumber, + IsRoot: true, + IsNoc: true, + Vid: testconstants.Vid, + }, + nocCert: testconstants.NocCert1, + err: sdkerrors.ErrUnauthorized, + }, + { + name: "ExistingWithDifferentIssuer", + existingCert: &types.Certificate{ + Issuer: testconstants.RootIssuer, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + IsNoc: true, + Vid: testconstants.Vid, + }, + nocCert: testconstants.NocCert1, + err: sdkerrors.ErrUnauthorized, + }, + { + name: "ExistingWithDifferentAuthorityKeyId", + existingCert: &types.Certificate{ + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.RootSubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + IsNoc: true, + Vid: testconstants.Vid, + }, + nocCert: testconstants.NocCert1, + err: sdkerrors.ErrUnauthorized, + }, + { + name: "ExistingNotNocCert", + existingCert: &types.Certificate{ + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + IsNoc: false, + Vid: testconstants.Vid, + }, + nocCert: testconstants.NocCert1, + err: pkitypes.ErrInappropriateCertificateType, + }, + { + name: "ExistingCertWithDifferentVid", + existingCert: &types.Certificate{ + Issuer: testconstants.NocRootCert1Subject, + AuthorityKeyId: testconstants.NocRootCert1SubjectKeyID, + Subject: testconstants.NocCert1Subject, + SubjectAsText: testconstants.NocCert1SubjectAsText, + SubjectKeyId: testconstants.NocCert1SubjectKeyID, + SerialNumber: "1234", + IsRoot: false, + IsNoc: true, + Vid: testconstants.VendorID1, + }, + nocCert: testconstants.NocCert1, + err: pkitypes.ErrCertVidNotEqualAccountVid, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + setup := Setup(t) + vid := testconstants.Vid + setup.AddAccount(accAddress, []dclauthtypes.AccountRole{dclauthtypes.Vendor}, vid) + + // add NOC root certificate + addNocRootCertificate(setup, accAddress, testconstants.NocRootCert1, vid) + + // add the existing certificate + setup.Keeper.AddApprovedCertificate(setup.Ctx, *tc.existingCert) + uniqueCertificate := types.UniqueCertificate{ + Issuer: tc.existingCert.Issuer, + SerialNumber: tc.existingCert.SerialNumber, + Present: true, + } + setup.Keeper.SetUniqueCertificate(setup.Ctx, uniqueCertificate) + + addNocX509Cert := types.NewMsgAddNocX509Cert(accAddress.String(), tc.nocCert) + _, err := setup.Handler(setup.Ctx, addNocX509Cert) + require.ErrorIs(t, err, tc.err) + }) + } +} + +func addNocRootCertificate(setup *TestSetup, address sdk.AccAddress, pemCert string, vid int32) { //nolint:unparam + // add the new NOC root certificate + addNocX509RootCert := types.NewMsgAddNocX509RootCert(address.String(), pemCert) + _, err := setup.Handler(setup.Ctx, addNocX509RootCert) + require.NoError(setup.T, err) + + // check that noc certificate has been added + nocCerts, err := queryNocRootCertificates(setup, vid) + require.NoError(setup.T, err) + require.NotNil(setup.T, nocCerts) +} + +func querySingleNocCertificate( + setup *TestSetup, + vid int32, +) (*types.Certificate, error) { + certificates, err := queryNocCertificates(setup, vid) + if err != nil { + return nil, err + } + + if len(certificates.Certs) > 1 { + require.Fail(setup.T, "More than 1 certificate returned") + } + + return certificates.Certs[0], nil +} + +func queryNocCertificates( + setup *TestSetup, + vid int32, +) (*types.NocCertificates, error) { + // query certificate + req := &types.QueryGetNocCertificatesRequest{Vid: vid} + + resp, err := setup.Keeper.NocCertificates(setup.Wctx, req) + if err != nil { + require.Nil(setup.T, resp) + + return nil, err + } + + require.NotNil(setup.T, resp) + + return &resp.NocCertificates, nil +} diff --git a/x/pki/keeper/grpc_query_noc_certificates.go b/x/pki/keeper/grpc_query_noc_certificates.go new file mode 100644 index 000000000..973b3e279 --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_certificates.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func (k Keeper) NocCertificatesAll(c context.Context, req *types.QueryAllNocCertificatesRequest) (*types.QueryAllNocCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var nocCertificatess []types.NocCertificates + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + nocCertificatesStore := prefix.NewStore(store, pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + + pageRes, err := query.Paginate(nocCertificatesStore, req.Pagination, func(key []byte, value []byte) error { + var nocCertificates types.NocCertificates + if err := k.cdc.Unmarshal(value, &nocCertificates); err != nil { + return err + } + + nocCertificatess = append(nocCertificatess, nocCertificates) + + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllNocCertificatesResponse{NocCertificates: nocCertificatess, Pagination: pageRes}, nil +} + +func (k Keeper) NocCertificates(c context.Context, req *types.QueryGetNocCertificatesRequest) (*types.QueryGetNocCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetNocCertificates( + ctx, + req.Vid, + ) + if !found { + return nil, status.Error(codes.InvalidArgument, "not found") + } + + return &types.QueryGetNocCertificatesResponse{NocCertificates: val}, nil +} diff --git a/x/pki/keeper/grpc_query_noc_certificates_test.go b/x/pki/keeper/grpc_query_noc_certificates_test.go new file mode 100644 index 000000000..b6b079db2 --- /dev/null +++ b/x/pki/keeper/grpc_query_noc_certificates_test.go @@ -0,0 +1,126 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error. +var _ = strconv.IntSize + +func TestNocCertificatesQuerySingle(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNNocCertificates(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetNocCertificatesRequest + response *types.QueryGetNocCertificatesResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetNocCertificatesRequest{ + Vid: msgs[0].Vid, + }, + response: &types.QueryGetNocCertificatesResponse{NocCertificates: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetNocCertificatesRequest{ + Vid: msgs[1].Vid, + }, + response: &types.QueryGetNocCertificatesResponse{NocCertificates: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetNocCertificatesRequest{ + Vid: 100000, + }, + err: status.Error(codes.InvalidArgument, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.NocCertificates(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestNocCertificatesQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNNocCertificates(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllNocCertificatesRequest { + return &types.QueryAllNocCertificatesRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.NocCertificatesAll(wctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.NocCertificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.NocCertificates), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.NocCertificatesAll(wctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.NocCertificates), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.NocCertificates), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.NocCertificatesAll(wctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.NocCertificates), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.NocCertificatesAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/pki/keeper/msg_server_add_noc_x_509_cert.go b/x/pki/keeper/msg_server_add_noc_x_509_cert.go new file mode 100644 index 000000000..f65162376 --- /dev/null +++ b/x/pki/keeper/msg_server_add_noc_x_509_cert.go @@ -0,0 +1,135 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + dclauthtypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/dclauth/types" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/x509" +) + +func (k msgServer) AddNocX509Cert(goCtx context.Context, msg *types.MsgAddNocX509Cert) (*types.MsgAddNocX509CertResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + signerAddr, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, pkitypes.NewErrInvalidAddress(err) + } + + // check if signer has vendor role + if !k.dclauthKeeper.HasRole(ctx, signerAddr, dclauthtypes.Vendor) { + return nil, pkitypes.NewErrUnauthorizedRole("MsgAddNocX509Cert", dclauthtypes.Vendor) + } + + // decode pem certificate + x509Certificate, err := x509.DecodeX509Certificate(msg.Cert) + if err != nil { + return nil, pkitypes.NewErrInvalidCertificate(err) + } + + // fail if certificate is self-signed + if x509Certificate.IsSelfSigned() { + return nil, pkitypes.NewErrNonRootCertificateSelfSigned() + } + + // check if certificate with Issuer/Serial Number combination already exists + if k.IsUniqueCertificatePresent(ctx, x509Certificate.Issuer, x509Certificate.SerialNumber) { + return nil, pkitypes.NewErrCertificateAlreadyExists(x509Certificate.Issuer, x509Certificate.SerialNumber) + } + signerAccount, _ := k.dclauthKeeper.GetAccountO(ctx, signerAddr) + accountVid := signerAccount.VendorID + + // Get list of certificates for Subject / Subject Key Id combination + certificates, _ := k.GetApprovedCertificates(ctx, x509Certificate.Subject, x509Certificate.SubjectKeyID) + if len(certificates.Certs) > 0 { + existingCertificate := certificates.Certs[0] + + // Issuer and authorityKeyID must be the same as ones of existing certificates with the same subject and + // subjectKeyID. Since new certificate is not self-signed, we have to ensure that the existing certificates + // are not self-signed too, consequently are non-root certificates, before to match issuer and authorityKeyID. + if existingCertificate.IsRoot || x509Certificate.Issuer != existingCertificate.Issuer || + x509Certificate.AuthorityKeyID != certificates.Certs[0].AuthorityKeyId { + return nil, pkitypes.NewErrUnauthorizedCertIssuer(x509Certificate.Subject, x509Certificate.SubjectKeyID) + } + + // Existing certificate must be NOC certificate + if !existingCertificate.IsNoc { + return nil, pkitypes.NewErrProvidedNocCertButExistingNotNoc(x509Certificate.Subject, x509Certificate.SubjectKeyID) + } + + // signer VID must be same as VID of existing certificates + if accountVid != existingCertificate.Vid { + return nil, pkitypes.NewErrExistingCertVidNotEqualAccountVid( + x509Certificate.Subject, + x509Certificate.SubjectKeyID, + existingCertificate.Vid, + ) + } + } + // Valid certificate chain must be built for new certificate + rootCert, err := k.verifyCertificate(ctx, x509Certificate) + if err != nil { + return nil, err + } + // Check Root and Intermediate certs for VID scoping + rootCerts, _ := k.GetApprovedCertificates(ctx, rootCert.Subject, rootCert.SubjectKeyID) + if len(rootCerts.Certs) == 0 { + return nil, pkitypes.NewErrRootCertificateDoesNotExist(rootCert.Subject, rootCert.SubjectKeyID) + } + nocRootCert := rootCerts.Certs[0] + // Root certificate must be NOC certificate + if !nocRootCert.IsNoc { + return nil, pkitypes.NewErrRootOfNocCertIsNotNoc(rootCert.Subject, rootCert.SubjectKeyID) + } + // Check VID scoping + if nocRootCert.Vid != accountVid { + return nil, pkitypes.NewErrAccountVidNotEqualToCertVid(accountVid, nocRootCert.Vid) + } + + // create new certificate + certificate := types.NewNocCertificate( + msg.Cert, + x509Certificate.Subject, + x509Certificate.SubjectAsText, + x509Certificate.SubjectKeyID, + x509Certificate.SerialNumber, + x509Certificate.Issuer, + x509Certificate.AuthorityKeyID, + rootCert.Subject, + rootCert.SubjectKeyID, + msg.Signer, + accountVid, + ) + + // Add a NOC certificate to the list of NOC certificates with the same VID + k.AddNocCertificate(ctx, certificate) + + // append new certificate to list of certificates with the same Subject/SubjectKeyId combination and store updated list + k.AddApprovedCertificate(ctx, certificate) + + // add the certificate identifier to the issuer's Child Certificates record + certificateIdentifier := types.CertificateIdentifier{ + Subject: certificate.Subject, + SubjectKeyId: certificate.SubjectKeyId, + } + k.AddChildCertificate(ctx, certificate.Issuer, certificate.AuthorityKeyId, certificateIdentifier) + + // register the unique certificate key + uniqueCertificate := types.UniqueCertificate{ + Issuer: x509Certificate.Issuer, + SerialNumber: x509Certificate.SerialNumber, + Present: true, + } + k.SetUniqueCertificate(ctx, uniqueCertificate) + + // add to subject -> subject key ID map + k.AddApprovedCertificateBySubject(ctx, certificate.Subject, certificate.SubjectKeyId) + + // add to subject key ID -> certificates map + k.AddApprovedCertificateBySubjectKeyID(ctx, certificate) + + return &types.MsgAddNocX509CertResponse{}, nil +} diff --git a/x/pki/keeper/noc_certificates.go b/x/pki/keeper/noc_certificates.go new file mode 100644 index 000000000..537dc90fa --- /dev/null +++ b/x/pki/keeper/noc_certificates.go @@ -0,0 +1,88 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// SetNocCertificates set a specific nocCertificates in the store from its index. +func (k Keeper) SetNocCertificates(ctx sdk.Context, nocCertificates types.NocCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + b := k.cdc.MustMarshal(&nocCertificates) + store.Set(types.NocCertificatesKey( + nocCertificates.Vid, + ), b) +} + +// GetNocCertificates returns a nocCertificates from its index. +func (k Keeper) GetNocCertificates( + ctx sdk.Context, + vid int32, + +) (val types.NocCertificates, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + + b := store.Get(types.NocCertificatesKey( + vid, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + + return val, true +} + +// AddNocCertificate adds a NOC certificate to the list of NOC certificates for the VID map. +func (k Keeper) AddNocCertificate(ctx sdk.Context, nocCertificate types.Certificate) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + + nocCertificatesBytes := store.Get(types.NocCertificatesKey(nocCertificate.Vid)) + var nocCertificates types.NocCertificates + + if nocCertificatesBytes == nil { + nocCertificates = types.NocCertificates{ + Vid: nocCertificate.Vid, + Certs: []*types.Certificate{}, + } + } else { + k.cdc.MustUnmarshal(nocCertificatesBytes, &nocCertificates) + } + + nocCertificates.Certs = append(nocCertificates.Certs, &nocCertificate) + + b := k.cdc.MustMarshal(&nocCertificates) + store.Set(types.NocCertificatesKey(nocCertificate.Vid), b) +} + +// RemoveNocCertificates removes a nocCertificates from the store. +func (k Keeper) RemoveNocCertificates( + ctx sdk.Context, + vid int32, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + store.Delete(types.NocCertificatesKey( + vid, + )) +} + +// GetAllNocCertificates returns all nocCertificates. +func (k Keeper) GetAllNocCertificates(ctx sdk.Context) (list []types.NocCertificates) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocCertificatesKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.NocCertificates + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/pki/keeper/noc_certificates_test.go b/x/pki/keeper/noc_certificates_test.go new file mode 100644 index 000000000..6b25c78d5 --- /dev/null +++ b/x/pki/keeper/noc_certificates_test.go @@ -0,0 +1,65 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/nullify" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +// Prevent strconv unused error. +var _ = strconv.IntSize + +func createNNocCertificates(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.NocCertificates { + items := make([]types.NocCertificates, n) + for i := range items { + items[i].Vid = int32(i) + + keeper.SetNocCertificates(ctx, items[i]) + } + + return items +} + +func TestNocCertificatesGet(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificates(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetNocCertificates(ctx, + item.Vid, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestNocCertificatesRemove(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificates(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveNocCertificates(ctx, + item.Vid, + ) + _, found := keeper.GetNocCertificates(ctx, + item.Vid, + ) + require.False(t, found) + } +} + +func TestNocCertificatesGetAll(t *testing.T) { + keeper, ctx := keepertest.PkiKeeper(t, nil) + items := createNNocCertificates(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllNocCertificates(ctx)), + ) +} diff --git a/x/pki/module_simulation.go b/x/pki/module_simulation.go index 8f74ebeb2..597d872fb 100644 --- a/x/pki/module_simulation.go +++ b/x/pki/module_simulation.go @@ -77,6 +77,10 @@ const ( // TODO: Determine the simulation weight value. defaultWeightMsgRemoveX509Cert int = 100 + opWeightMsgAddNocX509Cert = "op_weight_msg_create_chain" + // TODO: Determine the simulation weight value. + defaultWeightMsgAddNocX509Cert int = 100 + // this line is used by starport scaffolding # simapp/module/const. ) @@ -253,6 +257,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp pkisimulation.SimulateMsgRemoveX509Cert(am.keeper), )) + var weightMsgAddNocX509Cert int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgAddNocX509Cert, &weightMsgAddNocX509Cert, nil, + func(_ *rand.Rand) { + weightMsgAddNocX509Cert = defaultWeightMsgAddNocX509Cert + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgAddNocX509Cert, + pkisimulation.SimulateMsgAddNocX509Cert(am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations diff --git a/x/pki/simulation/add_noc_x_509_cert.go b/x/pki/simulation/add_noc_x_509_cert.go new file mode 100644 index 000000000..b43025776 --- /dev/null +++ b/x/pki/simulation/add_noc_x_509_cert.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func SimulateMsgAddNocX509Cert( + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgAddNocX509Cert{ + Signer: simAccount.Address.String(), + } + + // TODO: Handling the AddNocX509Cert simulation + + return simtypes.NoOpMsg(pkitypes.ModuleName, msg.Type(), "AddNocX509Cert simulation not implemented"), nil, nil + } +} diff --git a/x/pki/types/certificate.go b/x/pki/types/certificate.go index 345c40f52..2685aa849 100644 --- a/x/pki/types/certificate.go +++ b/x/pki/types/certificate.go @@ -59,6 +59,36 @@ func NewNocRootCertificate( } } +func NewNocCertificate( + pemCert string, + subject string, + subjectAsText string, + subjectKeyID string, + serialNumber string, + issuer string, + authorityKeyID string, + rootSubject string, + rootSubjectKeyID string, + owner string, + vid int32, +) Certificate { + return Certificate{ + PemCert: pemCert, + Subject: subject, + SubjectAsText: subjectAsText, + SubjectKeyId: subjectKeyID, + SerialNumber: serialNumber, + Issuer: issuer, + AuthorityKeyId: authorityKeyID, + RootSubject: rootSubject, + RootSubjectKeyId: rootSubjectKeyID, + Vid: vid, + Owner: owner, + IsRoot: false, + IsNoc: true, + } +} + func (cert ProposedCertificate) HasApprovalFrom(address string) bool { for _, approval := range cert.Approvals { if approval.Address == address { diff --git a/x/pki/types/codec.go b/x/pki/types/codec.go index 9da20736c..b2b1a2565 100644 --- a/x/pki/types/codec.go +++ b/x/pki/types/codec.go @@ -21,6 +21,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgAssignVid{}, "pki/AssignVid", nil) cdc.RegisterConcrete(&MsgAddNocX509RootCert{}, "pki/AddNocX509RootCert", nil) cdc.RegisterConcrete(&MsgRemoveX509Cert{}, "pki/RemoveX509Cert", nil) + cdc.RegisterConcrete(&MsgAddNocX509Cert{}, "pki/AddNocX509Cert", nil) // this line is used by starport scaffolding # 2 } @@ -64,6 +65,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgRemoveX509Cert{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgAddNocX509Cert{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/pki/types/genesis.go b/x/pki/types/genesis.go index 5b8544d14..ad82a50c3 100644 --- a/x/pki/types/genesis.go +++ b/x/pki/types/genesis.go @@ -24,6 +24,7 @@ func DefaultGenesis() *GenesisState { PkiRevocationDistributionPointsByIssuerSubjectKeyIDList: []PkiRevocationDistributionPointsByIssuerSubjectKeyID{}, ApprovedCertificatesBySubjectKeyIdList: []ApprovedCertificatesBySubjectKeyId{}, NocRootCertificatesList: []NocRootCertificates{}, + NocCertificatesList: []NocCertificates{}, // this line is used by starport scaffolding # genesis/types/default } } @@ -153,6 +154,16 @@ func (gs GenesisState) Validate() error { } nocRootCertificatesIndexMap[index] = struct{}{} } + // Check for duplicated index in nocCertificates + nocCertificatesIndexMap := make(map[string]struct{}) + + for _, elem := range gs.NocCertificatesList { + index := string(NocCertificatesKey(elem.Vid)) + if _, ok := nocCertificatesIndexMap[index]; ok { + return fmt.Errorf("duplicated index for nocCertificates") + } + nocCertificatesIndexMap[index] = struct{}{} + } // this line is used by starport scaffolding # genesis/types/validate return nil diff --git a/x/pki/types/genesis.pb.go b/x/pki/types/genesis.pb.go index 9c71ff0ff..5d5a2b2ed 100644 --- a/x/pki/types/genesis.pb.go +++ b/x/pki/types/genesis.pb.go @@ -39,6 +39,7 @@ type GenesisState struct { PkiRevocationDistributionPointsByIssuerSubjectKeyIDList []PkiRevocationDistributionPointsByIssuerSubjectKeyID `protobuf:"bytes,12,rep,name=PkiRevocationDistributionPointsByIssuerSubjectKeyIDList,proto3" json:"PkiRevocationDistributionPointsByIssuerSubjectKeyIDList"` ApprovedCertificatesBySubjectKeyIdList []ApprovedCertificatesBySubjectKeyId `protobuf:"bytes,13,rep,name=approvedCertificatesBySubjectKeyIdList,proto3" json:"approvedCertificatesBySubjectKeyIdList"` NocRootCertificatesList []NocRootCertificates `protobuf:"bytes,14,rep,name=nocRootCertificatesList,proto3" json:"nocRootCertificatesList"` + NocCertificatesList []NocCertificates `protobuf:"bytes,15,rep,name=nocCertificatesList,proto3" json:"nocCertificatesList"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -172,6 +173,13 @@ func (m *GenesisState) GetNocRootCertificatesList() []NocRootCertificates { return nil } +func (m *GenesisState) GetNocCertificatesList() []NocCertificates { + if m != nil { + return m.NocCertificatesList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "zigbeealliance.distributedcomplianceledger.pki.GenesisState") } @@ -179,51 +187,52 @@ func init() { func init() { proto.RegisterFile("pki/genesis.proto", fileDescriptor_9478608499b59120) } var fileDescriptor_9478608499b59120 = []byte{ - // 694 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x6f, 0x94, 0x40, - 0x18, 0xc6, 0x17, 0x5b, 0xab, 0xd2, 0x6a, 0x94, 0x68, 0x6c, 0x1a, 0x43, 0x6b, 0x35, 0xa6, 0x6a, - 0x16, 0x62, 0x3d, 0x78, 0xde, 0x3f, 0xa6, 0x36, 0x6a, 0xb3, 0xa1, 0xf1, 0xe2, 0x41, 0xc2, 0x9f, - 0x91, 0x8e, 0x6c, 0x19, 0x84, 0xa1, 0x11, 0x13, 0x0f, 0x46, 0xe3, 0xd9, 0xaf, 0x60, 0xe2, 0x07, - 0xf0, 0x23, 0x78, 0xec, 0xb1, 0x47, 0x4f, 0xc6, 0xec, 0x7e, 0x11, 0xc3, 0xcb, 0xd0, 0x65, 0x61, - 0xd8, 0xee, 0x92, 0xbd, 0xed, 0x0e, 0xc3, 0xf3, 0xfc, 0xe6, 0x7d, 0x9f, 0x17, 0x10, 0xaf, 0xf9, - 0x2e, 0x56, 0x1d, 0xe4, 0xa1, 0x10, 0x87, 0x8a, 0x1f, 0x10, 0x4a, 0x24, 0xe5, 0x23, 0x76, 0x4c, - 0x84, 0x8c, 0x7e, 0x1f, 0x1b, 0x9e, 0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e, 0x48, 0x3e, 0xa2, 0x54, 0x1a, - 0xfb, 0x28, 0x34, 0x97, 0xe0, 0x4b, 0xe5, 0xf1, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x64, 0x28, - 0x56, 0x20, 0x2b, 0x0b, 0x00, 0x00, + // 716 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xc1, 0x4e, 0xd4, 0x40, + 0x18, 0xc7, 0xb7, 0x82, 0xa8, 0x05, 0x35, 0x54, 0x8d, 0x84, 0x98, 0x82, 0x68, 0x0c, 0x6a, 0x68, + 0x23, 0x1e, 0x3c, 0x1a, 0x96, 0x35, 0x48, 0x54, 0x42, 0x4a, 0xbc, 0x78, 0xb0, 0x69, 0xa7, 0x63, + 0x19, 0xbb, 0x74, 0x6a, 0x3b, 0x45, 0x6b, 0xe2, 0xc1, 0x68, 0x3c, 0xfb, 0x0a, 0x26, 0x3e, 0x80, + 0x57, 0xdf, 0x80, 0x23, 0x47, 0x4f, 0xc6, 0xb0, 0x2f, 0x62, 0xfa, 0x75, 0xca, 0x76, 0xdb, 0xe9, + 0xb2, 0xdb, 0x70, 0xdb, 0x9d, 0x99, 0xfe, 0xff, 0xbf, 0x99, 0xef, 0xff, 0x75, 0x2a, 0xcf, 0x06, + 0x1e, 0xd1, 0x5d, 0xec, 0xe3, 0x88, 0x44, 0x5a, 0x10, 0x52, 0x46, 0x15, 0xed, 0x23, 0x71, 0x6d, + 0x8c, 0xad, 0x6e, 0x97, 0x58, 0x3e, 0xc2, 0x9a, 0x43, 0x22, 0x16, 0x12, 0x3b, 0x66, 0xd8, 0x41, + 0x74, 0x2f, 0xc8, 0x46, 0xbb, 0xd8, 0x71, 0x71, 0xa8, 0x05, 0x1e, 0x99, 0x5f, 0x48, 0x25, 0xac, + 0x20, 0x08, 0xe9, 0x3e, 0x76, 0x4c, 0x84, 0x43, 0x46, 0xde, 0x10,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 0x5d, 0x68, 0x19, 0xb5, 0x5e, 0xca, 0x17, 0x49, 0xbe, 0x9e, 0x47, 0xb2, 0x30, 0x09, 0x1c, + 0x67, 0x80, 0x63, 0x7d, 0x5c, 0x8e, 0xed, 0xaa, 0x1c, 0xc7, 0xa8, 0x73, 0x52, 0x3e, 0xc9, 0xd7, + 0xa0, 0x6b, 0x2a, 0x47, 0x31, 0x01, 0x08, 0x6b, 0xe3, 0x22, 0xac, 0x97, 0xc5, 0x38, 0x80, 0xd8, + 0x45, 0xf9, 0x21, 0xc9, 0x37, 0x05, 0x68, 0xc6, 0x71, 0xf2, 0x80, 0x65, 0x12, 0x58, 0x5e, 0x9c, + 0xc2, 0x71, 0xf4, 0x85, 0x39, 0xd7, 0xc9, 0xee, 0x50, 0x28, 0xde, 0xac, 0x95, 0x53, 0x3a, 0xdb, + 0xac, 0x50, 0x46, 0x55, 0x2e, 0x2f, 0x54, 0x8d, 0x53, 0x5a, 0xa8, 0xec, 0xad, 0x53, 0xce, 0xca, + 0x54, 0xb3, 0x42, 0xbd, 0x2c, 0x8b, 0xe5, 0x85, 0x12, 0xba, 0x28, 0x5f, 0x0b, 0x6d, 0x63, 0x50, + 0xca, 0x8a, 0x7c, 0x73, 0xe7, 0x16, 0xa5, 0xe5, 0xe9, 0xd5, 0xa7, 0x4d, 0xdb, 0xa6, 0xac, 0x67, + 0xd4, 0x3a, 0x29, 0x9f, 0xfb, 0xb5, 0xa8, 0x50, 0x9c, 0x07, 0x8a, 0x8d, 0x86, 0xb5, 0xa8, 0x40, + 0xd4, 0xf9, 0x40, 0x66, 0x45, 0x5d, 0xdd, 0x4e, 0x76, 0xb2, 0x97, 0x1a, 0x94, 0xe5, 0x42, 0xb3, + 0xcc, 0xae, 0x0d, 0x13, 0xce, 0x33, 0x7b, 0xa2, 0x3b, 0xcf, 0x6c, 0x76, 0x1f, 0x94, 0x03, 0x23, + 0x37, 0xcd, 0x6c, 0x45, 0xae, 0x9f, 0x59, 0xa1, 0x93, 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x7a, 0xf8, 0x3f, + 0x00, 0x00, 0xff, 0xff, 0x8b, 0x38, 0xe6, 0xff, 0xc0, 0x0b, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -246,6 +255,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NocCertificatesList) > 0 { + for iNdEx := len(m.NocCertificatesList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NocCertificatesList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a + } + } if len(m.NocRootCertificatesList) > 0 { for iNdEx := len(m.NocRootCertificatesList) - 1; iNdEx >= 0; iNdEx-- { { @@ -538,6 +561,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.NocCertificatesList) > 0 { + for _, e := range m.NocCertificatesList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -1056,6 +1085,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificatesList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NocCertificatesList = append(m.NocCertificatesList, NocCertificates{}) + if err := m.NocCertificatesList[len(m.NocCertificatesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/pki/types/genesis_test.go b/x/pki/types/genesis_test.go index fade8750e..94e6bb9a9 100644 --- a/x/pki/types/genesis_test.go +++ b/x/pki/types/genesis_test.go @@ -134,6 +134,14 @@ NocRootCertificatesList: []types.NocRootCertificates{ Vid: 1, }, }, +NocCertificatesList: []types.NocCertificates{ + { + Vid: 0, +}, + { + Vid: 1, +}, +}, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, @@ -310,6 +318,20 @@ IssuerSubjectKeyID: "0", }, valid: false, }, +{ + desc: "duplicated nocCertificates", + genState: &types.GenesisState{ + NocCertificatesList: []types.NocCertificates{ + { + Vid: 0, +}, + { + Vid: 0, +}, + }, + }, + valid: false, +}, // this line is used by starport scaffolding # types/genesis/testcase } { t.Run(tc.desc, func(t *testing.T) { diff --git a/x/pki/types/key_noc_certificates.go b/x/pki/types/key_noc_certificates.go new file mode 100644 index 000000000..6a040db1b --- /dev/null +++ b/x/pki/types/key_noc_certificates.go @@ -0,0 +1,24 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // NocCertificatesKeyPrefix is the prefix to retrieve all NocCertificates. + NocCertificatesKeyPrefix = "NocCertificates/value/" +) + +// NocCertificatesKey returns the store key to retrieve a NocCertificates from the index fields. +func NocCertificatesKey( + vid int32, +) []byte { + var key []byte + + vidBytes := make([]byte, 8) + binary.BigEndian.PutUint32(vidBytes, uint32(vid)) + key = append(key, vidBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/pki/types/message_add_noc_x_509_cert.go b/x/pki/types/message_add_noc_x_509_cert.go new file mode 100644 index 000000000..17a3374b3 --- /dev/null +++ b/x/pki/types/message_add_noc_x_509_cert.go @@ -0,0 +1,62 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/validator" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/x509" +) + +const TypeMsgAddNocX509Cert = "add_noc_x_509_cert" + +var _ sdk.Msg = &MsgAddNocX509Cert{} + +func NewMsgAddNocX509Cert(signer string, cert string) *MsgAddNocX509Cert { + return &MsgAddNocX509Cert{ + Signer: signer, + Cert: cert, + } +} + +func (msg *MsgAddNocX509Cert) Route() string { + return pkitypes.RouterKey +} + +func (msg *MsgAddNocX509Cert) Type() string { + return TypeMsgAddNocX509Cert +} + +func (msg *MsgAddNocX509Cert) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{signer} +} + +func (msg *MsgAddNocX509Cert) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + + return sdk.MustSortJSON(bz) +} + +func (msg *MsgAddNocX509Cert) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid signer address (%s)", err) + } + + err = validator.Validate(msg) + if err != nil { + return err + } + + _, err = x509.DecodeX509Certificate(msg.Cert) + if err != nil { + return pkitypes.NewErrInvalidCertificate(err) + } + + return nil +} diff --git a/x/pki/types/message_add_noc_x_509_cert_test.go b/x/pki/types/message_add_noc_x_509_cert_test.go new file mode 100644 index 000000000..24c732283 --- /dev/null +++ b/x/pki/types/message_add_noc_x_509_cert_test.go @@ -0,0 +1,81 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + tmrand "github.com/tendermint/tendermint/libs/rand" + + testconstants "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/constants" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/sample" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/validator" +) + +func TestMsgAddNocX509Cert_ValidateBasic(t *testing.T) { + negativeTests := []struct { + name string + msg MsgAddNocX509Cert + err error + }{ + { + name: "invalid address", + msg: MsgAddNocX509Cert{ + Signer: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "empty certificate", + msg: MsgAddNocX509Cert{ + Signer: sample.AccAddress(), + Cert: "", + }, + err: validator.ErrRequiredFieldMissing, + }, + { + name: "invalid certificate", + msg: MsgAddNocX509Cert{ + Signer: sample.AccAddress(), + Cert: testconstants.StubCertPem, + }, + err: pkitypes.ErrInvalidCertificate, + }, + { + name: "cert len > 10485760", + msg: MsgAddNocX509Cert{ + Signer: sample.AccAddress(), + Cert: tmrand.Str(10485761), + }, + err: validator.ErrFieldMaxLengthExceeded, + }, + } + positiveTests := []struct { + name string + msg MsgAddNocX509Cert + }{ + { + name: "valid add NOC cert msg", + msg: MsgAddNocX509Cert{ + Signer: sample.AccAddress(), + Cert: testconstants.NocCert1, + }, + }, + } + + for _, tt := range negativeTests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + require.Error(t, err) + require.ErrorIs(t, err, tt.err) + }) + } + + for _, tt := range positiveTests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + require.NoError(t, err) + }) + } +} diff --git a/x/pki/types/noc_certificates.pb.go b/x/pki/types/noc_certificates.pb.go new file mode 100644 index 000000000..077ce52ae --- /dev/null +++ b/x/pki/types/noc_certificates.pb.go @@ -0,0 +1,368 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pki/noc_certificates.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type NocCertificates struct { + Vid int32 `protobuf:"varint,1,opt,name=vid,proto3" json:"vid,omitempty" validate:"gte=1,lte=65535"` + Certs []*Certificate `protobuf:"bytes,2,rep,name=certs,proto3" json:"certs,omitempty"` +} + +func (m *NocCertificates) Reset() { *m = NocCertificates{} } +func (m *NocCertificates) String() string { return proto.CompactTextString(m) } +func (*NocCertificates) ProtoMessage() {} +func (*NocCertificates) Descriptor() ([]byte, []int) { + return fileDescriptor_2f1a28e414592a80, []int{0} +} +func (m *NocCertificates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NocCertificates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NocCertificates.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NocCertificates) XXX_Merge(src proto.Message) { + xxx_messageInfo_NocCertificates.Merge(m, src) +} +func (m *NocCertificates) XXX_Size() int { + return m.Size() +} +func (m *NocCertificates) XXX_DiscardUnknown() { + xxx_messageInfo_NocCertificates.DiscardUnknown(m) +} + +var xxx_messageInfo_NocCertificates proto.InternalMessageInfo + +func (m *NocCertificates) GetVid() int32 { + if m != nil { + return m.Vid + } + return 0 +} + +func (m *NocCertificates) GetCerts() []*Certificate { + if m != nil { + return m.Certs + } + return nil +} + +func init() { + proto.RegisterType((*NocCertificates)(nil), "zigbeealliance.distributedcomplianceledger.pki.NocCertificates") +} + +func init() { proto.RegisterFile("pki/noc_certificates.proto", fileDescriptor_2f1a28e414592a80) } + +var fileDescriptor_2f1a28e414592a80 = []byte{ + // 272 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0xc8, 0xce, 0xd4, + 0xcf, 0xcb, 0x4f, 0x8e,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 0x8f, 0xe5, 0x18, 0x2e, 0x3c, + 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x25, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, + 0x39, 0x3f, 0x57, 0x1f, 0x62, 0x8f, 0x2e, 0xcc, 0x22, 0x7d, 0x24, 0x8b, 0x74, 0x11, 0x36, 0xe9, + 0x42, 0xac, 0xd2, 0xaf, 0xd0, 0x07, 0x05, 0x42, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, + 0xff, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x71, 0xba, 0xf6, 0x7a, 0x01, 0x00, 0x00, +} + +func (m *NocCertificates) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NocCertificates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NocCertificates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Certs) > 0 { + for iNdEx := len(m.Certs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNocCertificates(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Vid != 0 { + i = encodeVarintNocCertificates(dAtA, i, uint64(m.Vid)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintNocCertificates(dAtA []byte, offset int, v uint64) int { + offset -= sovNocCertificates(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NocCertificates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vid != 0 { + n += 1 + sovNocCertificates(uint64(m.Vid)) + } + if len(m.Certs) > 0 { + for _, e := range m.Certs { + l = e.Size() + n += 1 + l + sovNocCertificates(uint64(l)) + } + } + return n +} + +func sovNocCertificates(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNocCertificates(x uint64) (n int) { + return sovNocCertificates(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NocCertificates) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NocCertificates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NocCertificates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) + } + m.Vid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Vid |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNocCertificates + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNocCertificates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certs = append(m.Certs, &Certificate{}) + if err := m.Certs[len(m.Certs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNocCertificates(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNocCertificates + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNocCertificates(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNocCertificates + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNocCertificates + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNocCertificates + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNocCertificates + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNocCertificates = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNocCertificates = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNocCertificates = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pki/types/query.pb.go b/x/pki/types/query.pb.go index ec89b02de..1eed670d8 100644 --- a/x/pki/types/query.pb.go +++ b/x/pki/types/query.pb.go @@ -1879,6 +1879,190 @@ func (m *QueryAllNocRootCertificatesResponse) GetPagination() *query.PageRespons return nil } +type QueryGetNocCertificatesRequest struct { + Vid int32 `protobuf:"varint,1,opt,name=vid,proto3" json:"vid,omitempty"` +} + +func (m *QueryGetNocCertificatesRequest) Reset() { *m = QueryGetNocCertificatesRequest{} } +func (m *QueryGetNocCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetNocCertificatesRequest) ProtoMessage() {} +func (*QueryGetNocCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_62972e0134af9ed2, []int{38} +} +func (m *QueryGetNocCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNocCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocCertificatesRequest.Merge(m, src) +} +func (m *QueryGetNocCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocCertificatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocCertificatesRequest proto.InternalMessageInfo + +func (m *QueryGetNocCertificatesRequest) GetVid() int32 { + if m != nil { + return m.Vid + } + return 0 +} + +type QueryGetNocCertificatesResponse struct { + NocCertificates NocCertificates `protobuf:"bytes,1,opt,name=nocCertificates,proto3" json:"nocCertificates"` +} + +func (m *QueryGetNocCertificatesResponse) Reset() { *m = QueryGetNocCertificatesResponse{} } +func (m *QueryGetNocCertificatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetNocCertificatesResponse) ProtoMessage() {} +func (*QueryGetNocCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_62972e0134af9ed2, []int{39} +} +func (m *QueryGetNocCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNocCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNocCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNocCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNocCertificatesResponse.Merge(m, src) +} +func (m *QueryGetNocCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNocCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNocCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNocCertificatesResponse proto.InternalMessageInfo + +func (m *QueryGetNocCertificatesResponse) GetNocCertificates() NocCertificates { + if m != nil { + return m.NocCertificates + } + return NocCertificates{} +} + +type QueryAllNocCertificatesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllNocCertificatesRequest) Reset() { *m = QueryAllNocCertificatesRequest{} } +func (m *QueryAllNocCertificatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllNocCertificatesRequest) ProtoMessage() {} +func (*QueryAllNocCertificatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_62972e0134af9ed2, []int{40} +} +func (m *QueryAllNocCertificatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllNocCertificatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllNocCertificatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllNocCertificatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllNocCertificatesRequest.Merge(m, src) +} +func (m *QueryAllNocCertificatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllNocCertificatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllNocCertificatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllNocCertificatesRequest proto.InternalMessageInfo + +func (m *QueryAllNocCertificatesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllNocCertificatesResponse struct { + NocCertificates []NocCertificates `protobuf:"bytes,1,rep,name=nocCertificates,proto3" json:"nocCertificates"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllNocCertificatesResponse) Reset() { *m = QueryAllNocCertificatesResponse{} } +func (m *QueryAllNocCertificatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllNocCertificatesResponse) ProtoMessage() {} +func (*QueryAllNocCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_62972e0134af9ed2, []int{41} +} +func (m *QueryAllNocCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllNocCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllNocCertificatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllNocCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllNocCertificatesResponse.Merge(m, src) +} +func (m *QueryAllNocCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllNocCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllNocCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllNocCertificatesResponse proto.InternalMessageInfo + +func (m *QueryAllNocCertificatesResponse) GetNocCertificates() []NocCertificates { + if m != nil { + return m.NocCertificates + } + return nil +} + +func (m *QueryAllNocCertificatesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*QueryGetApprovedCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesRequest") proto.RegisterType((*QueryGetApprovedCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetApprovedCertificatesResponse") @@ -1918,123 +2102,134 @@ func init() { proto.RegisterType((*QueryGetNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocRootCertificatesResponse") proto.RegisterType((*QueryAllNocRootCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocRootCertificatesRequest") proto.RegisterType((*QueryAllNocRootCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocRootCertificatesResponse") + proto.RegisterType((*QueryGetNocCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesRequest") + proto.RegisterType((*QueryGetNocCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryGetNocCertificatesResponse") + proto.RegisterType((*QueryAllNocCertificatesRequest)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocCertificatesRequest") + proto.RegisterType((*QueryAllNocCertificatesResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.QueryAllNocCertificatesResponse") } func init() { proto.RegisterFile("pki/query.proto", fileDescriptor_62972e0134af9ed2) } var fileDescriptor_62972e0134af9ed2 = []byte{ - // 1772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0xcd, 0x6f, 0xdc, 0x44, - 0x1b, 0xcf, 0xec, 0xb6, 0x7d, 0xf5, 0xce, 0xfb, 0xea, 0x7d, 0xe9, 0x24, 0x34, 0x61, 0xd5, 0x6c, - 0xd2, 0x69, 0x48, 0x3f, 0xb3, 0x26, 0xad, 0x68, 0xe1, 0x50, 0xaa, 0x7c, 0x94, 0xb6, 0x20, 0xaa, - 0x74, 0x83, 0x28, 0x42, 0xa5, 0x2b, 0xaf, 0xd7, 0x6c, 0x4d, 0x9c, 0x1d, 0xd7, 0xf6, 0x06, 0x96, - 0x28, 0x48, 0x20, 0x41, 0x25, 0x4e, 0xe5, 0xe3, 0x00, 0x88, 0x13, 0x95, 0x2a, 0xee, 0x1c, 0xf8, - 0x17, 0x2a, 0xf5, 0x40, 0x25, 0x0e, 0x20, 0x21, 0x21, 0xd4, 0x70, 0x00, 0xb5, 0x12, 0xe2, 0x02, - 0xe2, 0x02, 0xc8, 0xe3, 0x71, 0xec, 0x5d, 0x8f, 0x67, 0xbd, 0xde, 0xd9, 0xf6, 0x66, 0x7b, 0x1e, - 0x3f, 0x1f, 0xbf, 0xe7, 0x99, 0x67, 0x1e, 0xff, 0x76, 0xe1, 0xff, 0xad, 0x15, 0x43, 0xb9, 0xd2, - 0xd4, 0xed, 0x56, 0xc9, 0xb2, 0x89, 0x4b, 0x50, 0xe9, 0x0d, 0xa3, 0x5e, 0xd5, 0x75, 0xd5, 0x34, - 0x0d, 0xb5, 0xa1, 0xe9, 0xa5, 0x9a, 0xe1, 0xb8, 0xb6, 0x51, 0x6d, 0xba, 0x7a, 0x4d, 0x23, 0xab, - 0x96, 0xff, 0xd4, 0xd4, 0x6b, 0x75, 0xdd, 0x2e, 0x59, 0x2b, 0x46, 0x61, 0x77, 0x9d, 0x90, 0xba, - 0xa9, 0x2b, 0xaa, 0x65, 0x28, 0x6a, 0xa3, 0x41, 0x5c, 0xd5, 0x35, 0x48, 0xc3, 0xf1, 0xb5, 0x15, - 0x0e, 0x6a, 0xc4, 0x59, 0x25, 0x8e, 0x52, 0x55, 0x1d, 0xdd, 0x37, 0xa3, 0xac, 0xcd, 0x56, 0x75, - 0x57, 0x9d, 0x55, 0x2c, 0xb5, 0x6e, 0x34, 0xa8, 0x30, 0x93, 0x9d, 0xf0, 0x5c, 0x51, 0x2d, 0xcb, - 0x26, 0x6b, 0x7a, 0xad, 0xa2, 0xe9, 0xb6, 0x6b, 0xbc, 0x62, 0x68, 0xaa, 0xab, 0x07, 0xca, 0x8a, - 0x9e, 0x80, 0x65, 0x13, 0x8b, 0x38, 0xed, 0x02, 0x6c, 0x7d, 0xb7, 0xb7, 0xae, 0x5d, 0x36, 0x4c, - 0xee, 0xdb, 0x07, 0x92, 0xde, 0xae, 0xd8, 0xfa, 0x1a, 0xd1, 0xa2, 0x9e, 0x50, 0x43, 0xde, 0xd3, - 0x15, 0xbe, 0x23, 0x53, 0x6d, 0x9e, 0xda, 0x84, 0xb8, 0x3c, 0xa9, 0xbd, 0x51, 0x2d, 0x49, 0x42, - 0x07, 0x13, 0x83, 0xae, 0x54, 0x5b, 0x15, 0xa7, 0x59, 0x7d, 0x55, 0xd7, 0xdc, 0x76, 0xb7, 0xbc, - 0x27, 0xdc, 0xf8, 0x0f, 0xd1, 0x08, 0x57, 0x8c, 0x48, 0x40, 0x95, 0xad, 0xf4, 0x79, 0x37, 0x16, - 0x31, 0x1a, 0x81, 0xb2, 0x53, 0xa9, 0x84, 0xa9, 0x17, 0x86, 0xe3, 0x34, 0x75, 0x3b, 0x70, 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c9, 0x3b, 0x24, 0x3a, 0xb1, 0x42, - 0xdf, 0xe6, 0xe0, 0xd1, 0x0c, 0x24, 0x16, 0xb2, 0x07, 0x93, 0x67, 0x11, 0xa7, 0x58, 0x70, 0xee, - 0xab, 0x4d, 0x06, 0xe2, 0x71, 0x0a, 0xe2, 0x2c, 0x52, 0x7a, 0x2c, 0x38, 0x74, 0x0f, 0xc0, 0x61, - 0x0e, 0xdd, 0x93, 0x7d, 0xbc, 0x4c, 0x26, 0xc5, 0xb2, 0x8f, 0x97, 0x02, 0xe6, 0x0b, 0x1f, 0xa6, - 0x91, 0x4f, 0xa3, 0xa9, 0xad, 0xc8, 0xb9, 0x7f, 0xf6, 0xf4, 0x77, 0x16, 0xfd, 0xe6, 0xe6, 0x68, - 0xeb, 0x6b, 0x98, 0x94, 0x1e, 0xb1, 0x98, 0xeb, 0xe3, 0xb4, 0x59, 0x6e, 0xc4, 0xf3, 0x97, 0x6e, - 0xde, 0x29, 0x82, 0xdb, 0x77, 0x8a, 0xe0, 0xc7, 0x3b, 0x45, 0x70, 0x6d, 0xb3, 0x38, 0x74, 0x7b, - 0xb3, 0x38, 0xf4, 0xdd, 0x66, 0x71, 0xe8, 0xa5, 0xc5, 0xba, 0xe1, 0x5e, 0x6e, 0x56, 0x4b, 0x1a, - 0x59, 0x55, 0x7c, 0x07, 0x67, 0x02, 0x0f, 0x95, 0x88, 0x87, 0x33, 0xa1, 0x8b, 0x33, 0xbe, 0x8f, - 0xca, 0xeb, 0xd4, 0x9e, 0xdb, 0xb2, 0x74, 0xa7, 0xba, 0x83, 0xfe, 0x1d, 0xf6, 0xe8, 0x3f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x1b, 0x9d, 0x71, 0x91, 0xa2, 0x2d, 0x00, 0x00, + // 1877 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0xcf, 0x6f, 0xdc, 0xc4,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0xa5, 0xba, 0x66, 0xa4, 0xb5, 0xe9, 0xb2, 0x6a, 0xcb, + 0xd3, 0x92, 0x21, 0x57, 0xb5, 0x1a, 0x15, 0x66, 0xb2, 0x23, 0x8e, 0x2b, 0xb2, 0x61, 0x98, 0x64, + 0x4d, 0xad, 0x94, 0x14, 0xd5, 0xb4, 0xb5, 0xd7, 0x35, 0x45, 0xb6, 0x55, 0x4f, 0x59, 0xde, 0x11, + 0x30, 0x4c, 0x62, 0x10, 0xab, 0x59, 0x80, 0xad, 0xef, 0x71, 0xd6, 0x95, 0x65, 0x4d, 0xe7, 0x3e, + 0x7d, 0x20, 0xea, 0xe9, 0x92, 0xa9, 0xae, 0x11, 0x25, 0xe8, 0x09, 0x35, 0xe4, 0xdc, 0x5d, 0xe1, + 0x3b, 0x32, 0xde, 0xe4, 0xa9, 0x49, 0x88, 0xcd, 0x93, 0xda, 0x1b, 0xd4, 0x12, 0x25, 0x34, 0x19, + 0x09, 0xba, 0x54, 0x6e, 0x94, 0xac, 0x7a, 0xf9, 0x0d, 0x55, 0xb1, 0x9b, 0xdd, 0x72, 0xee, 0x70, + 0xf1, 0x1f, 0xa4, 0x08, 0x57, 0xb4, 0x00, 0xa0, 0xd2, 0x56, 0xf8, 0x9c, 0x0b, 0x83, 0x68, 0x35, + 0x4f, 0xd9, 0xc9, 0x44, 0xc2, 0xd4, 0x0b, 0xcd, 0xb2, 0xea, 0xaa, 0xe9, 0x39, 0x53, 0x5a, 0x51, + 0x1b, 0x25, 0xad, 0x12, 0x0c, 0x5a, 0x8d, 0x28, 0x91, 0x00, 0x73, 0x9e, 0x00, 0x67, 0x6d, 0xa0, + 0x4a, 0xaa, 0x84, 0xfe, 0x94, 0x9c, 0x5f, 0xec, 0xee, 0x6e, 0x37, 0x67, 0x4a, 0xee, 0x82, 0x7b, + 0xe1, 0x2e, 0x61, 0x05, 0xee, 0x3d, 0xeb, 0x24, 0xd1, 0x29, 0xd5, 0x9e, 0x61, 0x9c, 0xcd, 0x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05, 0x1c, 0x9b, 0xf2, 0x3d, 0x9b, 0x72, 0x5d, 0x93, 0xde, 0xa2, 0xa6, 0xec, 0x86, 0xa1, + 0x5a, 0xe5, 0xed, 0xf4, 0x8f, 0xed, 0x47, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x96, 0x7c, 0x09, + 0xc7, 0x88, 0x31, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2087,6 +2282,10 @@ type QueryClient interface { NocRootCertificates(ctx context.Context, in *QueryGetNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocRootCertificatesResponse, error) // Queries a list of NocRootCertificates items. NocRootCertificatesAll(ctx context.Context, in *QueryAllNocRootCertificatesRequest, opts ...grpc.CallOption) (*QueryAllNocRootCertificatesResponse, error) + // Queries a NocCertificates by index. + NocCertificates(ctx context.Context, in *QueryGetNocCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocCertificatesResponse, error) + // Queries a list of NocCertificates items. + NocCertificatesAll(ctx context.Context, in *QueryAllNocCertificatesRequest, opts ...grpc.CallOption) (*QueryAllNocCertificatesResponse, error) } type queryClient struct { @@ -2268,6 +2467,24 @@ func (c *queryClient) NocRootCertificatesAll(ctx context.Context, in *QueryAllNo return out, nil } +func (c *queryClient) NocCertificates(ctx context.Context, in *QueryGetNocCertificatesRequest, opts ...grpc.CallOption) (*QueryGetNocCertificatesResponse, error) { + out := new(QueryGetNocCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) NocCertificatesAll(ctx context.Context, in *QueryAllNocCertificatesRequest, opts ...grpc.CallOption) (*QueryAllNocCertificatesResponse, error) { + out := new(QueryAllNocCertificatesResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificatesAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Queries a ApprovedCertificates by index. @@ -2308,6 +2525,10 @@ type QueryServer interface { NocRootCertificates(context.Context, *QueryGetNocRootCertificatesRequest) (*QueryGetNocRootCertificatesResponse, error) // Queries a list of NocRootCertificates items. NocRootCertificatesAll(context.Context, *QueryAllNocRootCertificatesRequest) (*QueryAllNocRootCertificatesResponse, error) + // Queries a NocCertificates by index. + NocCertificates(context.Context, *QueryGetNocCertificatesRequest) (*QueryGetNocCertificatesResponse, error) + // Queries a list of NocCertificates items. + NocCertificatesAll(context.Context, *QueryAllNocCertificatesRequest) (*QueryAllNocCertificatesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -2371,6 +2592,12 @@ func (*UnimplementedQueryServer) NocRootCertificates(ctx context.Context, req *Q func (*UnimplementedQueryServer) NocRootCertificatesAll(ctx context.Context, req *QueryAllNocRootCertificatesRequest) (*QueryAllNocRootCertificatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NocRootCertificatesAll not implemented") } +func (*UnimplementedQueryServer) NocCertificates(ctx context.Context, req *QueryGetNocCertificatesRequest) (*QueryGetNocCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NocCertificates not implemented") +} +func (*UnimplementedQueryServer) NocCertificatesAll(ctx context.Context, req *QueryAllNocCertificatesRequest) (*QueryAllNocCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NocCertificatesAll not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -2718,6 +2945,42 @@ func _Query_NocRootCertificatesAll_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Query_NocCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNocCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NocCertificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NocCertificates(ctx, req.(*QueryGetNocCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_NocCertificatesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllNocCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NocCertificatesAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Query/NocCertificatesAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NocCertificatesAll(ctx, req.(*QueryAllNocCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zigbeealliance.distributedcomplianceledger.pki.Query", HandlerType: (*QueryServer)(nil), @@ -2798,6 +3061,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "NocRootCertificatesAll", Handler: _Query_NocRootCertificatesAll_Handler, }, + { + MethodName: "NocCertificates", + Handler: _Query_NocCertificates_Handler, + }, + { + MethodName: "NocCertificatesAll", + Handler: _Query_NocCertificatesAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "pki/query.proto", @@ -4199,87 +4470,232 @@ func (m *QueryAllNocRootCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryGetNocCertificatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryGetApprovedCertificatesRequest) Size() (n int) { - if m == nil { - return 0 - } + +func (m *QueryGetNocCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNocCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SubjectKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Vid != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Vid)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryGetApprovedCertificatesResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetNocCertificatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - l = m.ApprovedCertificates.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return dAtA[:n], nil } -func (m *QueryAllApprovedCertificatesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SubjectKeyId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryGetNocCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllApprovedCertificatesResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGetNocCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.ApprovedCertificates) > 0 { - for _, e := range m.ApprovedCertificates { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.NocCertificates.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryGetProposedCertificateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l +func (m *QueryAllNocCertificatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllNocCertificatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllNocCertificatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllNocCertificatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllNocCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllNocCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NocCertificates) > 0 { + for iNdEx := len(m.NocCertificates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NocCertificates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryGetApprovedCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetApprovedCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ApprovedCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllApprovedCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllApprovedCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ApprovedCertificates) > 0 { + for _, e := range m.ApprovedCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetProposedCertificateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l l = len(m.Subject) if l > 0 { n += 1 + l + sovQuery(uint64(l)) @@ -4752,6 +5168,61 @@ func (m *QueryAllNocRootCertificatesResponse) Size() (n int) { return n } +func (m *QueryGetNocCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vid != 0 { + n += 1 + sovQuery(uint64(m.Vid)) + } + return n +} + +func (m *QueryGetNocCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NocCertificates.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllNocCertificatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllNocCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.NocCertificates) > 0 { + for _, e := range m.NocCertificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -8410,6 +8881,364 @@ func (m *QueryAllNocRootCertificatesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGetNocCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNocCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNocCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Vid", wireType) + } + m.Vid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Vid |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetNocCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNocCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNocCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NocCertificates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllNocCertificatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllNocCertificatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllNocCertificatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllNocCertificatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllNocCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllNocCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NocCertificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NocCertificates = append(m.NocCertificates, NocCertificates{}) + if err := m.NocCertificates[len(m.NocCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/pki/types/query.pb.gw.go b/x/pki/types/query.pb.gw.go index bffb41638..5e9d629a0 100644 --- a/x/pki/types/query.pb.gw.go +++ b/x/pki/types/query.pb.gw.go @@ -1055,6 +1055,96 @@ func local_request_Query_NocRootCertificatesAll_0(ctx context.Context, marshaler } +func request_Query_NocCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["vid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "vid") + } + + protoReq.Vid, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "vid", err) + } + + msg, err := client.NocCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NocCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNocCertificatesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["vid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "vid") + } + + protoReq.Vid, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "vid", err) + } + + msg, err := server.NocCertificates(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_NocCertificatesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_NocCertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllNocCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NocCertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.NocCertificatesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NocCertificatesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllNocCertificatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NocCertificatesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.NocCertificatesAll(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1498,6 +1588,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_NocCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NocCertificates_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NocCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NocCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NocCertificatesAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NocCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1919,6 +2055,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_NocCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NocCertificates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NocCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NocCertificatesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NocCertificatesAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NocCertificatesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1960,6 +2136,10 @@ var ( pattern_Query_NocRootCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "noc-root-certificates", "vid"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_NocRootCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "noc-root-certificates"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NocCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dcl", "pki", "noc-certificates", "vid"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NocCertificatesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dcl", "pki", "noc-certificates"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -2000,4 +2180,8 @@ var ( forward_Query_NocRootCertificates_0 = runtime.ForwardResponseMessage forward_Query_NocRootCertificatesAll_0 = runtime.ForwardResponseMessage + + forward_Query_NocCertificates_0 = runtime.ForwardResponseMessage + + forward_Query_NocCertificatesAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/pki/types/tx.pb.go b/x/pki/types/tx.pb.go index ec70137e9..ec026026d 100644 --- a/x/pki/types/tx.pb.go +++ b/x/pki/types/tx.pb.go @@ -1573,6 +1573,94 @@ func (m *MsgRemoveX509CertResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveX509CertResponse proto.InternalMessageInfo +type MsgAddNocX509Cert struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty" validate:"required"` + Cert string `protobuf:"bytes,2,opt,name=cert,proto3" json:"cert,omitempty" validate:"required,max=10485760"` +} + +func (m *MsgAddNocX509Cert) Reset() { *m = MsgAddNocX509Cert{} } +func (m *MsgAddNocX509Cert) String() string { return proto.CompactTextString(m) } +func (*MsgAddNocX509Cert) ProtoMessage() {} +func (*MsgAddNocX509Cert) Descriptor() ([]byte, []int) { + return fileDescriptor_badfdb2b39855d16, []int{26} +} +func (m *MsgAddNocX509Cert) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddNocX509Cert) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddNocX509Cert.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddNocX509Cert) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddNocX509Cert.Merge(m, src) +} +func (m *MsgAddNocX509Cert) XXX_Size() int { + return m.Size() +} +func (m *MsgAddNocX509Cert) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddNocX509Cert.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddNocX509Cert proto.InternalMessageInfo + +func (m *MsgAddNocX509Cert) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgAddNocX509Cert) GetCert() string { + if m != nil { + return m.Cert + } + return "" +} + +type MsgAddNocX509CertResponse struct { +} + +func (m *MsgAddNocX509CertResponse) Reset() { *m = MsgAddNocX509CertResponse{} } +func (m *MsgAddNocX509CertResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddNocX509CertResponse) ProtoMessage() {} +func (*MsgAddNocX509CertResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_badfdb2b39855d16, []int{27} +} +func (m *MsgAddNocX509CertResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddNocX509CertResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddNocX509CertResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddNocX509CertResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddNocX509CertResponse.Merge(m, src) +} +func (m *MsgAddNocX509CertResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddNocX509CertResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddNocX509CertResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddNocX509CertResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgProposeAddX509RootCert)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCert") proto.RegisterType((*MsgProposeAddX509RootCertResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCertResponse") @@ -1600,93 +1688,96 @@ func init() { proto.RegisterType((*MsgAddNocX509RootCertResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509RootCertResponse") proto.RegisterType((*MsgRemoveX509Cert)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert") proto.RegisterType((*MsgRemoveX509CertResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509CertResponse") + proto.RegisterType((*MsgAddNocX509Cert)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509Cert") + proto.RegisterType((*MsgAddNocX509CertResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgAddNocX509CertResponse") } func init() { proto.RegisterFile("pki/tx.proto", fileDescriptor_badfdb2b39855d16) } var fileDescriptor_badfdb2b39855d16 = []byte{ - // 1281 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xdf, 0x6f, 0xdb, 0x54, - 0x14, 0x9e, 0xf3, 0xa3, 0x3f, 0xce, 0x4a, 0x25, 0x2e, 0xdd, 0xe6, 0xba, 0x25, 0xc9, 0xbc, 0x6a, - 0x8b, 0x44, 0x9b, 0xa4, 0x5d, 0x53, 0xd6, 0x89, 0x82, 0xd2, 0x86, 0x8d, 0x6a, 0xed, 0x54, 0xdc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db, 0xbc, 0x86, 0x3f, 0xae, 0x11, 0x0d, 0x4b, 0xfc, - 0x2f, 0xdf, 0xcf, 0x8c, 0x35, 0x9d, 0x15, 0x24, 0x49, 0xc3, 0xba, 0xbe, 0x69, 0x68, 0xa4, 0x2a, - 0x0b, 0x4d, 0x73, 0x74, 0x0b, 0x62, 0x65, 0xac, 0x19, 0x6c, 0xc4, 0x82, 0x99, 0x6a, 0xd4, 0x93, - 0xa9, 0xc3, 0x30, 0xd3, 0x15, 0x71, 0x77, 0x69, 0x36, 0x37, 0x7f, 0x2b, 0xff, 0xea, 0x42, 0x8e, - 0x17, 0x2c, 0x0b, 0xf4, 0x0a, 0xc4, 0x48, 0xf5, 0x11, 0x65, 0xa3, 0x96, 0xe5, 0x15, 0x6f, 0x00, - 0xa6, 0xc1, 0x7c, 0x6e, 0x71, 0x81, 0x17, 0xac, 0x49, 0x08, 0x41, 0xcc, 0x20, 0x15, 0xcc, 0xc6, - 0x52, 0x4c, 0x3a, 0x2a, 0x58, 0xcf, 0x68, 0x11, 0xa2, 0x3b, 0x44, 0x62, 0xe3, 0x29, 0x26, 0x1d, - 0x5f, 0xbe, 0xd1, 0xa8, 0x27, 0xaf, 0xb9, 0xf6, 0xb2, 0x81, 0x97, 0x66, 0xa7, 0x15, 0x03, 0x2f, - 0x2d, 0xe4, 0xf3, 0x37, 0xf3, 0xd3, 0x4e, 0x42, 0x82, 0x69, 0xc3, 0x5f, 0x83, 0xab, 0x81, 0xdc, - 0x08, 0x58, 0x57, 0x69, 0x55, 0xc7, 0xfc, 0x37, 0x36, 0x83, 0x05, 0x55, 0xd5, 0xe8, 0xce, 0xe9, - 0x31, 0x78, 0x1b, 0x06, 0xf5, 0x5a, 0xe9, 0x23, 0x5c, 0x6e, 0x91, 0x98, 0x6a, 0xd4, 0x93, 0x93, - 0x81, 0x24, 0xce, 0xcd, 0xf3, 0x42, 0xcb, 0x00, 0xad, 0xc0, 0x48, 0xf3, 0xf1, 0x1e, 0xde, 0x5b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x50, 0x29, 0xf6, 0xd2, 0x99, 0xa2, - 0x4f, 0x19, 0x18, 0x76, 0xdb, 0xd2, 0xd7, 0xc2, 0x28, 0xa6, 0x65, 0xcd, 0x15, 0x4f, 0x62, 0xed, - 0x44, 0xf4, 0x2d, 0x03, 0xc8, 0xa7, 0xf5, 0x7b, 0x33, 0x9c, 0x98, 0x3b, 0x60, 0xb8, 0xf5, 0xbe, - 0xc0, 0x74, 0xec, 0x9a, 0x9e, 0x4e, 0x2f, 0xdc, 0xae, 0xd9, 0x0e, 0x11, 0x72, 0xd7, 0xf4, 0x6b, - 0xb6, 0x96, 0x3f, 0xfc, 0x69, 0x3f, 0xc1, 0x3c, 0xdb, 0x4f, 0x30, 0xcf, 0xf7, 0x13, 0xcc, 0x67, - 0x07, 0x89, 0x0b, 0xcf, 0x0e, 0x12, 0x17, 0x7e, 0x3f, 0x48, 0x5c, 0x78, 0xbf, 0x28, 0x13, 0xe3, - 0x71, 0xad, 0x94, 0x29, 0xd3, 0x4a, 0xd6, 0x76, 0x37, 0xd3, 0xf2, 0x97, 0x6d, 0xf3, 0x37, 0xe3, - 0x3a, 0x9c, 0xb1, 0x3d, 0x66, 0x77, 0xb3, 0xd6, 0x9f, 0x9f, 0x7b, 0x2a, 0xd6, 0x4b, 0x03, 0xd6, - 0xff, 0x93, 0x37, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x47, 0xac, 0x16, 0x10, 0x1d, 0x00, - 0x00, + // 1310 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0x4f, 0x6c, 0xdb, 0x54, + 0x18, 0x9f, 0xf3, 0xa7, 0x7f, 0xbe, 0x95, 0x4a, 0x3c, 0xb2, 0xce, 0x75, 0x4b, 0x92, 0x79, 0xd5, + 0x16, 0x89, 0x36, 0x49, 0xbb, 0xa6, 0xac, 0x13, 0x05, 0xa5, 0x0d, 0x1b, 0xd5, 0xda, 0xa9, 0xb8, + 0x1d, 0x20, 0x84, 0x98, 0x92, 0xf8, 0xcd, 0x7b, 0xd4, 0xc9, 0x33, 0xb6, 0x53, 0xb5, 0xbb, 0x71, + 0xe6, 0x00, 0x12, 0x82, 0xc3, 0x90, 0xb8, 0xc1, 0x81, 0x2b, 0x88, 0x2b, 0x57, 0x2e, 0x48, 0x13, + 0x42, 0x82, 0x53, 0x34, 0xb5, 0xdc, 0x91, 0x72, 0x47, 0x42, 0xb6, 0x13, 0x3b, 0x4e, 0xed, 0x36, + 0x71, 0x53, 0x69, 0x94, 0xde, 0xec, 0x97, 0xf7, 0xfd, 0xde, 0xf7, 0xfd, 0xbe, 0xdf, 0x7b, 0xfe, + 0xde, 0x17, 0x18, 0x51, 0xb6, 0x49, 0x46, 0xdf, 0x4d, 0x2b, 0x2a, 0xd5, 0x29, 0x4a, 0x3f, 0x26, + 0x52, 0x09, 0xe3, 0xa2, 0x2c, 0x93, 0x62, 0xb5, 0x8c, 0xd3, 0x22, 0xd1, 0x74, 0x95, 0x94, 0x6a, + 0x3a, 0x16, 0xcb, 0xb4, 0xa2, 0x58, 0xa3, 0x32, 0x16, 0x25, 0xac, 0xa6, 0x95, 0x6d, 0xc2, 0x8d, + 0x97, 0xa9, 0x56, 0xa1, 0xda, 0x03, 0xd3, 0x3a, 0x63, 0xbd, 0x58, 0x50, 0x5c, 0x4c, 0xa2, 0x12, + 0xb5, 0xc6, 0x8d, 0x27, 0x6b, 0x94, 0x7f, 0x12, 0x82, 0xf1, 0x75, 0x4d, 0xda, 0x50, 0xa9, 0x42, + 0x35, 0x9c, 0x17, 0xc5, 0xf7, 0x72, 0xd9, 0x45, 0x81, 0x52, 0x7d, 0x05, 0xab, 0x3a, 0xba, 0x03, + 0x03, 0x1a, 0x91, 0xaa, 0x58, 0x65, 0x99, 0x24, 0x93, 0x1a, 0x5e, 0xce, 0x34, 0xea, 0x89, 0x97, + 0x76, 0x8a, 0x32, 0x11, 0x8b, 0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14, 0xbd, 0x1b, 0xc0, 0x8d, 0x6e, 0x80, 0xb9, 0x07, 0xa7, 0x04, 0xec, 0x0a, + 0xb1, 0xab, 0x22, 0x3e, 0x48, 0x88, 0xdd, 0x00, 0x07, 0x0a, 0xb1, 0x97, 0x7a, 0x1a, 0x7d, 0xc6, + 0xc0, 0xb0, 0x53, 0x4c, 0xbf, 0x16, 0x44, 0x31, 0x2d, 0x6b, 0xae, 0x70, 0x12, 0x6b, 0xdb, 0xa3, + 0xef, 0x19, 0x40, 0x1e, 0x05, 0xeb, 0x9b, 0xc1, 0xc4, 0xdc, 0x01, 0xc3, 0xad, 0xf7, 0x05, 0xa6, + 0xe3, 0xd4, 0x74, 0xd5, 0xa7, 0xc1, 0x4e, 0xcd, 0x76, 0x88, 0x80, 0xa7, 0xa6, 0x57, 0x89, 0x68, + 0x3a, 0xd8, 0x51, 0x1f, 0xe6, 0x4f, 0x44, 0x41, 0x60, 0x07, 0xbd, 0xab, 0xc1, 0xe5, 0x0f, 0x7f, + 0xd9, 0x8f, 0x33, 0x4f, 0xf7, 0xe3, 0xcc, 0xb3, 0xfd, 0x38, 0xf3, 0xf9, 0x41, 0xfc, 0xc2, 0xd3, + 0x83, 0xf8, 0x85, 0x3f, 0x0f, 0xe2, 0x17, 0xde, 0x2f, 0x48, 0x44, 0x7f, 0x54, 0x2b, 0xa5, 0xcb, + 0xb4, 0x92, 0xb1, 0x96, 0x9b, 0x69, 0xad, 0x97, 0x69, 0x5b, 0x6f, 0xc6, 0x59, 0x70, 0xc6, 0x5a, + 0x31, 0xb3, 0x9b, 0x31, 0xff, 0x53, 0xde, 0x53, 0xb0, 0x56, 0x1a, 0x30, 0xff, 0xf6, 0xbd, 0xf1, + 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x42, 0x0e, 0x55, 0x05, 0x67, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1714,6 +1805,7 @@ type MsgClient interface { AssignVid(ctx context.Context, in *MsgAssignVid, opts ...grpc.CallOption) (*MsgAssignVidResponse, error) AddNocX509RootCert(ctx context.Context, in *MsgAddNocX509RootCert, opts ...grpc.CallOption) (*MsgAddNocX509RootCertResponse, error) RemoveX509Cert(ctx context.Context, in *MsgRemoveX509Cert, opts ...grpc.CallOption) (*MsgRemoveX509CertResponse, error) + AddNocX509Cert(ctx context.Context, in *MsgAddNocX509Cert, opts ...grpc.CallOption) (*MsgAddNocX509CertResponse, error) } type msgClient struct { @@ -1841,6 +1933,15 @@ func (c *msgClient) RemoveX509Cert(ctx context.Context, in *MsgRemoveX509Cert, o return out, nil } +func (c *msgClient) AddNocX509Cert(ctx context.Context, in *MsgAddNocX509Cert, opts ...grpc.CallOption) (*MsgAddNocX509CertResponse, error) { + out := new(MsgAddNocX509CertResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Msg/AddNocX509Cert", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { ProposeAddX509RootCert(context.Context, *MsgProposeAddX509RootCert) (*MsgProposeAddX509RootCertResponse, error) @@ -1856,6 +1957,7 @@ type MsgServer interface { AssignVid(context.Context, *MsgAssignVid) (*MsgAssignVidResponse, error) AddNocX509RootCert(context.Context, *MsgAddNocX509RootCert) (*MsgAddNocX509RootCertResponse, error) RemoveX509Cert(context.Context, *MsgRemoveX509Cert) (*MsgRemoveX509CertResponse, error) + AddNocX509Cert(context.Context, *MsgAddNocX509Cert) (*MsgAddNocX509CertResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1901,6 +2003,9 @@ func (*UnimplementedMsgServer) AddNocX509RootCert(ctx context.Context, req *MsgA func (*UnimplementedMsgServer) RemoveX509Cert(ctx context.Context, req *MsgRemoveX509Cert) (*MsgRemoveX509CertResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveX509Cert not implemented") } +func (*UnimplementedMsgServer) AddNocX509Cert(ctx context.Context, req *MsgAddNocX509Cert) (*MsgAddNocX509CertResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddNocX509Cert not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -2140,6 +2245,24 @@ func _Msg_RemoveX509Cert_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_AddNocX509Cert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddNocX509Cert) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddNocX509Cert(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Msg/AddNocX509Cert", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddNocX509Cert(ctx, req.(*MsgAddNocX509Cert)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zigbeealliance.distributedcomplianceledger.pki.Msg", HandlerType: (*MsgServer)(nil), @@ -2196,6 +2319,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RemoveX509Cert", Handler: _Msg_RemoveX509Cert_Handler, }, + { + MethodName: "AddNocX509Cert", + Handler: _Msg_AddNocX509Cert_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "pki/tx.proto", @@ -3290,6 +3417,66 @@ func (m *MsgRemoveX509CertResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgAddNocX509Cert) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddNocX509Cert) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddNocX509Cert) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Cert) > 0 { + i -= len(m.Cert) + copy(dAtA[i:], m.Cert) + i = encodeVarintTx(dAtA, i, uint64(len(m.Cert))) + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddNocX509CertResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddNocX509CertResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddNocX509CertResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -3810,6 +3997,32 @@ func (m *MsgRemoveX509CertResponse) Size() (n int) { return n } +func (m *MsgAddNocX509Cert) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Cert) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAddNocX509CertResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -7214,6 +7427,170 @@ func (m *MsgRemoveX509CertResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgAddNocX509Cert) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddNocX509Cert: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddNocX509Cert: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cert", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cert = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddNocX509CertResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddNocX509CertResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddNocX509CertResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0