Skip to content

Commit

Permalink
Verify that public key in NOC matches public key generated by node an…
Browse files Browse the repository at this point in the history
…d sent in CSRResponse message. (#18530)
  • Loading branch information
emargolis authored and pull[bot] committed Jul 5, 2023
1 parent 83d8611 commit 368f817
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/credentials/FabricTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,10 @@ CHIP_ERROR FabricInfo::SetFabricInfo(FabricInfo & newFabric)
return CHIP_ERROR_INVALID_ARGUMENT;
}

// TODO: https://github.com/project-chip/connectedhomeip/issues/8433 -- Should verify that pubkey matches operationalKey's
// public key.
// Verify that public key in NOC matches public key generated by node and sent in CSRResponse message.
VerifyOrReturnError(operationalKey->Pubkey().Length() == pubkey.Length(), CHIP_ERROR_INVALID_PUBLIC_KEY);
VerifyOrReturnError(memcmp(operationalKey->Pubkey().ConstBytes(), pubkey.Bytes(), pubkey.Length()) == 0,
CHIP_ERROR_INVALID_PUBLIC_KEY);

if (newFabric.mHasExternallyOwnedOperationalKey)
{
Expand Down

0 comments on commit 368f817

Please sign in to comment.