diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 4f4a7c4e0709ba..e5194b07b06a8d 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -593,7 +593,7 @@ OperationalCertStatus ConvertToNOCResponseStatus(CHIP_ERROR err) { return OperationalCertStatus::kInvalidPublicKey; } - if (err == CHIP_ERROR_INVALID_FABRIC_INDEX || err == CHIP_ERROR_WRONG_NODE_ID) + if (err == CHIP_ERROR_WRONG_NODE_ID || err == CHIP_ERROR_WRONG_CERT_DN || err == CHIP_ERROR_FABRIC_MISMATCH_ON_ICA) { return OperationalCertStatus::kInvalidNodeOpId; } @@ -601,10 +601,16 @@ OperationalCertStatus ConvertToNOCResponseStatus(CHIP_ERROR err) err == CHIP_ERROR_CERT_PATH_TOO_LONG || err == CHIP_ERROR_CERT_USAGE_NOT_ALLOWED || err == CHIP_ERROR_CERT_EXPIRED || err == CHIP_ERROR_CERT_NOT_VALID_YET || err == CHIP_ERROR_UNSUPPORTED_CERT_FORMAT || err == CHIP_ERROR_UNSUPPORTED_ELLIPTIC_CURVE || err == CHIP_ERROR_CERT_LOAD_FAILED || err == CHIP_ERROR_CERT_NOT_TRUSTED || - err == CHIP_ERROR_WRONG_CERT_DN) + err == CHIP_ERROR_INVALID_ARGUMENT || err == CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE || err == CHIP_ERROR_WRONG_CERT_TYPE || + err == CHIP_ERROR_CERT_NOT_FOUND || err == CHIP_ERROR_WRONG_TLV_TYPE || err == CHIP_ERROR_INVALID_TLV_TAG || + err == CHIP_ERROR_BUFFER_TOO_SMALL) { return OperationalCertStatus::kInvalidNOC; } + if (err == CHIP_ERROR_INCORRECT_STATE) + { + return OperationalCertStatus::kMissingCsr; + } if (err == CHIP_ERROR_NO_MEMORY) { return OperationalCertStatus::kTableFull; @@ -613,6 +619,10 @@ OperationalCertStatus ConvertToNOCResponseStatus(CHIP_ERROR err) { return OperationalCertStatus::kFabricConflict; } + if (err == CHIP_ERROR_INVALID_FABRIC_INDEX) + { + return OperationalCertStatus::kInvalidFabricIndex; + } return OperationalCertStatus::kInvalidNOC; } diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index 56991dce12d88b..aad16ad5c6d422 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -592,7 +592,7 @@ CHIP_ERROR FabricInfo::SetFabricInfo(FabricInfo & newFabric) auto * operationalKey = newFabric.GetOperationalKey(); if (operationalKey == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; + return CHIP_ERROR_INCORRECT_STATE; } // Verify that public key in NOC matches public key generated by node and sent in CSRResponse message.