-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Negative Test Cases for Invalid CATs in NOC. (#20998)
- Loading branch information
Showing
6 changed files
with
151 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* | ||
* Copyright (c) 2022 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "CHIPCert_error_test_vectors.h" | ||
|
||
namespace chip { | ||
namespace TestCerts { | ||
|
||
const uint8_t kTestErrorCert_NOC_0001_InvCATVerZero_Cert_Array[275] = { | ||
0x15, 0x30, 0x01, 0x08, 0x3b, 0x75, 0x5b, 0xc1, 0x54, 0xbe, 0x8b, 0x60, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x03, | ||
0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, | ||
0x37, 0x06, 0x27, 0x11, 0x01, 0x00, 0xee, 0xee, 0xde, 0xde, 0xde, 0xde, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0xb0, 0xfa, 0x26, 0x16, 0x00, 0x00, 0xcd, 0xab, 0x18, 0x24, 0x07, 0x01, 0x24, 0x08, 0x01, 0x30, 0x09, 0x41, 0x04, 0xff, | ||
0x23, 0x5d, 0x91, 0xf3, 0x3c, 0x04, 0x7f, 0x82, 0xf0, 0x2c, 0x86, 0x70, 0xbb, 0xd2, 0xb4, 0x34, 0x42, 0x44, 0x6b, 0xc2, | ||
0xb8, 0x38, 0x6a, 0x36, 0x90, 0x92, 0x36, 0xed, 0x5b, 0x4e, 0x63, 0x81, 0xe6, 0x6b, 0x30, 0x0f, 0x45, 0x75, 0xab, 0x88, | ||
0xba, 0xcb, 0xad, 0x4e, 0x5f, 0xfe, 0x7e, 0x83, 0x5f, 0xb3, 0xf1, 0xb3, 0x3a, 0x5d, 0xa7, 0x83, 0xf5, 0x07, 0x0e, 0xcf, | ||
0x91, 0xfb, 0x2b, 0x37, 0x0a, 0x35, 0x01, 0x28, 0x01, 0x18, 0x24, 0x02, 0x01, 0x36, 0x03, 0x04, 0x02, 0x04, 0x01, 0x18, | ||
0x30, 0x04, 0x14, 0x1b, 0xc5, 0xf6, 0x12, 0xf9, 0x6a, 0x92, 0xa1, 0x14, 0xbf, 0x2c, 0x77, 0x2f, 0x13, 0xcd, 0xd7, 0x14, | ||
0x2f, 0x14, 0xc8, 0x30, 0x05, 0x14, 0x34, 0x3d, 0xbd, 0x99, 0xff, 0xaf, 0xb3, 0x1e, 0xeb, 0x4f, 0x81, 0x4f, 0x6f, 0x9a, | ||
0x14, 0x74, 0xf1, 0xd4, 0x4f, 0xeb, 0x18, 0x30, 0x0b, 0x40, 0xb9, 0x80, 0xee, 0x56, 0xf7, 0x61, 0xd6, 0x85, 0xf8, 0x55, | ||
0x1a, 0x57, 0x07, 0xc1, 0x25, 0xbd, 0x6a, 0xc7, 0x80, 0x46, 0x85, 0x5b, 0x80, 0x28, 0x2e, 0x35, 0xf0, 0x60, 0x72, 0x68, | ||
0xf5, 0xe7, 0xd9, 0x9f, 0x3e, 0x27, 0xef, 0x29, 0x8b, 0xbf, 0x73, 0x05, 0xa2, 0x56, 0x73, 0x6e, 0xac, 0x8c, 0xd9, 0xf2, | ||
0xca, 0x59, 0x6e, 0xb1, 0x75, 0xf5, 0x74, 0xa9, 0x2e, 0x27, 0x1b, 0x7a, 0xba, 0x20, 0x18, | ||
}; | ||
const uint8_t kTestErrorCert_NOC_0001_InvCATVerZero_PublicKey_Array[65] = { | ||
0x04, 0xff, 0x23, 0x5d, 0x91, 0xf3, 0x3c, 0x04, 0x7f, 0x82, 0xf0, 0x2c, 0x86, 0x70, 0xbb, 0xd2, 0xb4, | ||
0x34, 0x42, 0x44, 0x6b, 0xc2, 0xb8, 0x38, 0x6a, 0x36, 0x90, 0x92, 0x36, 0xed, 0x5b, 0x4e, 0x63, 0x81, | ||
0xe6, 0x6b, 0x30, 0x0f, 0x45, 0x75, 0xab, 0x88, 0xba, 0xcb, 0xad, 0x4e, 0x5f, 0xfe, 0x7e, 0x83, 0x5f, | ||
0xb3, 0xf1, 0xb3, 0x3a, 0x5d, 0xa7, 0x83, 0xf5, 0x07, 0x0e, 0xcf, 0x91, 0xfb, 0x2b, | ||
}; | ||
const uint8_t kTestErrorCert_NOC_0001_InvCATVerZero_PrivateKey_Array[32] = { | ||
0x95, 0xa3, 0xa7, 0x23, 0x79, 0x8a, 0xf7, 0x44, 0x17, 0xe2, 0xa5, 0xa4, 0x4d, 0x18, 0xb5, 0x32, | ||
0x3e, 0x24, 0x83, 0x60, 0xcf, 0xdc, 0x5a, 0x13, 0xd1, 0xa8, 0xb4, 0x0a, 0x65, 0xe4, 0x0f, 0xbc, | ||
}; | ||
|
||
ByteSpan kTestErrorCert_NOC_0001_InvCATVerZero_Cert = ByteSpan(kTestErrorCert_NOC_0001_InvCATVerZero_Cert_Array); | ||
ByteSpan kTestErrorCert_NOC_0001_InvCATVerZero_PrivateKey = ByteSpan(kTestErrorCert_NOC_0001_InvCATVerZero_PrivateKey_Array); | ||
ByteSpan kTestErrorCert_NOC_0001_InvCATVerZero_PublicKey = ByteSpan(kTestErrorCert_NOC_0001_InvCATVerZero_PublicKey_Array); | ||
|
||
const uint8_t kTestErrorCert_NOC_0002_InvCATMulVers_Cert_Array[287] = { | ||
0x15, 0x30, 0x01, 0x08, 0x32, 0xf6, 0xd3, 0x7c, 0xfa, 0xd4, 0x71, 0xe2, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x03, 0x00, | ||
0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, | ||
0x26, 0x16, 0x04, 0x00, 0xcd, 0xab, 0x26, 0x16, 0x10, 0x00, 0x22, 0x22, 0x26, 0x16, 0x02, 0x00, 0xcd, 0xab, 0x27, 0x11, 0x02, | ||
0x00, 0xee, 0xee, 0xde, 0xde, 0xde, 0xde, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x24, 0x07, 0x01, | ||
0x24, 0x08, 0x01, 0x30, 0x09, 0x41, 0x04, 0x0e, 0x40, 0x23, 0x8b, 0xf6, 0x6e, 0xb5, 0x26, 0x01, 0xc4, 0xac, 0x57, 0x97, 0xdd, | ||
0xc3, 0x9a, 0x1a, 0x01, 0x85, 0xf4, 0x38, 0x34, 0x0d, 0xd5, 0x00, 0x5b, 0x8e, 0x23, 0x26, 0x18, 0x47, 0x3c, 0x47, 0x71, 0xb6, | ||
0x05, 0xe2, 0xab, 0x73, 0xd7, 0x95, 0xbf, 0xfc, 0x55, 0xdf, 0x31, 0x51, 0x40, 0xb0, 0xdd, 0x16, 0x47, 0x58, 0xca, 0xfd, 0x3c, | ||
0x65, 0x00, 0xa9, 0x0a, 0x9a, 0x85, 0xec, 0x72, 0x37, 0x0a, 0x35, 0x01, 0x28, 0x01, 0x18, 0x24, 0x02, 0x01, 0x36, 0x03, 0x04, | ||
0x02, 0x04, 0x01, 0x18, 0x30, 0x04, 0x14, 0x19, 0xf2, 0x66, 0x00, 0x88, 0xac, 0x5a, 0xf5, 0xd0, 0xac, 0xa3, 0xf8, 0xac, 0xec, | ||
0xb8, 0x6e, 0x3f, 0xe2, 0x77, 0x4f, 0x30, 0x05, 0x14, 0x34, 0x3d, 0xbd, 0x99, 0xff, 0xaf, 0xb3, 0x1e, 0xeb, 0x4f, 0x81, 0x4f, | ||
0x6f, 0x9a, 0x14, 0x74, 0xf1, 0xd4, 0x4f, 0xeb, 0x18, 0x30, 0x0b, 0x40, 0xba, 0xa7, 0xaf, 0x18, 0x14, 0x52, 0xe6, 0x06, 0x2d, | ||
0xd1, 0x0a, 0x9a, 0x6d, 0xd0, 0x5d, 0xdb, 0xc2, 0x2c, 0xd3, 0x17, 0x94, 0x75, 0x9e, 0x1c, 0x2b, 0x57, 0x4e, 0xbb, 0xd6, 0xa4, | ||
0x58, 0x52, 0x5a, 0x80, 0x60, 0xf2, 0x43, 0x21, 0x4b, 0xba, 0x9d, 0xd2, 0xc9, 0x2a, 0x3b, 0xe6, 0xab, 0x22, 0xe9, 0xe2, 0x29, | ||
0xc2, 0x13, 0xac, 0xf0, 0xf2, 0x4e, 0x6c, 0x63, 0xea, 0xfa, 0xb8, 0xaa, 0xc3, 0x18, | ||
}; | ||
const uint8_t kTestErrorCert_NOC_0002_InvCATMulVers_PublicKey_Array[65] = { | ||
0x04, 0x0e, 0x40, 0x23, 0x8b, 0xf6, 0x6e, 0xb5, 0x26, 0x01, 0xc4, 0xac, 0x57, 0x97, 0xdd, 0xc3, 0x9a, | ||
0x1a, 0x01, 0x85, 0xf4, 0x38, 0x34, 0x0d, 0xd5, 0x00, 0x5b, 0x8e, 0x23, 0x26, 0x18, 0x47, 0x3c, 0x47, | ||
0x71, 0xb6, 0x05, 0xe2, 0xab, 0x73, 0xd7, 0x95, 0xbf, 0xfc, 0x55, 0xdf, 0x31, 0x51, 0x40, 0xb0, 0xdd, | ||
0x16, 0x47, 0x58, 0xca, 0xfd, 0x3c, 0x65, 0x00, 0xa9, 0x0a, 0x9a, 0x85, 0xec, 0x72, | ||
}; | ||
const uint8_t kTestErrorCert_NOC_0002_InvCATMulVers_PrivateKey_Array[32] = { | ||
0x06, 0x1b, 0x1e, 0xfd, 0xac, 0x86, 0x9b, 0xec, 0xd3, 0x82, 0xc9, 0x8e, 0x63, 0x63, 0x2a, 0x35, | ||
0xc2, 0xef, 0x2a, 0x8e, 0x2d, 0xb1, 0x7b, 0x72, 0x55, 0x8c, 0x1c, 0xc7, 0x83, 0x8e, 0xaa, 0xee, | ||
}; | ||
|
||
ByteSpan kTestErrorCert_NOC_0002_InvCATMulVers_Cert = ByteSpan(kTestErrorCert_NOC_0002_InvCATMulVers_Cert_Array); | ||
ByteSpan kTestErrorCert_NOC_0002_InvCATMulVers_PrivateKey = ByteSpan(kTestErrorCert_NOC_0002_InvCATMulVers_PrivateKey_Array); | ||
ByteSpan kTestErrorCert_NOC_0002_InvCATMulVers_PublicKey = ByteSpan(kTestErrorCert_NOC_0002_InvCATMulVers_PublicKey_Array); | ||
|
||
} // namespace TestCerts | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* | ||
* Copyright (c) 2022 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
#include <lib/support/Span.h> | ||
|
||
namespace chip { | ||
namespace TestCerts { | ||
|
||
extern const uint8_t kTestErrorCert_NOC_0001_InvCATVerZero_Cert_Array[275]; | ||
extern const uint8_t kTestErrorCert_NOC_0001_InvCATVerZero_PublicKey_Array[65]; | ||
extern const uint8_t kTestErrorCert_NOC_0001_InvCATVerZero_PrivateKey_Array[32]; | ||
|
||
extern ByteSpan kTestErrorCert_NOC_0001_InvCATVerZero_Cert; | ||
extern ByteSpan kTestErrorCert_NOC_0001_InvCATVerZero_PrivateKey; | ||
extern ByteSpan kTestErrorCert_NOC_0001_InvCATVerZero_PublicKey; | ||
|
||
extern const uint8_t kTestErrorCert_NOC_0002_InvCATMulVers_Cert_Array[287]; | ||
extern const uint8_t kTestErrorCert_NOC_0002_InvCATMulVers_PublicKey_Array[65]; | ||
extern const uint8_t kTestErrorCert_NOC_0002_InvCATMulVers_PrivateKey_Array[32]; | ||
|
||
extern ByteSpan kTestErrorCert_NOC_0002_InvCATMulVers_Cert; | ||
extern ByteSpan kTestErrorCert_NOC_0002_InvCATMulVers_PrivateKey; | ||
extern ByteSpan kTestErrorCert_NOC_0002_InvCATMulVers_PublicKey; | ||
|
||
} // namespace TestCerts | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters