From 9ebd18a900bfdf78d07841cd6df40e926e1701da Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Thu, 14 Sep 2023 10:58:20 +1200 Subject: [PATCH] Make test vectors ByteSpans (#29200) This gets rid off some boilerplate compared to separate array and length symbols. --- .../tests/CHIPCert_test_vectors.cpp | 634 ++++++------------ src/credentials/tests/CHIPCert_test_vectors.h | 343 ++++------ src/credentials/tests/TestChipCert.cpp | 12 +- src/credentials/tests/TestFabricTable.cpp | 67 +- src/crypto/tests/CHIPCryptoPALTest.cpp | 2 +- .../secure_channel/tests/TestCASESession.cpp | 30 +- 6 files changed, 388 insertions(+), 700 deletions(-) diff --git a/src/credentials/tests/CHIPCert_test_vectors.cpp b/src/credentials/tests/CHIPCert_test_vectors.cpp index 314c13e6f8063e..9a21d934f52ec5 100644 --- a/src/credentials/tests/CHIPCert_test_vectors.cpp +++ b/src/credentials/tests/CHIPCert_test_vectors.cpp @@ -65,14 +65,7 @@ CHIP_ERROR GetTestCert(uint8_t certType, BitFlags certLoadFla { \ if (certType == TestCert::k##NAME) \ { \ - if (derForm) \ - { \ - cert = ByteSpan(sTestCert_##NAME##_DER, sTestCert_##NAME##_DER_Len); \ - } \ - else \ - { \ - cert = ByteSpan(sTestCert_##NAME##_Chip, sTestCert_##NAME##_Chip_Len); \ - } \ + cert = (derForm) ? sTestCert_##NAME##_DER : sTestCert_##NAME##_Chip; \ ExitNow(err = CHIP_NO_ERROR); \ } \ } while (0) @@ -113,7 +106,6 @@ const char * GetTestCertName(uint8_t certType) return #NAME; \ } \ } while (0) - NAME_CERT(Root01); NAME_CERT(Root02); NAME_CERT(Root03); @@ -146,7 +138,7 @@ CHIP_ERROR GetTestCertPubkey(uint8_t certType, ByteSpan & pubkey) { \ if (certType == TestCert::k##NAME) \ { \ - pubkey = ByteSpan(sTestCert_##NAME##_PublicKey, sTestCert_##NAME##_PublicKey_Len); \ + pubkey = sTestCert_##NAME##_PublicKey; \ ExitNow(err = CHIP_NO_ERROR); \ } \ } while (0) @@ -186,7 +178,7 @@ CHIP_ERROR GetTestCertSKID(uint8_t certType, ByteSpan & skid) { \ if (certType == TestCert::k##NAME) \ { \ - skid = ByteSpan(sTestCert_##NAME##_SubjectKeyId, sTestCert_##NAME##_SubjectKeyId_Len); \ + skid = sTestCert_##NAME##_SubjectKeyId; \ ExitNow(err = CHIP_NO_ERROR); \ } \ } while (0) @@ -226,7 +218,7 @@ CHIP_ERROR GetTestCertAKID(uint8_t certType, ByteSpan & akid) { \ if (certType == TestCert::k##NAME) \ { \ - akid = ByteSpan(sTestCert_##NAME##_AuthorityKeyId, sTestCert_##NAME##_AuthorityKeyId_Len); \ + akid = sTestCert_##NAME##_AuthorityKeyId; \ ExitNow(err = CHIP_NO_ERROR); \ } \ } while (0) @@ -358,7 +350,7 @@ NH9fh9CMMhPlQK8RurkTfkk1TwxbY0PeYw== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Root01_Chip[] = { +extern constexpr ByteSpan sTestCert_Root01_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x53, 0x4c, 0x45, 0x82, 0x73, 0x62, 0x35, 0x14, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x24, 0x07, 0x01, 0x24, 0x08, 0x01, 0x30, 0x09, 0x41, 0x04, @@ -371,11 +363,9 @@ extern const uint8_t sTestCert_Root01_Chip[] = { 0x09, 0x26, 0x90, 0x49, 0x4e, 0x46, 0xc8, 0xb1, 0xc5, 0xcb, 0xd1, 0xa5, 0x08, 0x5e, 0x1e, 0x65, 0xd4, 0x36, 0x0f, 0x98, 0xe9, 0x6c, 0x4e, 0x8e, 0x49, 0x5d, 0xc5, 0xe2, 0x16, 0xd0, 0xbf, 0xa2, 0x3d, 0x8f, 0x57, 0x47, 0x0d, 0x89, 0xfd, 0xda, 0xf0, 0x3f, 0x04, 0x64, 0xb0, 0xae, 0x8e, 0x1f, 0x95, 0x6d, 0x6f, 0x67, 0xa3, 0x11, 0x24, 0x38, 0x58, 0x24, 0x68, 0x97, 0x80, 0xa9, 0x18, -}; +}); -extern const size_t sTestCert_Root01_Chip_Len = sizeof(sTestCert_Root01_Chip); - -extern const uint8_t sTestCert_Root01_DER[] = { +extern constexpr ByteSpan sTestCert_Root01_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0x9e, 0x30, 0x82, 0x01, 0x43, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x53, 0x4c, 0x45, 0x82, 0x73, 0x62, 0x35, 0x14, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -396,37 +386,27 @@ extern const uint8_t sTestCert_Root01_DER[] = { 0x4e, 0x46, 0xc8, 0xb1, 0xc5, 0xcb, 0xd1, 0xa5, 0x08, 0x5e, 0x1e, 0x65, 0xd4, 0x36, 0x0f, 0x98, 0xe9, 0x6c, 0x4e, 0x8e, 0x49, 0x5d, 0xc5, 0xe2, 0x16, 0xd0, 0x02, 0x21, 0x00, 0xbf, 0xa2, 0x3d, 0x8f, 0x57, 0x47, 0x0d, 0x89, 0xfd, 0xda, 0xf0, 0x3f, 0x04, 0x64, 0xb0, 0xae, 0x8e, 0x1f, 0x95, 0x6d, 0x6f, 0x67, 0xa3, 0x11, 0x24, 0x38, 0x58, 0x24, 0x68, 0x97, 0x80, 0xa9, -}; +}); -extern const size_t sTestCert_Root01_DER_Len = sizeof(sTestCert_Root01_DER); - -extern const uint8_t sTestCert_Root01_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Root01_PublicKey((const uint8_t[]){ 0x04, 0x3b, 0x88, 0x46, 0x0e, 0xc9, 0x68, 0x7a, 0x5d, 0x0f, 0x3b, 0x4b, 0x3b, 0x13, 0xfc, 0xd2, 0x99, 0xc2, 0xf6, 0xd5, 0x05, 0x1d, 0x00, 0x3e, 0xe4, 0x9c, 0x99, 0x24, 0xcf, 0x98, 0xf4, 0xf7, 0x80, 0xeb, 0x20, 0xfd, 0x37, 0xc8, 0xd3, 0x58, 0x34, 0x7f, 0x5f, 0x87, 0xd0, 0x8c, 0x32, 0x13, 0xe5, 0x40, 0xaf, 0x11, 0xba, 0xb9, 0x13, 0x7e, 0x49, 0x35, 0x4f, 0x0c, 0x5b, 0x63, 0x43, 0xde, 0x63, -}; - -extern const size_t sTestCert_Root01_PublicKey_Len = sizeof(sTestCert_Root01_PublicKey); +}); -extern const uint8_t sTestCert_Root01_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Root01_PrivateKey((const uint8_t[]){ 0xfc, 0xdd, 0xfd, 0x91, 0x12, 0xb3, 0x0d, 0x24, 0x0f, 0x6a, 0xe6, 0xde, 0x27, 0xa2, 0x02, 0x9e, 0x7b, 0xb6, 0xe7, 0x43, 0x77, 0xe3, 0xb7, 0x97, 0x5d, 0x76, 0xd2, 0x3d, 0xe3, 0xc3, 0x68, 0x14, -}; - -extern const size_t sTestCert_Root01_PrivateKey_Len = sizeof(sTestCert_Root01_PrivateKey); +}); -extern const uint8_t sTestCert_Root01_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Root01_SubjectKeyId((const uint8_t[]){ 0xCC, 0x13, 0x08, 0xAF, 0x82, 0xCF, 0xEE, 0x50, 0x5E, 0xB2, 0x3B, 0x57, 0xBF, 0xE8, 0x6A, 0x31, 0x16, 0x65, 0x53, 0x5F, -}; +}); -extern const size_t sTestCert_Root01_SubjectKeyId_Len = sizeof(sTestCert_Root01_SubjectKeyId); - -extern const uint8_t sTestCert_Root01_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Root01_AuthorityKeyId((const uint8_t[]){ 0xCC, 0x13, 0x08, 0xAF, 0x82, 0xCF, 0xEE, 0x50, 0x5E, 0xB2, 0x3B, 0x57, 0xBF, 0xE8, 0x6A, 0x31, 0x16, 0x65, 0x53, 0x5F, -}; - -extern const size_t sTestCert_Root01_AuthorityKeyId_Len = sizeof(sTestCert_Root01_AuthorityKeyId); +}); /************** Test Root02 Certificate ************** Certificate: @@ -487,7 +467,7 @@ vKhW5Mx6jt6R4Kcz4WfAQWemwsn6SPFPCw== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Root02_Chip[] = { +extern constexpr ByteSpan sTestCert_Root02_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x60, 0x0d, 0x2d, 0x65, 0x4a, 0xc8, 0xa0, 0x98, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x02, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x14, 0x02, 0x00, 0x00, 0x00, 0xca, 0xca, @@ -502,11 +482,9 @@ extern const uint8_t sTestCert_Root02_Chip[] = { 0x10, 0xf7, 0x2a, 0x7a, 0xb1, 0x5a, 0x91, 0x60, 0xb7, 0xf0, 0x38, 0x6c, 0xe8, 0x19, 0x36, 0xd1, 0x5a, 0xcd, 0x19, 0xc8, 0xc0, 0x4a, 0xd1, 0x9d, 0x3e, 0xb5, 0xc7, 0xea, 0xf1, 0xa5, 0xcb, 0x06, 0x43, 0xbb, 0x67, 0x68, 0x54, 0x02, 0xe2, 0xff, 0x1e, 0x65, 0x80, 0xbc, 0xc5, 0x2c, 0x2b, 0x03, 0xa3, 0xb6, 0xa4, 0x92, 0x00, 0x5e, 0x18, -}; - -extern const size_t sTestCert_Root02_Chip_Len = sizeof(sTestCert_Root02_Chip); +}); -extern const uint8_t sTestCert_Root02_DER[] = { +extern constexpr ByteSpan sTestCert_Root02_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0xe5, 0x30, 0x82, 0x01, 0x8a, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x60, 0x0d, 0x2d, 0x65, 0x4a, 0xc8, 0xa0, 0x98, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -531,37 +509,27 @@ extern const uint8_t sTestCert_Root02_DER[] = { 0xf0, 0x38, 0x6c, 0xe8, 0x19, 0x36, 0xd1, 0x5a, 0xcd, 0x19, 0xc8, 0xc0, 0x4a, 0x02, 0x21, 0x00, 0xd1, 0x9d, 0x3e, 0xb5, 0xc7, 0xea, 0xf1, 0xa5, 0xcb, 0x06, 0x43, 0xbb, 0x67, 0x68, 0x54, 0x02, 0xe2, 0xff, 0x1e, 0x65, 0x80, 0xbc, 0xc5, 0x2c, 0x2b, 0x03, 0xa3, 0xb6, 0xa4, 0x92, 0x00, 0x5e, -}; - -extern const size_t sTestCert_Root02_DER_Len = sizeof(sTestCert_Root02_DER); +}); -extern const uint8_t sTestCert_Root02_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Root02_PublicKey((const uint8_t[]){ 0x04, 0x27, 0x50, 0x0b, 0x20, 0x60, 0x52, 0xce, 0x33, 0x77, 0x6c, 0x63, 0x08, 0x3f, 0x1c, 0xf1, 0x03, 0x6e, 0xa4, 0xcc, 0x7f, 0xfd, 0x61, 0x7c, 0x17, 0x6d, 0x4c, 0xad, 0xf5, 0x51, 0xbb, 0xb4, 0xb0, 0xd9, 0x97, 0xca, 0xe5, 0x55, 0xdb, 0xf9, 0xbc, 0xa8, 0x56, 0xe4, 0xcc, 0x7a, 0x8e, 0xde, 0x91, 0xe0, 0xa7, 0x33, 0xe1, 0x67, 0xc0, 0x41, 0x67, 0xa6, 0xc2, 0xc9, 0xfa, 0x48, 0xf1, 0x4f, 0x0b, -}; - -extern const size_t sTestCert_Root02_PublicKey_Len = sizeof(sTestCert_Root02_PublicKey); +}); -extern const uint8_t sTestCert_Root02_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Root02_PrivateKey((const uint8_t[]){ 0xf9, 0xb7, 0x22, 0x87, 0xd6, 0xa4, 0x8d, 0xd5, 0x10, 0x93, 0xc4, 0x12, 0xe6, 0x1b, 0x43, 0xaf, 0xe1, 0x22, 0x15, 0x28, 0x96, 0x71, 0xbf, 0x33, 0x96, 0xff, 0x97, 0xf6, 0xb6, 0x21, 0xb2, 0xac, -}; +}); -extern const size_t sTestCert_Root02_PrivateKey_Len = sizeof(sTestCert_Root02_PrivateKey); - -extern const uint8_t sTestCert_Root02_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Root02_SubjectKeyId((const uint8_t[]){ 0x62, 0xBE, 0xB9, 0x67, 0x1C, 0x91, 0xC3, 0x55, 0xC8, 0x6F, 0x06, 0xFA, 0x6C, 0x08, 0x80, 0x14, 0x51, 0xE1, 0xA0, 0xEA, -}; - -extern const size_t sTestCert_Root02_SubjectKeyId_Len = sizeof(sTestCert_Root02_SubjectKeyId); +}); -extern const uint8_t sTestCert_Root02_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Root02_AuthorityKeyId((const uint8_t[]){ 0x62, 0xBE, 0xB9, 0x67, 0x1C, 0x91, 0xC3, 0x55, 0xC8, 0x6F, 0x06, 0xFA, 0x6C, 0x08, 0x80, 0x14, 0x51, 0xE1, 0xA0, 0xEA, -}; - -extern const size_t sTestCert_Root02_AuthorityKeyId_Len = sizeof(sTestCert_Root02_AuthorityKeyId); +}); /************** Test Root03 Certificate ************** Certificate: @@ -622,7 +590,7 @@ NhzYKeVf3WPM9XntROAiCLT4JfzW8GgsAg== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Root03_Chip[] = { +extern constexpr ByteSpan sTestCert_Root03_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x6b, 0x78, 0x7a, 0x6d, 0xfc, 0xd4, 0xbf, 0x81, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x02, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x24, 0x05, 0x00, 0x37, 0x06, 0x27, 0x14, 0x02, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, @@ -636,11 +604,9 @@ extern const uint8_t sTestCert_Root03_Chip[] = { 0xeb, 0x35, 0x45, 0xb9, 0x97, 0x86, 0x46, 0x67, 0x99, 0xeb, 0xea, 0x40, 0x51, 0xa3, 0x41, 0xaf, 0x2a, 0x9b, 0x67, 0x7f, 0xd7, 0x1b, 0x4c, 0x3d, 0x4e, 0x68, 0x09, 0x3b, 0x66, 0x5f, 0x28, 0x42, 0xcb, 0x7e, 0xd3, 0x19, 0x9c, 0x9a, 0xd7, 0xc9, 0x62, 0x79, 0x47, 0xa1, 0x8a, 0x92, 0x16, 0x8a, 0xfc, 0xd6, 0x5f, 0x3e, 0x9c, 0xaf, 0x6e, 0xed, 0xfa, 0x9e, 0x60, 0xc5, 0x2f, 0x18, -}; +}); -extern const size_t sTestCert_Root03_Chip_Len = sizeof(sTestCert_Root03_Chip); - -extern const uint8_t sTestCert_Root03_DER[] = { +extern constexpr ByteSpan sTestCert_Root03_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0xe5, 0x30, 0x82, 0x01, 0x8c, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x6b, 0x78, 0x7a, 0x6d, 0xfc, 0xd4, 0xbf, 0x81, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -665,37 +631,27 @@ extern const uint8_t sTestCert_Root03_DER[] = { 0xaf, 0x2a, 0x9b, 0x67, 0x7f, 0xd7, 0x1b, 0x4c, 0x3d, 0x4e, 0x68, 0x09, 0x3b, 0x66, 0x02, 0x20, 0x5f, 0x28, 0x42, 0xcb, 0x7e, 0xd3, 0x19, 0x9c, 0x9a, 0xd7, 0xc9, 0x62, 0x79, 0x47, 0xa1, 0x8a, 0x92, 0x16, 0x8a, 0xfc, 0xd6, 0x5f, 0x3e, 0x9c, 0xaf, 0x6e, 0xed, 0xfa, 0x9e, 0x60, 0xc5, 0x2f, -}; +}); -extern const size_t sTestCert_Root03_DER_Len = sizeof(sTestCert_Root03_DER); - -extern const uint8_t sTestCert_Root03_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Root03_PublicKey((const uint8_t[]){ 0x04, 0x71, 0x05, 0x40, 0x8a, 0x85, 0xa9, 0xd9, 0xa0, 0x8a, 0xf8, 0xb7, 0x70, 0x77, 0xdb, 0x38, 0x8b, 0x7e, 0xa4, 0x38, 0x97, 0xdc, 0xdf, 0xd3, 0x16, 0xf2, 0x4f, 0x0a, 0x7e, 0x71, 0xde, 0x69, 0xa5, 0x0c, 0x44, 0x55, 0x0c, 0x0c, 0x9d, 0xa2, 0x36, 0x1c, 0xd8, 0x29, 0xe5, 0x5f, 0xdd, 0x63, 0xcc, 0xf5, 0x79, 0xed, 0x44, 0xe0, 0x22, 0x08, 0xb4, 0xf8, 0x25, 0xfc, 0xd6, 0xf0, 0x68, 0x2c, 0x02, -}; +}); -extern const size_t sTestCert_Root03_PublicKey_Len = sizeof(sTestCert_Root03_PublicKey); - -extern const uint8_t sTestCert_Root03_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Root03_PrivateKey((const uint8_t[]){ 0x70, 0xe7, 0x6d, 0x00, 0x29, 0x28, 0x81, 0xe4, 0xb5, 0xa5, 0xbc, 0xb4, 0xec, 0xd0, 0x2f, 0xf5, 0xe4, 0x75, 0xbc, 0x14, 0x89, 0xde, 0x6e, 0xc3, 0xe8, 0xd6, 0x3c, 0x5a, 0x3f, 0x2e, 0x5a, 0x87, -}; - -extern const size_t sTestCert_Root03_PrivateKey_Len = sizeof(sTestCert_Root03_PrivateKey); +}); -extern const uint8_t sTestCert_Root03_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Root03_SubjectKeyId((const uint8_t[]){ 0xFF, 0x87, 0xF3, 0xCD, 0xD2, 0x06, 0x9A, 0xEF, 0x8D, 0x5D, 0x32, 0xEB, 0xA3, 0x16, 0x3B, 0x9E, 0xB0, 0x0A, 0x00, 0x29, -}; - -extern const size_t sTestCert_Root03_SubjectKeyId_Len = sizeof(sTestCert_Root03_SubjectKeyId); +}); -extern const uint8_t sTestCert_Root03_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Root03_AuthorityKeyId((const uint8_t[]){ 0xFF, 0x87, 0xF3, 0xCD, 0xD2, 0x06, 0x9A, 0xEF, 0x8D, 0x5D, 0x32, 0xEB, 0xA3, 0x16, 0x3B, 0x9E, 0xB0, 0x0A, 0x00, 0x29, -}; - -extern const size_t sTestCert_Root03_AuthorityKeyId_Len = sizeof(sTestCert_Root03_AuthorityKeyId); +}); /************** Test ICA01 Certificate ************** Certificate: @@ -754,7 +710,7 @@ AwEHoUQDQgAEX5T1fgsTyc/Plt/h/OeIjVZMwgnFXEUI5E3PFrouCWYvnuzxn0Cw -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_ICA01_Chip[] = { +extern constexpr ByteSpan sTestCert_ICA01_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x69, 0xd8, 0x6a, 0x8d, 0x80, 0xfc, 0x8f, 0x5d, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x13, 0x03, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x24, 0x07, 0x01, 0x24, 0x08, 0x01, 0x30, 0x09, 0x41, 0x04, @@ -767,11 +723,9 @@ extern const uint8_t sTestCert_ICA01_Chip[] = { 0x5b, 0x5d, 0x68, 0xcb, 0xfd, 0x36, 0x14, 0x0d, 0x8c, 0x9d, 0x12, 0x90, 0x14, 0xc4, 0x5f, 0xa7, 0xca, 0x19, 0x1f, 0x34, 0xd9, 0xaf, 0x24, 0x1d, 0xb7, 0x17, 0x36, 0xe6, 0x0f, 0x44, 0x19, 0x9b, 0xc0, 0x7c, 0x7f, 0x79, 0x5b, 0xed, 0x81, 0xa2, 0xe7, 0x7d, 0xc5, 0x34, 0x25, 0x76, 0xf6, 0xa0, 0xd1, 0x41, 0x98, 0xf4, 0x6b, 0x91, 0x07, 0x49, 0x42, 0x7c, 0x2e, 0xed, 0x65, 0x9c, 0x18, -}; - -extern const size_t sTestCert_ICA01_Chip_Len = sizeof(sTestCert_ICA01_Chip); +}); -extern const uint8_t sTestCert_ICA01_DER[] = { +extern constexpr ByteSpan sTestCert_ICA01_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0x9d, 0x30, 0x82, 0x01, 0x43, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x69, 0xd8, 0x6a, 0x8d, 0x80, 0xfc, 0x8f, 0x5d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -792,37 +746,27 @@ extern const uint8_t sTestCert_ICA01_DER[] = { 0xfd, 0x36, 0x14, 0x0d, 0x8c, 0x9d, 0x12, 0x90, 0x14, 0xc4, 0x5f, 0xa7, 0xca, 0x19, 0x1f, 0x34, 0xd9, 0xaf, 0x24, 0x1d, 0xb7, 0x17, 0x36, 0xe6, 0x0f, 0x44, 0x02, 0x20, 0x19, 0x9b, 0xc0, 0x7c, 0x7f, 0x79, 0x5b, 0xed, 0x81, 0xa2, 0xe7, 0x7d, 0xc5, 0x34, 0x25, 0x76, 0xf6, 0xa0, 0xd1, 0x41, 0x98, 0xf4, 0x6b, 0x91, 0x07, 0x49, 0x42, 0x7c, 0x2e, 0xed, 0x65, 0x9c, -}; - -extern const size_t sTestCert_ICA01_DER_Len = sizeof(sTestCert_ICA01_DER); +}); -extern const uint8_t sTestCert_ICA01_PublicKey[] = { +extern constexpr ByteSpan sTestCert_ICA01_PublicKey((const uint8_t[]){ 0x04, 0x5f, 0x94, 0xf5, 0x7e, 0x0b, 0x13, 0xc9, 0xcf, 0xcf, 0x96, 0xdf, 0xe1, 0xfc, 0xe7, 0x88, 0x8d, 0x56, 0x4c, 0xc2, 0x09, 0xc5, 0x5c, 0x45, 0x08, 0xe4, 0x4d, 0xcf, 0x16, 0xba, 0x2e, 0x09, 0x66, 0x2f, 0x9e, 0xec, 0xf1, 0x9f, 0x40, 0xb0, 0xe8, 0x8a, 0x0b, 0x28, 0x15, 0xda, 0x9e, 0xe1, 0x0a, 0x3a, 0x17, 0x7c, 0x25, 0x1f, 0x43, 0x4f, 0x5b, 0x0f, 0x26, 0x3c, 0xe7, 0xde, 0x62, 0x78, 0xc6, -}; - -extern const size_t sTestCert_ICA01_PublicKey_Len = sizeof(sTestCert_ICA01_PublicKey); +}); -extern const uint8_t sTestCert_ICA01_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_ICA01_PrivateKey((const uint8_t[]){ 0x9e, 0x16, 0xbd, 0x8a, 0x17, 0xb2, 0xf1, 0xc2, 0x14, 0x21, 0x0f, 0x51, 0x60, 0x7e, 0x97, 0x96, 0xcb, 0x59, 0x60, 0x41, 0x53, 0x57, 0xd3, 0x8a, 0xb8, 0x6c, 0xc4, 0xd5, 0x96, 0x21, 0x2e, 0x97, -}; - -extern const size_t sTestCert_ICA01_PrivateKey_Len = sizeof(sTestCert_ICA01_PrivateKey); +}); -extern const uint8_t sTestCert_ICA01_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_ICA01_SubjectKeyId((const uint8_t[]){ 0x44, 0x0C, 0xC6, 0x92, 0x31, 0xC4, 0xCB, 0x5B, 0x37, 0x94, 0x24, 0x26, 0xF8, 0x1B, 0xBE, 0x24, 0xB7, 0xEF, 0x34, 0x5C, -}; +}); -extern const size_t sTestCert_ICA01_SubjectKeyId_Len = sizeof(sTestCert_ICA01_SubjectKeyId); - -extern const uint8_t sTestCert_ICA01_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_ICA01_AuthorityKeyId((const uint8_t[]){ 0xCC, 0x13, 0x08, 0xAF, 0x82, 0xCF, 0xEE, 0x50, 0x5E, 0xB2, 0x3B, 0x57, 0xBF, 0xE8, 0x6A, 0x31, 0x16, 0x65, 0x53, 0x5F, -}; - -extern const size_t sTestCert_ICA01_AuthorityKeyId_Len = sizeof(sTestCert_ICA01_AuthorityKeyId); +}); /************** Test ICA02 Certificate ************** Certificate: @@ -883,7 +827,7 @@ dBd1fg57dnI02csD3HUompl0vj33YadWvg== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_ICA02_Chip[] = { +extern constexpr ByteSpan sTestCert_ICA02_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x1c, 0xc5, 0x8f, 0xbf, 0xee, 0x96, 0x45, 0x4a, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x02, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, @@ -898,11 +842,9 @@ extern const uint8_t sTestCert_ICA02_Chip[] = { 0x20, 0x76, 0xeb, 0xe2, 0x4b, 0x5e, 0x79, 0xe2, 0xbb, 0x98, 0xf2, 0x14, 0xab, 0x6e, 0xe8, 0xf0, 0x43, 0x7c, 0x55, 0x7d, 0xe7, 0x43, 0xc7, 0x53, 0xda, 0xe7, 0xdd, 0xf3, 0xb0, 0x27, 0xc2, 0xf1, 0x3e, 0x23, 0xce, 0x3a, 0x3a, 0xb9, 0xd4, 0x34, 0xfc, 0x7e, 0xa1, 0x5b, 0xb9, 0xd6, 0x77, 0xc3, 0x6c, 0x9c, 0x8b, 0x55, 0x15, 0x42, 0x18, -}; - -extern const size_t sTestCert_ICA02_Chip_Len = sizeof(sTestCert_ICA02_Chip); +}); -extern const uint8_t sTestCert_ICA02_DER[] = { +extern constexpr ByteSpan sTestCert_ICA02_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0xe4, 0x30, 0x82, 0x01, 0x8a, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x1c, 0xc5, 0x8f, 0xbf, 0xee, 0x96, 0x45, 0x4a, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -927,37 +869,27 @@ extern const uint8_t sTestCert_ICA02_DER[] = { 0xf2, 0x14, 0xab, 0x6e, 0xe8, 0xf0, 0x43, 0x7c, 0x55, 0x7d, 0xe7, 0x43, 0x02, 0x21, 0x00, 0xc7, 0x53, 0xda, 0xe7, 0xdd, 0xf3, 0xb0, 0x27, 0xc2, 0xf1, 0x3e, 0x23, 0xce, 0x3a, 0x3a, 0xb9, 0xd4, 0x34, 0xfc, 0x7e, 0xa1, 0x5b, 0xb9, 0xd6, 0x77, 0xc3, 0x6c, 0x9c, 0x8b, 0x55, 0x15, 0x42, -}; +}); -extern const size_t sTestCert_ICA02_DER_Len = sizeof(sTestCert_ICA02_DER); - -extern const uint8_t sTestCert_ICA02_PublicKey[] = { +extern constexpr ByteSpan sTestCert_ICA02_PublicKey((const uint8_t[]){ 0x04, 0xfa, 0x9f, 0xd2, 0x8c, 0xb7, 0x6a, 0x77, 0xef, 0x0e, 0x39, 0x30, 0xd5, 0x9e, 0x41, 0x2b, 0xd1, 0x8e, 0xb2, 0x0e, 0xff, 0xd5, 0x19, 0x7e, 0xf4, 0x71, 0x39, 0x37, 0x93, 0x90, 0x37, 0x8a, 0x48, 0x04, 0x32, 0x48, 0x18, 0x9c, 0xc4, 0xa9, 0x74, 0x17, 0x75, 0x7e, 0x0e, 0x7b, 0x76, 0x72, 0x34, 0xd9, 0xcb, 0x03, 0xdc, 0x75, 0x28, 0x9a, 0x99, 0x74, 0xbe, 0x3d, 0xf7, 0x61, 0xa7, 0x56, 0xbe, -}; +}); -extern const size_t sTestCert_ICA02_PublicKey_Len = sizeof(sTestCert_ICA02_PublicKey); - -extern const uint8_t sTestCert_ICA02_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_ICA02_PrivateKey((const uint8_t[]){ 0xba, 0x76, 0x7a, 0xd5, 0x59, 0xe3, 0x15, 0xfb, 0xa7, 0x01, 0x98, 0xdd, 0x8f, 0xc9, 0x76, 0x20, 0x83, 0x05, 0x94, 0xfa, 0x5e, 0xbb, 0x5a, 0xf0, 0x90, 0xf5, 0x8e, 0xff, 0x1b, 0x9d, 0x60, 0xa5, -}; +}); -extern const size_t sTestCert_ICA02_PrivateKey_Len = sizeof(sTestCert_ICA02_PrivateKey); - -extern const uint8_t sTestCert_ICA02_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_ICA02_SubjectKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_ICA02_SubjectKeyId_Len = sizeof(sTestCert_ICA02_SubjectKeyId); +}); -extern const uint8_t sTestCert_ICA02_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_ICA02_AuthorityKeyId((const uint8_t[]){ 0x62, 0xBE, 0xB9, 0x67, 0x1C, 0x91, 0xC3, 0x55, 0xC8, 0x6F, 0x06, 0xFA, 0x6C, 0x08, 0x80, 0x14, 0x51, 0xE1, 0xA0, 0xEA, -}; - -extern const size_t sTestCert_ICA02_AuthorityKeyId_Len = sizeof(sTestCert_ICA02_AuthorityKeyId); +}); /************** Test ICA01_1 Certificate ************** Certificate: @@ -1016,7 +948,7 @@ fzs31dpp0M9gTEHElk+tLXBFaNa+jK/a7g== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_ICA01_1_Chip[] = { +extern constexpr ByteSpan sTestCert_ICA01_1_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x36, 0xed, 0x10, 0xc3, 0x95, 0x64, 0x59, 0x78, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x13, 0x05, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x24, 0x07, 0x01, 0x24, 0x08, 0x01, 0x30, 0x09, 0x41, 0x04, @@ -1029,11 +961,9 @@ extern const uint8_t sTestCert_ICA01_1_Chip[] = { 0x4d, 0x4b, 0x8e, 0xe1, 0x66, 0x9f, 0x49, 0x85, 0x97, 0x04, 0x83, 0xe4, 0x00, 0x00, 0x9e, 0xd0, 0x46, 0xb3, 0x4e, 0xdc, 0x11, 0x8a, 0xcd, 0xb4, 0xed, 0xea, 0xb6, 0x21, 0x71, 0xbe, 0x7e, 0x80, 0xd5, 0xc2, 0x98, 0x5d, 0x6c, 0x6a, 0xb2, 0x55, 0xc3, 0xc4, 0xad, 0x55, 0x4c, 0x72, 0x70, 0x04, 0x8c, 0x26, 0xd6, 0xe6, 0xd3, 0xe9, 0xc2, 0xe7, 0x1f, 0xb2, 0x0a, 0xf2, 0xf0, 0xfe, 0x18, -}; +}); -extern const size_t sTestCert_ICA01_1_Chip_Len = sizeof(sTestCert_ICA01_1_Chip); - -extern const uint8_t sTestCert_ICA01_1_DER[] = { +extern constexpr ByteSpan sTestCert_ICA01_1_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0x9d, 0x30, 0x82, 0x01, 0x43, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x36, 0xed, 0x10, 0xc3, 0x95, 0x64, 0x59, 0x78, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -1054,37 +984,27 @@ extern const uint8_t sTestCert_ICA01_1_DER[] = { 0x66, 0x9f, 0x49, 0x85, 0x97, 0x04, 0x83, 0xe4, 0x00, 0x00, 0x9e, 0xd0, 0x46, 0xb3, 0x4e, 0xdc, 0x11, 0x8a, 0xcd, 0xb4, 0xed, 0xea, 0xb6, 0x21, 0x71, 0xbe, 0x02, 0x20, 0x7e, 0x80, 0xd5, 0xc2, 0x98, 0x5d, 0x6c, 0x6a, 0xb2, 0x55, 0xc3, 0xc4, 0xad, 0x55, 0x4c, 0x72, 0x70, 0x04, 0x8c, 0x26, 0xd6, 0xe6, 0xd3, 0xe9, 0xc2, 0xe7, 0x1f, 0xb2, 0x0a, 0xf2, 0xf0, 0xfe, -}; - -extern const size_t sTestCert_ICA01_1_DER_Len = sizeof(sTestCert_ICA01_1_DER); +}); -extern const uint8_t sTestCert_ICA01_1_PublicKey[] = { +extern constexpr ByteSpan sTestCert_ICA01_1_PublicKey((const uint8_t[]){ 0x04, 0xe1, 0xd5, 0x3a, 0x9c, 0x25, 0x7a, 0xe3, 0x2b, 0xab, 0x05, 0x77, 0x89, 0x06, 0x03, 0x13, 0x91, 0xb5, 0x8a, 0xdf, 0x9f, 0x8a, 0xb2, 0x69, 0x38, 0xad, 0xeb, 0xf1, 0x39, 0x6c, 0xf1, 0x2c, 0x4a, 0x41, 0x45, 0xba, 0xd8, 0x5e, 0x92, 0xeb, 0x7f, 0x3b, 0x37, 0xd5, 0xda, 0x69, 0xd0, 0xcf, 0x60, 0x4c, 0x41, 0xc4, 0x96, 0x4f, 0xad, 0x2d, 0x70, 0x45, 0x68, 0xd6, 0xbe, 0x8c, 0xaf, 0xda, 0xee, -}; - -extern const size_t sTestCert_ICA01_1_PublicKey_Len = sizeof(sTestCert_ICA01_1_PublicKey); +}); -extern const uint8_t sTestCert_ICA01_1_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_ICA01_1_PrivateKey((const uint8_t[]){ 0x93, 0xdb, 0xce, 0x6a, 0x6b, 0xf8, 0xdb, 0x3c, 0x4a, 0x96, 0xdd, 0x28, 0x2f, 0x4c, 0xb8, 0xf0, 0x6b, 0xca, 0x61, 0x6f, 0xb9, 0x00, 0x9e, 0xd6, 0x4a, 0x49, 0x0f, 0xb0, 0x65, 0x83, 0xaf, 0x8d, -}; - -extern const size_t sTestCert_ICA01_1_PrivateKey_Len = sizeof(sTestCert_ICA01_1_PrivateKey); +}); -extern const uint8_t sTestCert_ICA01_1_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_ICA01_1_SubjectKeyId((const uint8_t[]){ 0x50, 0x6F, 0xC3, 0xFC, 0xB7, 0x94, 0x15, 0x88, 0xEA, 0x73, 0x6C, 0x20, 0x65, 0x2E, 0x5F, 0x1B, 0x11, 0x70, 0x1C, 0x6A, -}; - -extern const size_t sTestCert_ICA01_1_SubjectKeyId_Len = sizeof(sTestCert_ICA01_1_SubjectKeyId); +}); -extern const uint8_t sTestCert_ICA01_1_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_ICA01_1_AuthorityKeyId((const uint8_t[]){ 0xCC, 0x13, 0x08, 0xAF, 0x82, 0xCF, 0xEE, 0x50, 0x5E, 0xB2, 0x3B, 0x57, 0xBF, 0xE8, 0x6A, 0x31, 0x16, 0x65, 0x53, 0x5F, -}; - -extern const size_t sTestCert_ICA01_1_AuthorityKeyId_Len = sizeof(sTestCert_ICA01_1_AuthorityKeyId); +}); /************** Test FWSign01 Certificate ************** Certificate: @@ -1146,7 +1066,7 @@ NKYNQg/SuZ6UK2r4pQ8SdlNcT/AyYXndeA== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_FWSign01_Chip[] = { +extern constexpr ByteSpan sTestCert_FWSign01_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x7a, 0x60, 0x2b, 0x09, 0x23, 0x72, 0xc1, 0xf8, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x05, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x12, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x2c, 0x01, 0x0f, 0x46, 0x57, 0x20, 0x53, 0x49, @@ -1161,11 +1081,9 @@ extern const uint8_t sTestCert_FWSign01_Chip[] = { 0x38, 0x66, 0x6d, 0x5a, 0x7b, 0xe6, 0xe6, 0x62, 0x09, 0xaf, 0x29, 0x4e, 0xa4, 0x63, 0xb4, 0x95, 0x1c, 0xad, 0xd7, 0xc4, 0x6f, 0x5a, 0xa7, 0x4a, 0x4d, 0x56, 0x0f, 0x89, 0x7d, 0x53, 0x65, 0xa8, 0x9f, 0xde, 0x38, 0xf3, 0xf9, 0x11, 0x72, 0x48, 0x39, 0x1c, 0xf5, 0xbc, 0x76, 0x16, 0xf6, 0x99, 0x08, 0x59, 0x33, 0xd5, 0x63, 0xc9, 0x18, -}; - -extern const size_t sTestCert_FWSign01_Chip_Len = sizeof(sTestCert_FWSign01_Chip); +}); -extern const uint8_t sTestCert_FWSign01_DER[] = { +extern constexpr ByteSpan sTestCert_FWSign01_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0xcd, 0x30, 0x82, 0x01, 0x72, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x7a, 0x60, 0x2b, 0x09, 0x23, 0x72, 0xc1, 0xf8, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -1189,37 +1107,27 @@ extern const uint8_t sTestCert_FWSign01_DER[] = { 0xa4, 0x63, 0xb4, 0x95, 0x1c, 0xad, 0xd7, 0xc4, 0x6f, 0x5a, 0x02, 0x21, 0x00, 0xa7, 0x4a, 0x4d, 0x56, 0x0f, 0x89, 0x7d, 0x53, 0x65, 0xa8, 0x9f, 0xde, 0x38, 0xf3, 0xf9, 0x11, 0x72, 0x48, 0x39, 0x1c, 0xf5, 0xbc, 0x76, 0x16, 0xf6, 0x99, 0x08, 0x59, 0x33, 0xd5, 0x63, 0xc9, -}; - -extern const size_t sTestCert_FWSign01_DER_Len = sizeof(sTestCert_FWSign01_DER); +}); -extern const uint8_t sTestCert_FWSign01_PublicKey[] = { +extern constexpr ByteSpan sTestCert_FWSign01_PublicKey((const uint8_t[]){ 0x04, 0xfd, 0x2a, 0xe4, 0x0a, 0x74, 0x7c, 0x6d, 0x5a, 0xc6, 0xc8, 0xdc, 0x79, 0x61, 0x2b, 0x9a, 0x85, 0x3c, 0x3e, 0x0f, 0xb4, 0x1c, 0x94, 0xff, 0x08, 0x5b, 0x4e, 0x1d, 0x02, 0x24, 0x85, 0x98, 0x65, 0xea, 0x6c, 0x7d, 0x67, 0xbb, 0x88, 0x84, 0x34, 0xa6, 0x0d, 0x42, 0x0f, 0xd2, 0xb9, 0x9e, 0x94, 0x2b, 0x6a, 0xf8, 0xa5, 0x0f, 0x12, 0x76, 0x53, 0x5c, 0x4f, 0xf0, 0x32, 0x61, 0x79, 0xdd, 0x78, -}; +}); -extern const size_t sTestCert_FWSign01_PublicKey_Len = sizeof(sTestCert_FWSign01_PublicKey); - -extern const uint8_t sTestCert_FWSign01_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_FWSign01_PrivateKey((const uint8_t[]){ 0x61, 0xf3, 0xa0, 0x66, 0x9c, 0x21, 0x2d, 0x23, 0x9f, 0x71, 0x7b, 0xce, 0xae, 0x22, 0xa5, 0x73, 0x95, 0x4a, 0x6f, 0x92, 0x15, 0x37, 0xa3, 0x85, 0x42, 0x27, 0x6d, 0xbb, 0x30, 0x89, 0x2d, 0xe0, -}; +}); -extern const size_t sTestCert_FWSign01_PrivateKey_Len = sizeof(sTestCert_FWSign01_PrivateKey); - -extern const uint8_t sTestCert_FWSign01_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_FWSign01_SubjectKeyId((const uint8_t[]){ 0x52, 0x25, 0xD5, 0x83, 0xFB, 0x71, 0x8A, 0x7C, 0x64, 0x51, 0xFD, 0xAF, 0x92, 0x2A, 0xCD, 0x2D, 0x36, 0x10, 0x05, 0xC7, -}; +}); -extern const size_t sTestCert_FWSign01_SubjectKeyId_Len = sizeof(sTestCert_FWSign01_SubjectKeyId); - -extern const uint8_t sTestCert_FWSign01_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_FWSign01_AuthorityKeyId((const uint8_t[]){ 0x50, 0x6F, 0xC3, 0xFC, 0xB7, 0x94, 0x15, 0x88, 0xEA, 0x73, 0x6C, 0x20, 0x65, 0x2E, 0x5F, 0x1B, 0x11, 0x70, 0x1C, 0x6A, -}; - -extern const size_t sTestCert_FWSign01_AuthorityKeyId_Len = sizeof(sTestCert_FWSign01_AuthorityKeyId); +}); /************** Test Node01_01 Certificate ************** Certificate: @@ -1282,7 +1190,7 @@ rB5zy3KgVLag2wYiqoBwcQFjE7FZbIVSzw== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node01_01_Chip[] = { +extern constexpr ByteSpan sTestCert_Node01_01_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x18, 0xe9, 0x69, 0xba, 0x0e, 0x08, 0x9e, 0x23, 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, 0x01, 0x00, 0xde, 0xde, 0xde, 0xde, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, @@ -1296,15 +1204,13 @@ extern const uint8_t sTestCert_Node01_01_Chip[] = { 0x94, 0xf8, 0x0e, 0xe2, 0x90, 0xcb, 0x3c, 0x3d, 0x37, 0x33, 0x35, 0xba, 0xb9, 0x59, 0x07, 0x73, 0x4d, 0x99, 0xd3, 0x84, 0xa6, 0x2a, 0x37, 0x3b, 0x84, 0x84, 0xe1, 0xd4, 0x1a, 0x04, 0xc3, 0x14, 0x0f, 0xaa, 0x19, 0xe8, 0xa2, 0xb9, 0x9b, 0x0c, 0x61, 0xe3, 0x3c, 0x27, 0xea, 0x91, 0x39, 0x73, 0xe4, 0x5b, 0x5b, 0xc6, 0xe3, 0x9c, 0x27, 0x0d, 0xac, 0x53, 0x18, -}; - -extern const size_t sTestCert_Node01_01_Chip_Len = sizeof(sTestCert_Node01_01_Chip); +}); // Error Testing 01: Manually updated Node01_01 CHIP TLV encoded certificate. // Updated Tag of the Subject Key Identifier Extension from ContextTag to CommonProfile_2Bytes: // 0x30, 0x04 --> 0x50, 0xee, 0x04 // The CHIP_ERROR_INVALID_TLV_TAG error is expected when this certificate is loaded/decoded -extern const uint8_t sTestCert_Node01_01_Err01_Chip[] = { +extern constexpr ByteSpan sTestCert_Node01_01_Err01_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x18, 0xe9, 0x69, 0xba, 0x0e, 0x08, 0x9e, 0x23, 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, 0x01, 0x00, 0xde, 0xde, 0xde, 0xde, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, @@ -1318,11 +1224,9 @@ extern const uint8_t sTestCert_Node01_01_Err01_Chip[] = { 0xbc, 0x94, 0xf8, 0x0e, 0xe2, 0x90, 0xcb, 0x3c, 0x3d, 0x37, 0x33, 0x35, 0xba, 0xb9, 0x59, 0x07, 0x73, 0x4d, 0x99, 0xd3, 0x84, 0xa6, 0x2a, 0x37, 0x3b, 0x84, 0x84, 0xe1, 0xd4, 0x1a, 0x04, 0xc3, 0x14, 0x0f, 0xaa, 0x19, 0xe8, 0xa2, 0xb9, 0x9b, 0x0c, 0x61, 0xe3, 0x3c, 0x27, 0xea, 0x91, 0x39, 0x73, 0xe4, 0x5b, 0x5b, 0xc6, 0xe3, 0x9c, 0x27, 0x0d, 0xac, 0x53, 0x18, -}; +}); -extern const size_t sTestCert_Node01_01_Err01_Chip_Len = sizeof(sTestCert_Node01_01_Err01_Chip); - -extern const uint8_t sTestCert_Node01_01_DER[] = { +extern constexpr ByteSpan sTestCert_Node01_01_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0xe1, 0x30, 0x82, 0x01, 0x86, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x18, 0xe9, 0x69, 0xba, 0x0e, 0x08, 0x9e, 0x23, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -1347,37 +1251,27 @@ extern const uint8_t sTestCert_Node01_01_DER[] = { 0x99, 0xd3, 0x84, 0xa6, 0x2a, 0x37, 0x3b, 0x84, 0x84, 0x02, 0x21, 0x00, 0xe1, 0xd4, 0x1a, 0x04, 0xc3, 0x14, 0x0f, 0xaa, 0x19, 0xe8, 0xa2, 0xb9, 0x9b, 0x0c, 0x61, 0xe3, 0x3c, 0x27, 0xea, 0x91, 0x39, 0x73, 0xe4, 0x5b, 0x5b, 0xc6, 0xe3, 0x9c, 0x27, 0x0d, 0xac, 0x53, -}; - -extern const size_t sTestCert_Node01_01_DER_Len = sizeof(sTestCert_Node01_01_DER); +}); -extern const uint8_t sTestCert_Node01_01_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node01_01_PublicKey((const uint8_t[]){ 0x04, 0xbc, 0xf6, 0x58, 0x0d, 0x2d, 0x71, 0xe1, 0x44, 0x16, 0x65, 0x1f, 0x7c, 0x31, 0x1b, 0x5e, 0xfc, 0xf9, 0xae, 0xc0, 0xa8, 0xc1, 0x0a, 0xf8, 0x09, 0x27, 0x84, 0x4c, 0x24, 0x0f, 0x51, 0xa8, 0xeb, 0x23, 0xfa, 0x07, 0x44, 0x13, 0x88, 0x87, 0xac, 0x1e, 0x73, 0xcb, 0x72, 0xa0, 0x54, 0xb6, 0xa0, 0xdb, 0x06, 0x22, 0xaa, 0x80, 0x70, 0x71, 0x01, 0x63, 0x13, 0xb1, 0x59, 0x6c, 0x85, 0x52, 0xcf, -}; - -extern const size_t sTestCert_Node01_01_PublicKey_Len = sizeof(sTestCert_Node01_01_PublicKey); +}); -extern const uint8_t sTestCert_Node01_01_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node01_01_PrivateKey((const uint8_t[]){ 0x49, 0x2e, 0x7f, 0x97, 0x83, 0xee, 0x15, 0xfd, 0xaa, 0x71, 0xa8, 0xa6, 0x7b, 0x1f, 0x31, 0xf3, 0xc8, 0xd5, 0x7b, 0x75, 0x09, 0x4a, 0x46, 0x13, 0xb9, 0xbb, 0x3e, 0xf4, 0x6f, 0xa6, 0x0d, 0x89, -}; - -extern const size_t sTestCert_Node01_01_PrivateKey_Len = sizeof(sTestCert_Node01_01_PrivateKey); +}); -extern const uint8_t sTestCert_Node01_01_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node01_01_SubjectKeyId((const uint8_t[]){ 0x69, 0x67, 0xC9, 0x12, 0xF8, 0xA3, 0xE6, 0x89, 0x55, 0x6F, 0x89, 0x9B, 0x65, 0xD7, 0x6F, 0x53, 0xFA, 0x65, 0xC7, 0xB6, -}; - -extern const size_t sTestCert_Node01_01_SubjectKeyId_Len = sizeof(sTestCert_Node01_01_SubjectKeyId); +}); -extern const uint8_t sTestCert_Node01_01_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node01_01_AuthorityKeyId((const uint8_t[]){ 0x44, 0x0C, 0xC6, 0x92, 0x31, 0xC4, 0xCB, 0x5B, 0x37, 0x94, 0x24, 0x26, 0xF8, 0x1B, 0xBE, 0x24, 0xB7, 0xEF, 0x34, 0x5C, -}; - -extern const size_t sTestCert_Node01_01_AuthorityKeyId_Len = sizeof(sTestCert_Node01_01_AuthorityKeyId); +}); /************** Test Node01_02 Certificate ************** Certificate: @@ -1440,7 +1334,7 @@ tRXZJkFZ94vQl44y10xtBVoUno6dukAZvw== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node01_02_Chip[] = { +extern constexpr ByteSpan sTestCert_Node01_02_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x0d, 0x90, 0x93, 0x53, 0x46, 0xb0, 0x5c, 0xbc, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x11, 0x02, 0x00, 0x01, 0x00, 0xde, 0xde, 0xde, 0xde, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, @@ -1454,11 +1348,9 @@ extern const uint8_t sTestCert_Node01_02_Chip[] = { 0x82, 0xfc, 0xf6, 0x30, 0x1f, 0x7a, 0x08, 0x1b, 0xca, 0x5a, 0x84, 0x82, 0x02, 0x43, 0x1a, 0x52, 0xfd, 0xbf, 0xf4, 0x97, 0xd8, 0xdd, 0x6f, 0x9a, 0x59, 0x59, 0x7b, 0xad, 0xcc, 0xd6, 0xa5, 0x6d, 0x70, 0xef, 0xd8, 0xc9, 0x7c, 0x49, 0x6e, 0xba, 0x7e, 0x28, 0x01, 0xd7, 0x33, 0x7d, 0xcf, 0xf7, 0x4d, 0x78, 0xe4, 0x6e, 0xcd, 0x3a, 0x08, 0xcc, 0xba, 0xe3, 0x18, -}; - -extern const size_t sTestCert_Node01_02_Chip_Len = sizeof(sTestCert_Node01_02_Chip); +}); -extern const uint8_t sTestCert_Node01_02_DER[] = { +extern constexpr ByteSpan sTestCert_Node01_02_DER((const uint8_t[]){ 0x30, 0x82, 0x01, 0xdf, 0x30, 0x82, 0x01, 0x86, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x0d, 0x90, 0x93, 0x53, 0x46, 0xb0, 0x5c, 0xbc, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -1482,37 +1374,27 @@ extern const uint8_t sTestCert_Node01_02_DER[] = { 0x4b, 0xa7, 0x21, 0x82, 0xfc, 0xf6, 0x30, 0x1f, 0x7a, 0x08, 0x1b, 0xca, 0x5a, 0x84, 0x82, 0x02, 0x43, 0x1a, 0x52, 0xfd, 0xbf, 0xf4, 0x97, 0xd8, 0xdd, 0x6f, 0x9a, 0x59, 0x59, 0x02, 0x20, 0x7b, 0xad, 0xcc, 0xd6, 0xa5, 0x6d, 0x70, 0xef, 0xd8, 0xc9, 0x7c, 0x49, 0x6e, 0xba, 0x7e, 0x28, 0x01, 0xd7, 0x33, 0x7d, 0xcf, 0xf7, 0x4d, 0x78, 0xe4, 0x6e, 0xcd, 0x3a, 0x08, 0xcc, 0xba, 0xe3, -}; - -extern const size_t sTestCert_Node01_02_DER_Len = sizeof(sTestCert_Node01_02_DER); +}); -extern const uint8_t sTestCert_Node01_02_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node01_02_PublicKey((const uint8_t[]){ 0x04, 0x96, 0x5f, 0x78, 0xc5, 0x37, 0xec, 0xe1, 0xb8, 0xc3, 0x4a, 0x7b, 0x98, 0xb9, 0xaa, 0x45, 0xf1, 0x35, 0x63, 0xa5, 0x02, 0xb1, 0x97, 0x9a, 0x60, 0x7b, 0xd0, 0xc4, 0x19, 0x88, 0xbd, 0xd0, 0xf0, 0xbb, 0xb8, 0x98, 0x16, 0xc2, 0x07, 0xe3, 0xb5, 0x15, 0xd9, 0x26, 0x41, 0x59, 0xf7, 0x8b, 0xd0, 0x97, 0x8e, 0x32, 0xd7, 0x4c, 0x6d, 0x05, 0x5a, 0x14, 0x9e, 0x8e, 0x9d, 0xba, 0x40, 0x19, 0xbf, -}; +}); -extern const size_t sTestCert_Node01_02_PublicKey_Len = sizeof(sTestCert_Node01_02_PublicKey); - -extern const uint8_t sTestCert_Node01_02_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node01_02_PrivateKey((const uint8_t[]){ 0x18, 0xb2, 0x98, 0x61, 0x51, 0x42, 0xe7, 0x7a, 0xdb, 0x0d, 0x1d, 0xc3, 0xc5, 0x17, 0x80, 0xd3, 0x78, 0xca, 0x3e, 0x63, 0xa9, 0x1f, 0xd8, 0xdc, 0xa6, 0x0b, 0xe7, 0x77, 0x9a, 0xb2, 0xf7, 0x0d, -}; +}); -extern const size_t sTestCert_Node01_02_PrivateKey_Len = sizeof(sTestCert_Node01_02_PrivateKey); - -extern const uint8_t sTestCert_Node01_02_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node01_02_SubjectKeyId((const uint8_t[]){ 0x56, 0x7B, 0x4F, 0x20, 0xE4, 0xB9, 0xC7, 0xBD, 0x27, 0xB2, 0x9B, 0x3D, 0xCE, 0x6A, 0x76, 0xF7, 0xCD, 0x8E, 0xCC, 0xB6, -}; +}); -extern const size_t sTestCert_Node01_02_SubjectKeyId_Len = sizeof(sTestCert_Node01_02_SubjectKeyId); - -extern const uint8_t sTestCert_Node01_02_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node01_02_AuthorityKeyId((const uint8_t[]){ 0xCC, 0x13, 0x08, 0xAF, 0x82, 0xCF, 0xEE, 0x50, 0x5E, 0xB2, 0x3B, 0x57, 0xBF, 0xE8, 0x6A, 0x31, 0x16, 0x65, 0x53, 0x5F, -}; - -extern const size_t sTestCert_Node01_02_AuthorityKeyId_Len = sizeof(sTestCert_Node01_02_AuthorityKeyId); +}); /************** Test Node02_01 Certificate ************** Certificate: @@ -1575,7 +1457,7 @@ nVEyh1OEMRr0B5TDVXU5tqDa3niLDB/2SQ== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_01_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_01_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x03, 0xe5, 0x45, 0x90, 0xde, 0x19, 0x04, 0x37, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x11, 0x01, 0x00, 0x02, 0x00, 0xde, 0xde, @@ -1590,11 +1472,9 @@ extern const uint8_t sTestCert_Node02_01_Chip[] = { 0xcd, 0xc8, 0x37, 0xfb, 0xee, 0x58, 0x25, 0xbe, 0x2f, 0xf3, 0xb9, 0x6a, 0x10, 0xe9, 0xb0, 0x33, 0x73, 0x4a, 0xd5, 0xfd, 0x19, 0x98, 0x6d, 0x2c, 0x90, 0x9c, 0x81, 0x86, 0xfc, 0x9c, 0x5b, 0x3a, 0x47, 0xc3, 0x35, 0xca, 0x16, 0xd0, 0xae, 0xd1, 0xaa, 0xc8, 0x9a, 0x20, 0x37, 0x08, 0x50, 0xb4, 0x15, 0xeb, 0x62, 0x3a, 0x73, 0xc3, 0x38, 0x19, 0x33, 0x74, 0x18, -}; - -extern const size_t sTestCert_Node02_01_Chip_Len = sizeof(sTestCert_Node02_01_Chip); +}); -extern const uint8_t sTestCert_Node02_01_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_01_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x02, 0x30, 0x82, 0x01, 0xa8, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x03, 0xe5, 0x45, 0x90, 0xde, 0x19, 0x04, 0x37, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -1620,37 +1500,27 @@ extern const uint8_t sTestCert_Node02_01_DER[] = { 0x58, 0x25, 0xbe, 0x2f, 0xf3, 0xb9, 0x6a, 0x10, 0xe9, 0xb0, 0x33, 0x73, 0x4a, 0xd5, 0xfd, 0x19, 0x98, 0x6d, 0x2c, 0x90, 0x9c, 0x02, 0x21, 0x00, 0x81, 0x86, 0xfc, 0x9c, 0x5b, 0x3a, 0x47, 0xc3, 0x35, 0xca, 0x16, 0xd0, 0xae, 0xd1, 0xaa, 0xc8, 0x9a, 0x20, 0x37, 0x08, 0x50, 0xb4, 0x15, 0xeb, 0x62, 0x3a, 0x73, 0xc3, 0x38, 0x19, 0x33, 0x74, -}; +}); -extern const size_t sTestCert_Node02_01_DER_Len = sizeof(sTestCert_Node02_01_DER); - -extern const uint8_t sTestCert_Node02_01_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_01_PublicKey((const uint8_t[]){ 0x04, 0xa5, 0x70, 0x10, 0x42, 0xaa, 0x69, 0x14, 0x20, 0xf5, 0xce, 0xf5, 0xbb, 0x65, 0x2e, 0xde, 0xd7, 0x43, 0xcc, 0x4d, 0x6f, 0x00, 0x0e, 0x11, 0x35, 0xf0, 0xef, 0x69, 0x98, 0x2e, 0x52, 0x8d, 0xbf, 0x9d, 0xb2, 0x2b, 0x90, 0x4d, 0x97, 0x05, 0x9d, 0x51, 0x32, 0x87, 0x53, 0x84, 0x31, 0x1a, 0xf4, 0x07, 0x94, 0xc3, 0x55, 0x75, 0x39, 0xb6, 0xa0, 0xda, 0xde, 0x78, 0x8b, 0x0c, 0x1f, 0xf6, 0x49, -}; - -extern const size_t sTestCert_Node02_01_PublicKey_Len = sizeof(sTestCert_Node02_01_PublicKey); +}); -extern const uint8_t sTestCert_Node02_01_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_01_PrivateKey((const uint8_t[]){ 0xb4, 0x9f, 0x0e, 0x37, 0x24, 0x9c, 0x48, 0xc2, 0x5b, 0xa3, 0x0c, 0x7a, 0xfc, 0x4c, 0x94, 0x4f, 0x88, 0xac, 0x3c, 0x03, 0xc5, 0xb2, 0xa1, 0x93, 0x6b, 0xd8, 0x67, 0x15, 0xad, 0x7b, 0xe9, 0x24, -}; - -extern const size_t sTestCert_Node02_01_PrivateKey_Len = sizeof(sTestCert_Node02_01_PrivateKey); +}); -extern const uint8_t sTestCert_Node02_01_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_01_SubjectKeyId((const uint8_t[]){ 0xB4, 0x67, 0x76, 0xE1, 0xCC, 0x0A, 0xF7, 0x81, 0x54, 0xC6, 0x2B, 0x5A, 0x17, 0x98, 0x42, 0x64, 0xBA, 0xF5, 0x50, 0x86, -}; - -extern const size_t sTestCert_Node02_01_SubjectKeyId_Len = sizeof(sTestCert_Node02_01_SubjectKeyId); +}); -extern const uint8_t sTestCert_Node02_01_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_01_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_01_AuthorityKeyId_Len = sizeof(sTestCert_Node02_01_AuthorityKeyId); +}); /************** Test Node02_02 Certificate ************** Certificate: @@ -1711,7 +1581,7 @@ NSNN0iIb5AQvzsR0DhBeCLeJaKeUoYQW1w== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_02_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_02_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x0e, 0x99, 0xfe, 0xb4, 0xdb, 0x62, 0x01, 0x2a, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x11, 0x02, 0x00, 0x02, 0x00, 0xde, 0xde, 0xde, 0xde, 0x27, @@ -1728,11 +1598,9 @@ extern const uint8_t sTestCert_Node02_02_Chip[] = { 0xa8, 0xca, 0x9e, 0xc2, 0x10, 0xf6, 0xae, 0xdc, 0x0a, 0xe1, 0x03, 0x73, 0x77, 0xf6, 0xf8, 0x48, 0x86, 0xbb, 0x6a, 0x20, 0x27, 0x42, 0xda, 0x75, 0xc9, 0x2d, 0x43, 0x1d, 0xf8, 0xed, 0xba, 0xcb, 0x8c, 0x30, 0x73, 0xb8, 0x10, 0x0a, 0xa1, 0x9d, 0x46, 0x9e, 0xc8, 0xe4, 0x92, 0x1e, 0xb8, 0x13, 0x18, -}; +}); -extern const size_t sTestCert_Node02_02_Chip_Len = sizeof(sTestCert_Node02_02_Chip); - -extern const uint8_t sTestCert_Node02_02_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_02_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x35, 0x30, 0x82, 0x01, 0xdb, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x0e, 0x99, 0xfe, 0xb4, 0xdb, 0x62, 0x01, 0x2a, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -1761,37 +1629,27 @@ extern const uint8_t sTestCert_Node02_02_DER[] = { 0xdc, 0x0a, 0xe1, 0x03, 0x73, 0x77, 0xf6, 0xf8, 0x48, 0x02, 0x21, 0x00, 0x86, 0xbb, 0x6a, 0x20, 0x27, 0x42, 0xda, 0x75, 0xc9, 0x2d, 0x43, 0x1d, 0xf8, 0xed, 0xba, 0xcb, 0x8c, 0x30, 0x73, 0xb8, 0x10, 0x0a, 0xa1, 0x9d, 0x46, 0x9e, 0xc8, 0xe4, 0x92, 0x1e, 0xb8, 0x13, -}; - -extern const size_t sTestCert_Node02_02_DER_Len = sizeof(sTestCert_Node02_02_DER); +}); -extern const uint8_t sTestCert_Node02_02_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_02_PublicKey((const uint8_t[]){ 0x04, 0xf6, 0xa0, 0x95, 0x8f, 0xb8, 0xfc, 0x32, 0x53, 0x4a, 0x7a, 0x4d, 0x44, 0x87, 0x4b, 0x51, 0x0f, 0x30, 0x9a, 0xdf, 0xe6, 0x51, 0x42, 0x2b, 0x35, 0x70, 0x63, 0x05, 0x88, 0x11, 0xb7, 0xd5, 0xbc, 0x56, 0x36, 0x66, 0xd5, 0x48, 0xdb, 0x2f, 0x35, 0x23, 0x4d, 0xd2, 0x22, 0x1b, 0xe4, 0x04, 0x2f, 0xce, 0xc4, 0x74, 0x0e, 0x10, 0x5e, 0x08, 0xb7, 0x89, 0x68, 0xa7, 0x94, 0xa1, 0x84, 0x16, 0xd7, -}; - -extern const size_t sTestCert_Node02_02_PublicKey_Len = sizeof(sTestCert_Node02_02_PublicKey); +}); -extern const uint8_t sTestCert_Node02_02_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_02_PrivateKey((const uint8_t[]){ 0xe7, 0x75, 0xb1, 0x82, 0x35, 0xed, 0x35, 0x42, 0xf3, 0x06, 0x88, 0x64, 0xbe, 0x9d, 0xa6, 0x24, 0x88, 0x7a, 0xa8, 0xe8, 0x2c, 0x29, 0x8c, 0x4b, 0x5a, 0x20, 0x6d, 0x06, 0xb5, 0xb0, 0x85, 0x73, -}; +}); -extern const size_t sTestCert_Node02_02_PrivateKey_Len = sizeof(sTestCert_Node02_02_PrivateKey); - -extern const uint8_t sTestCert_Node02_02_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_02_SubjectKeyId((const uint8_t[]){ 0x21, 0xF4, 0x13, 0xAA, 0x28, 0xD3, 0x89, 0xAF, 0x4E, 0xEE, 0x25, 0x71, 0x1E, 0xDF, 0xA1, 0x98, 0xF7, 0x71, 0x88, 0x85, -}; +}); -extern const size_t sTestCert_Node02_02_SubjectKeyId_Len = sizeof(sTestCert_Node02_02_SubjectKeyId); - -extern const uint8_t sTestCert_Node02_02_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_02_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_02_AuthorityKeyId_Len = sizeof(sTestCert_Node02_02_AuthorityKeyId); +}); /************** Test Node02_03 Certificate ************** Certificate: @@ -1853,7 +1711,7 @@ fSLWAYepIPugtFe5rIwp4Zo2fi/wG1x6WQ== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_03_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_03_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x0e, 0xd1, 0x90, 0x55, 0xe3, 0x1c, 0x56, 0x6b, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x11, 0x03, 0x00, 0x02, 0x00, 0xde, 0xde, 0xde, 0xde, 0x27, @@ -1869,11 +1727,9 @@ extern const uint8_t sTestCert_Node02_03_Chip[] = { 0x86, 0x6e, 0x2e, 0xac, 0x3b, 0xec, 0x3d, 0x1f, 0x11, 0xd1, 0x74, 0x00, 0x97, 0xee, 0x5d, 0xea, 0xcc, 0x22, 0x75, 0xf7, 0x00, 0x0c, 0xa1, 0xe5, 0xe4, 0x9b, 0xab, 0x45, 0x19, 0xc6, 0x70, 0xf7, 0xc2, 0x50, 0x9c, 0xce, 0x18, 0x97, 0xce, 0x95, 0x8a, 0xe8, 0xf4, 0xa9, 0x49, 0x9f, 0x33, 0xea, 0x18, -}; - -extern const size_t sTestCert_Node02_03_Chip_Len = sizeof(sTestCert_Node02_03_Chip); +}); -extern const uint8_t sTestCert_Node02_03_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_03_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x35, 0x30, 0x82, 0x01, 0xda, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x0e, 0xd1, 0x90, 0x55, 0xe3, 0x1c, 0x56, 0x6b, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -1902,37 +1758,27 @@ extern const uint8_t sTestCert_Node02_03_DER[] = { 0x1f, 0x11, 0xd1, 0x74, 0x00, 0x97, 0xee, 0x5d, 0xea, 0x02, 0x21, 0x00, 0xcc, 0x22, 0x75, 0xf7, 0x00, 0x0c, 0xa1, 0xe5, 0xe4, 0x9b, 0xab, 0x45, 0x19, 0xc6, 0x70, 0xf7, 0xc2, 0x50, 0x9c, 0xce, 0x18, 0x97, 0xce, 0x95, 0x8a, 0xe8, 0xf4, 0xa9, 0x49, 0x9f, 0x33, 0xea, -}; - -extern const size_t sTestCert_Node02_03_DER_Len = sizeof(sTestCert_Node02_03_DER); +}); -extern const uint8_t sTestCert_Node02_03_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_03_PublicKey((const uint8_t[]){ 0x04, 0xab, 0x9b, 0x9c, 0xa9, 0xe1, 0x93, 0x76, 0xc4, 0xf5, 0x7d, 0xde, 0xc4, 0x38, 0x6a, 0x00, 0xfc, 0x3e, 0x8a, 0x4b, 0x38, 0x8c, 0xd1, 0x8a, 0xb4, 0xff, 0xcc, 0xda, 0x45, 0x62, 0x08, 0x0c, 0x08, 0xb5, 0xe7, 0x16, 0xe6, 0xb2, 0xce, 0xc5, 0x7d, 0x22, 0xd6, 0x01, 0x87, 0xa9, 0x20, 0xfb, 0xa0, 0xb4, 0x57, 0xb9, 0xac, 0x8c, 0x29, 0xe1, 0x9a, 0x36, 0x7e, 0x2f, 0xf0, 0x1b, 0x5c, 0x7a, 0x59, -}; +}); -extern const size_t sTestCert_Node02_03_PublicKey_Len = sizeof(sTestCert_Node02_03_PublicKey); - -extern const uint8_t sTestCert_Node02_03_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_03_PrivateKey((const uint8_t[]){ 0x0a, 0x12, 0xf6, 0x9c, 0x15, 0xf4, 0x2f, 0x11, 0x0e, 0xe3, 0xf4, 0xeb, 0x77, 0xf8, 0xaf, 0xef, 0x05, 0x0c, 0x09, 0x75, 0xf3, 0x06, 0x62, 0x14, 0xe5, 0x8a, 0x30, 0x43, 0xfb, 0x20, 0xde, 0xba, -}; - -extern const size_t sTestCert_Node02_03_PrivateKey_Len = sizeof(sTestCert_Node02_03_PrivateKey); +}); -extern const uint8_t sTestCert_Node02_03_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_03_SubjectKeyId((const uint8_t[]){ 0xE5, 0x7F, 0x7A, 0xB3, 0x74, 0xB0, 0x2F, 0x53, 0xEF, 0xA0, 0xA5, 0xB6, 0x52, 0xF2, 0x21, 0x1C, 0x1A, 0xAF, 0x05, 0xCF, -}; - -extern const size_t sTestCert_Node02_03_SubjectKeyId_Len = sizeof(sTestCert_Node02_03_SubjectKeyId); +}); -extern const uint8_t sTestCert_Node02_03_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_03_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_03_AuthorityKeyId_Len = sizeof(sTestCert_Node02_03_AuthorityKeyId); +}); /************** Test Node02_04 Certificate ************** Certificate: @@ -1994,7 +1840,7 @@ kPgNiEs/n3k+W6hQDL6Fh6RBwiFbh9ceSg== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_04_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_04_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x78, 0x0b, 0x9a, 0x03, 0xbd, 0xc8, 0x02, 0x72, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x26, 0x16, 0x02, 0x10, 0xce, 0xab, 0x2c, 0x01, 0x0d, 0x54, 0x65, @@ -2010,11 +1856,9 @@ extern const uint8_t sTestCert_Node02_04_Chip[] = { 0xa6, 0x2d, 0x0d, 0xd1, 0xcf, 0xbc, 0xd1, 0xa0, 0xda, 0x20, 0xff, 0xe7, 0x61, 0x79, 0xe5, 0xf2, 0xf6, 0x83, 0x9a, 0x50, 0x90, 0x70, 0xc7, 0x5b, 0x07, 0x89, 0x74, 0x26, 0x73, 0xf7, 0xe5, 0x02, 0x64, 0xcc, 0x9c, 0xed, 0xc0, 0x01, 0xc9, 0x3c, 0x9e, 0x9c, 0x05, 0x02, 0x90, 0x3f, 0xd7, 0x3d, 0x25, 0xe3, 0x1e, 0x42, 0xad, 0x24, 0x18, -}; - -extern const size_t sTestCert_Node02_04_Chip_Len = sizeof(sTestCert_Node02_04_Chip); +}); -extern const uint8_t sTestCert_Node02_04_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_04_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x4f, 0x30, 0x82, 0x01, 0xf5, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x78, 0x0b, 0x9a, 0x03, 0xbd, 0xc8, 0x02, 0x72, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -2044,37 +1888,27 @@ extern const uint8_t sTestCert_Node02_04_DER[] = { 0xda, 0x20, 0xff, 0xe7, 0x61, 0x79, 0xe5, 0xf2, 0xf6, 0x83, 0x9a, 0x50, 0x90, 0x70, 0x02, 0x21, 0x00, 0xc7, 0x5b, 0x07, 0x89, 0x74, 0x26, 0x73, 0xf7, 0xe5, 0x02, 0x64, 0xcc, 0x9c, 0xed, 0xc0, 0x01, 0xc9, 0x3c, 0x9e, 0x9c, 0x05, 0x02, 0x90, 0x3f, 0xd7, 0x3d, 0x25, 0xe3, 0x1e, 0x42, 0xad, 0x24, -}; +}); -extern const size_t sTestCert_Node02_04_DER_Len = sizeof(sTestCert_Node02_04_DER); - -extern const uint8_t sTestCert_Node02_04_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_04_PublicKey((const uint8_t[]){ 0x04, 0xef, 0x70, 0x00, 0xd0, 0x0e, 0x73, 0x2e, 0x02, 0x9e, 0xe6, 0xc1, 0x15, 0x9a, 0xb6, 0x6c, 0xa0, 0xa2, 0xe6, 0x13, 0x74, 0xc9, 0x2b, 0x6f, 0x45, 0xb7, 0x99, 0x89, 0x66, 0x15, 0x49, 0x2b, 0x7d, 0xd5, 0xaa, 0x9d, 0x87, 0xfc, 0x56, 0xdf, 0x90, 0xf8, 0x0d, 0x88, 0x4b, 0x3f, 0x9f, 0x79, 0x3e, 0x5b, 0xa8, 0x50, 0x0c, 0xbe, 0x85, 0x87, 0xa4, 0x41, 0xc2, 0x21, 0x5b, 0x87, 0xd7, 0x1e, 0x4a, -}; - -extern const size_t sTestCert_Node02_04_PublicKey_Len = sizeof(sTestCert_Node02_04_PublicKey); +}); -extern const uint8_t sTestCert_Node02_04_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_04_PrivateKey((const uint8_t[]){ 0xe1, 0x95, 0x85, 0xb6, 0x38, 0x83, 0x23, 0x4b, 0xdc, 0x02, 0x7c, 0x54, 0x9c, 0xcd, 0x7a, 0x67, 0xc8, 0x34, 0x1c, 0x01, 0x72, 0xe0, 0x16, 0xec, 0xc2, 0x5d, 0xf6, 0xeb, 0x9c, 0x84, 0x5a, 0xb6, -}; - -extern const size_t sTestCert_Node02_04_PrivateKey_Len = sizeof(sTestCert_Node02_04_PrivateKey); +}); -extern const uint8_t sTestCert_Node02_04_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_04_SubjectKeyId((const uint8_t[]){ 0xB4, 0x49, 0x16, 0x80, 0x10, 0x4F, 0xC3, 0x8D, 0x9C, 0xFA, 0xDA, 0x69, 0xEA, 0x30, 0x85, 0x14, 0x4C, 0x92, 0x7D, 0x2A, -}; +}); -extern const size_t sTestCert_Node02_04_SubjectKeyId_Len = sizeof(sTestCert_Node02_04_SubjectKeyId); - -extern const uint8_t sTestCert_Node02_04_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_04_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_04_AuthorityKeyId_Len = sizeof(sTestCert_Node02_04_AuthorityKeyId); +}); /************** Test Node02_05 Certificate ************** Certificate: @@ -2137,7 +1971,7 @@ UQPK95ZDHgpOnFrC1/DpHMcOffCdsyz4Yw== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_05_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_05_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x6d, 0x47, 0x5e, 0x82, 0x63, 0xe0, 0xf7, 0x3a, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x26, 0x16, 0x10, 0x00, 0xcd, 0xab, 0x27, 0x15, @@ -2154,11 +1988,9 @@ extern const uint8_t sTestCert_Node02_05_Chip[] = { 0x4a, 0x93, 0x0c, 0x3b, 0xa8, 0xef, 0x82, 0x8c, 0x5f, 0x93, 0xfe, 0x7e, 0xbb, 0xdd, 0x5b, 0xb4, 0xec, 0x54, 0x45, 0xbd, 0xd7, 0x78, 0x62, 0xd5, 0xa2, 0x1d, 0x43, 0x9e, 0x3c, 0x3b, 0xec, 0xbc, 0xb3, 0xf1, 0xaa, 0xbd, 0x97, 0x86, 0x10, 0x19, 0xa2, 0xe9, 0x45, 0xc9, 0x94, 0xd2, 0x73, 0x60, 0x4f, 0x60, 0xf0, 0x2d, 0xed, 0x3b, 0x6a, 0xc5, 0xbe, 0x07, 0x5d, 0x18, -}; +}); -extern const size_t sTestCert_Node02_05_Chip_Len = sizeof(sTestCert_Node02_05_Chip); - -extern const uint8_t sTestCert_Node02_05_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_05_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x51, 0x30, 0x82, 0x01, 0xf6, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x6d, 0x47, 0x5e, 0x82, 0x63, 0xe0, 0xf7, 0x3a, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -2188,37 +2020,27 @@ extern const uint8_t sTestCert_Node02_05_DER[] = { 0x7e, 0xbb, 0xdd, 0x5b, 0xb4, 0xec, 0x54, 0x45, 0xbd, 0xd7, 0x78, 0x62, 0xd5, 0xa2, 0x1d, 0x43, 0x02, 0x21, 0x00, 0x9e, 0x3c, 0x3b, 0xec, 0xbc, 0xb3, 0xf1, 0xaa, 0xbd, 0x97, 0x86, 0x10, 0x19, 0xa2, 0xe9, 0x45, 0xc9, 0x94, 0xd2, 0x73, 0x60, 0x4f, 0x60, 0xf0, 0x2d, 0xed, 0x3b, 0x6a, 0xc5, 0xbe, 0x07, 0x5d, -}; - -extern const size_t sTestCert_Node02_05_DER_Len = sizeof(sTestCert_Node02_05_DER); +}); -extern const uint8_t sTestCert_Node02_05_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_05_PublicKey((const uint8_t[]){ 0x04, 0xfc, 0x8a, 0xff, 0x06, 0x3a, 0xd0, 0xe0, 0xbf, 0xdf, 0x24, 0xdd, 0x9d, 0x84, 0x13, 0x0f, 0x74, 0x49, 0x3c, 0x95, 0xa4, 0x0d, 0xb3, 0xf4, 0x0a, 0xaf, 0x42, 0xcf, 0x2c, 0xb1, 0x15, 0x8b, 0xa1, 0xaa, 0x1d, 0x61, 0xde, 0x38, 0x3c, 0x9b, 0x51, 0x03, 0xca, 0xf7, 0x96, 0x43, 0x1e, 0x0a, 0x4e, 0x9c, 0x5a, 0xc2, 0xd7, 0xf0, 0xe9, 0x1c, 0xc7, 0x0e, 0x7d, 0xf0, 0x9d, 0xb3, 0x2c, 0xf8, 0x63, -}; - -extern const size_t sTestCert_Node02_05_PublicKey_Len = sizeof(sTestCert_Node02_05_PublicKey); +}); -extern const uint8_t sTestCert_Node02_05_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_05_PrivateKey((const uint8_t[]){ 0x66, 0xd0, 0x40, 0x90, 0x71, 0x76, 0x60, 0xba, 0xaf, 0xcc, 0xdc, 0x46, 0x47, 0x6d, 0xa9, 0x1d, 0xad, 0x66, 0xe8, 0xad, 0x39, 0x28, 0x3d, 0xb1, 0x7d, 0x07, 0x79, 0xda, 0xd0, 0xcd, 0x65, 0xc2, -}; +}); -extern const size_t sTestCert_Node02_05_PrivateKey_Len = sizeof(sTestCert_Node02_05_PrivateKey); - -extern const uint8_t sTestCert_Node02_05_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_05_SubjectKeyId((const uint8_t[]){ 0x4B, 0x46, 0x42, 0x9C, 0x69, 0x3D, 0x0E, 0x28, 0x79, 0x8C, 0x8F, 0x76, 0x26, 0xA5, 0x01, 0x20, 0x05, 0x96, 0xAD, 0x2D, -}; - -extern const size_t sTestCert_Node02_05_SubjectKeyId_Len = sizeof(sTestCert_Node02_05_SubjectKeyId); +}); -extern const uint8_t sTestCert_Node02_05_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_05_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_05_AuthorityKeyId_Len = sizeof(sTestCert_Node02_05_AuthorityKeyId); +}); /************** Test Node02_06 Certificate ************** Certificate: @@ -2288,7 +2110,7 @@ W5qMcXYk3zQtE4Zt3RdbQovDjSE9a/XH0w== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_06_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_06_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x10, 0x17, 0x8f, 0x6d, 0x21, 0x9e, 0x45, 0x4a, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x11, 0x06, 0x00, 0x02, 0x00, 0xde, 0xde, 0xde, 0xde, 0x27, @@ -2306,11 +2128,9 @@ extern const uint8_t sTestCert_Node02_06_Chip[] = { 0xa3, 0x7a, 0x9e, 0x96, 0x01, 0xdf, 0x62, 0x63, 0xf2, 0x0a, 0x0a, 0x8c, 0xfe, 0xe3, 0x14, 0x04, 0xf6, 0x79, 0xd1, 0x85, 0xb0, 0x21, 0xdd, 0xf2, 0xb7, 0xa1, 0x6c, 0xd6, 0xaf, 0x6c, 0x38, 0xee, 0x92, 0x04, 0x03, 0xec, 0xb4, 0xd6, 0x16, 0x05, 0xf3, 0xc2, 0xf7, 0xf1, 0x7b, 0xd6, 0x16, 0x78, 0x42, 0x93, 0x18, -}; - -extern const size_t sTestCert_Node02_06_Chip_Len = sizeof(sTestCert_Node02_06_Chip); +}); -extern const uint8_t sTestCert_Node02_06_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_06_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x3e, 0x30, 0x82, 0x01, 0xe4, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x10, 0x17, 0x8f, 0x6d, 0x21, 0x9e, 0x45, 0x4a, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -2339,37 +2159,27 @@ extern const uint8_t sTestCert_Node02_06_DER[] = { 0xa3, 0x7a, 0x9e, 0x96, 0x01, 0xdf, 0x62, 0x63, 0xf2, 0x0a, 0x0a, 0x8c, 0xfe, 0xe3, 0x14, 0x04, 0xf6, 0x79, 0x02, 0x21, 0x00, 0xd1, 0x85, 0xb0, 0x21, 0xdd, 0xf2, 0xb7, 0xa1, 0x6c, 0xd6, 0xaf, 0x6c, 0x38, 0xee, 0x92, 0x04, 0x03, 0xec, 0xb4, 0xd6, 0x16, 0x05, 0xf3, 0xc2, 0xf7, 0xf1, 0x7b, 0xd6, 0x16, 0x78, 0x42, 0x93, -}; - -extern const size_t sTestCert_Node02_06_DER_Len = sizeof(sTestCert_Node02_06_DER); +}); -extern const uint8_t sTestCert_Node02_06_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_06_PublicKey((const uint8_t[]){ 0x04, 0xbb, 0xa4, 0x15, 0x69, 0x52, 0x63, 0xe1, 0xd9, 0xdc, 0x17, 0xcc, 0x32, 0x2d, 0x39, 0x5e, 0x32, 0x0d, 0xa6, 0xf1, 0x7d, 0x56, 0xf2, 0x02, 0x18, 0x16, 0x0c, 0x68, 0x53, 0xe6, 0x21, 0x0f, 0x41, 0xd0, 0x10, 0x19, 0x63, 0xfe, 0xe3, 0x91, 0x5b, 0x9a, 0x8c, 0x71, 0x76, 0x24, 0xdf, 0x34, 0x2d, 0x13, 0x86, 0x6d, 0xdd, 0x17, 0x5b, 0x42, 0x8b, 0xc3, 0x8d, 0x21, 0x3d, 0x6b, 0xf5, 0xc7, 0xd3, -}; +}); -extern const size_t sTestCert_Node02_06_PublicKey_Len = sizeof(sTestCert_Node02_06_PublicKey); - -extern const uint8_t sTestCert_Node02_06_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_06_PrivateKey((const uint8_t[]){ 0xc0, 0x97, 0xfd, 0xf9, 0x76, 0x3b, 0x72, 0x8e, 0x91, 0x8a, 0x54, 0x46, 0xc4, 0x93, 0xf3, 0x33, 0xbf, 0x1d, 0x6f, 0x33, 0xa6, 0xa8, 0x03, 0xaf, 0x11, 0xda, 0x81, 0xc5, 0xf5, 0xee, 0x55, 0x8e, -}; - -extern const size_t sTestCert_Node02_06_PrivateKey_Len = sizeof(sTestCert_Node02_06_PrivateKey); +}); -extern const uint8_t sTestCert_Node02_06_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_06_SubjectKeyId((const uint8_t[]){ 0x4B, 0x04, 0x1B, 0x79, 0x7E, 0xB8, 0x1B, 0x32, 0x61, 0x9A, 0xAD, 0x60, 0x0F, 0x6C, 0xFD, 0x78, 0xCE, 0x04, 0x74, 0x28, -}; - -extern const size_t sTestCert_Node02_06_SubjectKeyId_Len = sizeof(sTestCert_Node02_06_SubjectKeyId); +}); -extern const uint8_t sTestCert_Node02_06_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_06_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_06_AuthorityKeyId_Len = sizeof(sTestCert_Node02_06_AuthorityKeyId); +}); /************** Test Node02_07 Certificate ************** Certificate: @@ -2439,7 +2249,7 @@ kOYmFuqhh39HFLlvyHhvkbMD5EapZQnTYQ== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_07_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_07_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x60, 0x78, 0x20, 0xc0, 0x15, 0xa0, 0xd1, 0x66, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x27, 0x11, 0x07, 0x00, 0x02, 0x00, 0xde, 0xde, 0xde, 0xde, 0x27, @@ -2457,11 +2267,9 @@ extern const uint8_t sTestCert_Node02_07_Chip[] = { 0x48, 0xbc, 0x40, 0xc2, 0xc3, 0xaf, 0xcd, 0x98, 0x19, 0x54, 0x8c, 0xf8, 0xe5, 0xc2, 0x49, 0xd2, 0x7d, 0xaa, 0x5e, 0xd8, 0x86, 0x19, 0x70, 0x46, 0x95, 0xb7, 0x10, 0x50, 0xfe, 0x70, 0x1a, 0x5a, 0x67, 0x5a, 0x49, 0x55, 0x98, 0x1c, 0x28, 0x7f, 0x25, 0xf6, 0x73, 0x93, 0x8b, 0x43, 0xe7, 0x71, 0x73, 0x54, 0xf6, 0xc8, 0x2e, 0x18, -}; +}); -extern const size_t sTestCert_Node02_07_Chip_Len = sizeof(sTestCert_Node02_07_Chip); - -extern const uint8_t sTestCert_Node02_07_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_07_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x41, 0x30, 0x82, 0x01, 0xe7, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x60, 0x78, 0x20, 0xc0, 0x15, 0xa0, 0xd1, 0x66, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -2490,37 +2298,27 @@ extern const uint8_t sTestCert_Node02_07_DER[] = { 0x85, 0x48, 0xbc, 0x40, 0xc2, 0xc3, 0xaf, 0xcd, 0x98, 0x19, 0x54, 0x8c, 0xf8, 0xe5, 0xc2, 0x49, 0xd2, 0x7d, 0xaa, 0x5e, 0xd8, 0x86, 0x02, 0x20, 0x19, 0x70, 0x46, 0x95, 0xb7, 0x10, 0x50, 0xfe, 0x70, 0x1a, 0x5a, 0x67, 0x5a, 0x49, 0x55, 0x98, 0x1c, 0x28, 0x7f, 0x25, 0xf6, 0x73, 0x93, 0x8b, 0x43, 0xe7, 0x71, 0x73, 0x54, 0xf6, 0xc8, 0x2e, -}; +}); -extern const size_t sTestCert_Node02_07_DER_Len = sizeof(sTestCert_Node02_07_DER); - -extern const uint8_t sTestCert_Node02_07_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_07_PublicKey((const uint8_t[]){ 0x04, 0xf7, 0x3c, 0x7f, 0xe5, 0x75, 0xd8, 0xb9, 0x06, 0xd4, 0x75, 0xff, 0xf7, 0x91, 0x2e, 0xe0, 0xe1, 0xb3, 0xcd, 0x23, 0x6c, 0x32, 0x46, 0xcf, 0x2d, 0x85, 0x3d, 0xe3, 0x39, 0x84, 0xc1, 0xf4, 0x18, 0x17, 0xb1, 0xc5, 0xb5, 0x28, 0x01, 0x8f, 0x90, 0xe6, 0x26, 0x16, 0xea, 0xa1, 0x87, 0x7f, 0x47, 0x14, 0xb9, 0x6f, 0xc8, 0x78, 0x6f, 0x91, 0xb3, 0x03, 0xe4, 0x46, 0xa9, 0x65, 0x09, 0xd3, 0x61, -}; - -extern const size_t sTestCert_Node02_07_PublicKey_Len = sizeof(sTestCert_Node02_07_PublicKey); +}); -extern const uint8_t sTestCert_Node02_07_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_07_PrivateKey((const uint8_t[]){ 0x95, 0xa8, 0x37, 0x7f, 0xdb, 0x52, 0x56, 0x38, 0x04, 0xc0, 0x10, 0x6d, 0x11, 0x4b, 0x52, 0x74, 0x05, 0x69, 0x37, 0x9c, 0xcd, 0xc8, 0xf5, 0x76, 0x83, 0x47, 0x3d, 0xbd, 0xbc, 0x45, 0x25, 0x40, -}; - -extern const size_t sTestCert_Node02_07_PrivateKey_Len = sizeof(sTestCert_Node02_07_PrivateKey); +}); -extern const uint8_t sTestCert_Node02_07_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_07_SubjectKeyId((const uint8_t[]){ 0x77, 0x7C, 0x77, 0xB6, 0x35, 0x65, 0xDC, 0x51, 0xF3, 0x02, 0x04, 0x59, 0x63, 0xC5, 0xCE, 0xFC, 0xE7, 0x09, 0x2A, 0x1E, -}; +}); -extern const size_t sTestCert_Node02_07_SubjectKeyId_Len = sizeof(sTestCert_Node02_07_SubjectKeyId); - -extern const uint8_t sTestCert_Node02_07_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_07_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_07_AuthorityKeyId_Len = sizeof(sTestCert_Node02_07_AuthorityKeyId); +}); /************** Test Node02_08 Certificate ************** Certificate: @@ -2582,7 +2380,7 @@ NE2UVUa0FPIj0nIxyag9cbOXtDIGYsD1yw== -----END EC PRIVATE KEY----- */ -extern const uint8_t sTestCert_Node02_08_Chip[] = { +extern constexpr ByteSpan sTestCert_Node02_08_Chip((const uint8_t[]){ 0x15, 0x30, 0x01, 0x08, 0x3e, 0x67, 0x94, 0x70, 0x7a, 0xec, 0xb8, 0x15, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x13, 0x04, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, 0x1b, 0x27, 0x26, 0x05, 0x6e, 0xb5, 0xb9, 0x4c, 0x37, 0x06, 0x26, 0x16, 0xa0, 0x00, 0xcf, 0xab, 0x27, 0x11, @@ -2598,11 +2396,9 @@ extern const uint8_t sTestCert_Node02_08_Chip[] = { 0xd1, 0xd8, 0xf2, 0xc5, 0xe5, 0x26, 0x37, 0xa5, 0x3e, 0xf4, 0x05, 0x4a, 0x9f, 0x18, 0xef, 0x45, 0x94, 0x3d, 0x3d, 0x23, 0x58, 0xfd, 0x7e, 0xb9, 0xcb, 0x12, 0x15, 0x04, 0xa3, 0xdc, 0x1d, 0xe4, 0x2d, 0xc0, 0xae, 0xe4, 0xf5, 0x11, 0xc0, 0x05, 0x67, 0x7c, 0x11, 0x18, 0x8b, 0x44, 0x98, 0x78, 0xbd, 0x7d, 0x69, 0x3e, 0x37, 0x82, 0x2c, 0x47, 0x18, -}; - -extern const size_t sTestCert_Node02_08_Chip_Len = sizeof(sTestCert_Node02_08_Chip); +}); -extern const uint8_t sTestCert_Node02_08_DER[] = { +extern constexpr ByteSpan sTestCert_Node02_08_DER((const uint8_t[]){ 0x30, 0x82, 0x02, 0x52, 0x30, 0x82, 0x01, 0xf7, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x3e, 0x67, 0x94, 0x70, 0x7a, 0xec, 0xb8, 0x15, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x03, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, @@ -2632,37 +2428,27 @@ extern const uint8_t sTestCert_Node02_08_DER[] = { 0xa5, 0x3e, 0xf4, 0x05, 0x4a, 0x9f, 0x18, 0xef, 0x45, 0x94, 0x3d, 0x3d, 0x23, 0x58, 0xfd, 0x7e, 0xb9, 0x02, 0x21, 0x00, 0xcb, 0x12, 0x15, 0x04, 0xa3, 0xdc, 0x1d, 0xe4, 0x2d, 0xc0, 0xae, 0xe4, 0xf5, 0x11, 0xc0, 0x05, 0x67, 0x7c, 0x11, 0x18, 0x8b, 0x44, 0x98, 0x78, 0xbd, 0x7d, 0x69, 0x3e, 0x37, 0x82, 0x2c, 0x47, -}; +}); -extern const size_t sTestCert_Node02_08_DER_Len = sizeof(sTestCert_Node02_08_DER); - -extern const uint8_t sTestCert_Node02_08_PublicKey[] = { +extern constexpr ByteSpan sTestCert_Node02_08_PublicKey((const uint8_t[]){ 0x04, 0x98, 0xca, 0x97, 0x34, 0xda, 0xaf, 0xf7, 0x33, 0x98, 0x33, 0x6d, 0xc0, 0xa4, 0xde, 0x89, 0x2d, 0xe6, 0x2a, 0x1f, 0x96, 0x90, 0x23, 0xe0, 0x33, 0x70, 0x86, 0x00, 0x85, 0xdc, 0xdc, 0x07, 0x2b, 0x23, 0x72, 0x60, 0x79, 0x37, 0xba, 0x3a, 0x34, 0x4d, 0x94, 0x55, 0x46, 0xb4, 0x14, 0xf2, 0x23, 0xd2, 0x72, 0x31, 0xc9, 0xa8, 0x3d, 0x71, 0xb3, 0x97, 0xb4, 0x32, 0x06, 0x62, 0xc0, 0xf5, 0xcb, -}; - -extern const size_t sTestCert_Node02_08_PublicKey_Len = sizeof(sTestCert_Node02_08_PublicKey); +}); -extern const uint8_t sTestCert_Node02_08_PrivateKey[] = { +extern constexpr ByteSpan sTestCert_Node02_08_PrivateKey((const uint8_t[]){ 0xdf, 0x8b, 0x10, 0x34, 0x18, 0x5b, 0xb0, 0xed, 0x9b, 0xcc, 0x39, 0xb5, 0xaf, 0xc0, 0xec, 0x9b, 0xd5, 0x6f, 0x4a, 0x76, 0x5d, 0xe9, 0x9f, 0x69, 0x9b, 0xb0, 0x9a, 0xf6, 0xcf, 0x3a, 0xf7, 0x6f, -}; - -extern const size_t sTestCert_Node02_08_PrivateKey_Len = sizeof(sTestCert_Node02_08_PrivateKey); +}); -extern const uint8_t sTestCert_Node02_08_SubjectKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_08_SubjectKeyId((const uint8_t[]){ 0xA9, 0xC5, 0xFD, 0x6C, 0xBD, 0x38, 0xBB, 0x18, 0x37, 0x0F, 0x8E, 0x80, 0x64, 0x16, 0x6A, 0xFB, 0x1E, 0xC8, 0x39, 0x73, -}; +}); -extern const size_t sTestCert_Node02_08_SubjectKeyId_Len = sizeof(sTestCert_Node02_08_SubjectKeyId); - -extern const uint8_t sTestCert_Node02_08_AuthorityKeyId[] = { +extern constexpr ByteSpan sTestCert_Node02_08_AuthorityKeyId((const uint8_t[]){ 0xE1, 0xE7, 0x6E, 0x67, 0x77, 0x85, 0x1D, 0xD7, 0x74, 0x16, 0xBD, 0xDD, 0x35, 0xEC, 0x3C, 0x13, 0x7C, 0x47, 0x29, 0xDC, -}; - -extern const size_t sTestCert_Node02_08_AuthorityKeyId_Len = sizeof(sTestCert_Node02_08_AuthorityKeyId); +}); } // namespace TestCerts } // namespace chip diff --git a/src/credentials/tests/CHIPCert_test_vectors.h b/src/credentials/tests/CHIPCert_test_vectors.h index 2793fd8d5ef867..dc717f396eeccb 100644 --- a/src/credentials/tests/CHIPCert_test_vectors.h +++ b/src/credentials/tests/CHIPCert_test_vectors.h @@ -81,229 +81,126 @@ extern const size_t gNumTestCerts; // ------------------------------ DECLARATIONS ---------------------------------------- -extern const uint8_t sTestCert_Root01_Chip[]; -extern const size_t sTestCert_Root01_Chip_Len; -extern const uint8_t sTestCert_Root01_DER[]; -extern const size_t sTestCert_Root01_DER_Len; -extern const uint8_t sTestCert_Root01_PublicKey[]; -extern const size_t sTestCert_Root01_PublicKey_Len; -extern const uint8_t sTestCert_Root01_PrivateKey[]; -extern const size_t sTestCert_Root01_PrivateKey_Len; -extern const uint8_t sTestCert_Root01_SubjectKeyId[]; -extern const size_t sTestCert_Root01_SubjectKeyId_Len; -extern const uint8_t sTestCert_Root01_AuthorityKeyId[]; -extern const size_t sTestCert_Root01_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Root02_Chip[]; -extern const size_t sTestCert_Root02_Chip_Len; -extern const uint8_t sTestCert_Root02_DER[]; -extern const size_t sTestCert_Root02_DER_Len; -extern const uint8_t sTestCert_Root02_PublicKey[]; -extern const size_t sTestCert_Root02_PublicKey_Len; -extern const uint8_t sTestCert_Root02_PrivateKey[]; -extern const size_t sTestCert_Root02_PrivateKey_Len; -extern const uint8_t sTestCert_Root02_SubjectKeyId[]; -extern const size_t sTestCert_Root02_SubjectKeyId_Len; -extern const uint8_t sTestCert_Root02_AuthorityKeyId[]; -extern const size_t sTestCert_Root02_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Root03_Chip[]; -extern const size_t sTestCert_Root03_Chip_Len; -extern const uint8_t sTestCert_Root03_DER[]; -extern const size_t sTestCert_Root03_DER_Len; -extern const uint8_t sTestCert_Root03_PublicKey[]; -extern const size_t sTestCert_Root03_PublicKey_Len; -extern const uint8_t sTestCert_Root03_PrivateKey[]; -extern const size_t sTestCert_Root03_PrivateKey_Len; -extern const uint8_t sTestCert_Root03_SubjectKeyId[]; -extern const size_t sTestCert_Root03_SubjectKeyId_Len; -extern const uint8_t sTestCert_Root03_AuthorityKeyId[]; -extern const size_t sTestCert_Root03_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_ICA01_Chip[]; -extern const size_t sTestCert_ICA01_Chip_Len; -extern const uint8_t sTestCert_ICA01_DER[]; -extern const size_t sTestCert_ICA01_DER_Len; -extern const uint8_t sTestCert_ICA01_PublicKey[]; -extern const size_t sTestCert_ICA01_PublicKey_Len; -extern const uint8_t sTestCert_ICA01_PrivateKey[]; -extern const size_t sTestCert_ICA01_PrivateKey_Len; -extern const uint8_t sTestCert_ICA01_SubjectKeyId[]; -extern const size_t sTestCert_ICA01_SubjectKeyId_Len; -extern const uint8_t sTestCert_ICA01_AuthorityKeyId[]; -extern const size_t sTestCert_ICA01_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_ICA02_Chip[]; -extern const size_t sTestCert_ICA02_Chip_Len; -extern const uint8_t sTestCert_ICA02_DER[]; -extern const size_t sTestCert_ICA02_DER_Len; -extern const uint8_t sTestCert_ICA02_PublicKey[]; -extern const size_t sTestCert_ICA02_PublicKey_Len; -extern const uint8_t sTestCert_ICA02_PrivateKey[]; -extern const size_t sTestCert_ICA02_PrivateKey_Len; -extern const uint8_t sTestCert_ICA02_SubjectKeyId[]; -extern const size_t sTestCert_ICA02_SubjectKeyId_Len; -extern const uint8_t sTestCert_ICA02_AuthorityKeyId[]; -extern const size_t sTestCert_ICA02_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_ICA01_1_Chip[]; -extern const size_t sTestCert_ICA01_1_Chip_Len; -extern const uint8_t sTestCert_ICA01_1_DER[]; -extern const size_t sTestCert_ICA01_1_DER_Len; -extern const uint8_t sTestCert_ICA01_1_PublicKey[]; -extern const size_t sTestCert_ICA01_1_PublicKey_Len; -extern const uint8_t sTestCert_ICA01_1_PrivateKey[]; -extern const size_t sTestCert_ICA01_1_PrivateKey_Len; -extern const uint8_t sTestCert_ICA01_1_SubjectKeyId[]; -extern const size_t sTestCert_ICA01_1_SubjectKeyId_Len; -extern const uint8_t sTestCert_ICA01_1_AuthorityKeyId[]; -extern const size_t sTestCert_ICA01_1_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_FWSign01_Chip[]; -extern const size_t sTestCert_FWSign01_Chip_Len; -extern const uint8_t sTestCert_FWSign01_DER[]; -extern const size_t sTestCert_FWSign01_DER_Len; -extern const uint8_t sTestCert_FWSign01_PublicKey[]; -extern const size_t sTestCert_FWSign01_PublicKey_Len; -extern const uint8_t sTestCert_FWSign01_PrivateKey[]; -extern const size_t sTestCert_FWSign01_PrivateKey_Len; -extern const uint8_t sTestCert_FWSign01_SubjectKeyId[]; -extern const size_t sTestCert_FWSign01_SubjectKeyId_Len; -extern const uint8_t sTestCert_FWSign01_AuthorityKeyId[]; -extern const size_t sTestCert_FWSign01_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node01_01_Chip[]; -extern const size_t sTestCert_Node01_01_Chip_Len; -extern const uint8_t sTestCert_Node01_01_DER[]; -extern const size_t sTestCert_Node01_01_DER_Len; -extern const uint8_t sTestCert_Node01_01_PublicKey[]; -extern const size_t sTestCert_Node01_01_PublicKey_Len; -extern const uint8_t sTestCert_Node01_01_PrivateKey[]; -extern const size_t sTestCert_Node01_01_PrivateKey_Len; -extern const uint8_t sTestCert_Node01_01_SubjectKeyId[]; -extern const size_t sTestCert_Node01_01_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node01_01_AuthorityKeyId[]; -extern const size_t sTestCert_Node01_01_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node01_01_Err01_Chip[]; -extern const size_t sTestCert_Node01_01_Err01_Chip_Len; - -extern const uint8_t sTestCert_Node01_02_Chip[]; -extern const size_t sTestCert_Node01_02_Chip_Len; -extern const uint8_t sTestCert_Node01_02_DER[]; -extern const size_t sTestCert_Node01_02_DER_Len; -extern const uint8_t sTestCert_Node01_02_PublicKey[]; -extern const size_t sTestCert_Node01_02_PublicKey_Len; -extern const uint8_t sTestCert_Node01_02_PrivateKey[]; -extern const size_t sTestCert_Node01_02_PrivateKey_Len; -extern const uint8_t sTestCert_Node01_02_SubjectKeyId[]; -extern const size_t sTestCert_Node01_02_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node01_02_AuthorityKeyId[]; -extern const size_t sTestCert_Node01_02_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_01_Chip[]; -extern const size_t sTestCert_Node02_01_Chip_Len; -extern const uint8_t sTestCert_Node02_01_DER[]; -extern const size_t sTestCert_Node02_01_DER_Len; -extern const uint8_t sTestCert_Node02_01_PublicKey[]; -extern const size_t sTestCert_Node02_01_PublicKey_Len; -extern const uint8_t sTestCert_Node02_01_PrivateKey[]; -extern const size_t sTestCert_Node02_01_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_01_SubjectKeyId[]; -extern const size_t sTestCert_Node02_01_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_01_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_01_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_02_Chip[]; -extern const size_t sTestCert_Node02_02_Chip_Len; -extern const uint8_t sTestCert_Node02_02_DER[]; -extern const size_t sTestCert_Node02_02_DER_Len; -extern const uint8_t sTestCert_Node02_02_PublicKey[]; -extern const size_t sTestCert_Node02_02_PublicKey_Len; -extern const uint8_t sTestCert_Node02_02_PrivateKey[]; -extern const size_t sTestCert_Node02_02_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_02_SubjectKeyId[]; -extern const size_t sTestCert_Node02_02_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_02_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_02_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_03_Chip[]; -extern const size_t sTestCert_Node02_03_Chip_Len; -extern const uint8_t sTestCert_Node02_03_DER[]; -extern const size_t sTestCert_Node02_03_DER_Len; -extern const uint8_t sTestCert_Node02_03_PublicKey[]; -extern const size_t sTestCert_Node02_03_PublicKey_Len; -extern const uint8_t sTestCert_Node02_03_PrivateKey[]; -extern const size_t sTestCert_Node02_03_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_03_SubjectKeyId[]; -extern const size_t sTestCert_Node02_03_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_03_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_03_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_04_Chip[]; -extern const size_t sTestCert_Node02_04_Chip_Len; -extern const uint8_t sTestCert_Node02_04_DER[]; -extern const size_t sTestCert_Node02_04_DER_Len; -extern const uint8_t sTestCert_Node02_04_PublicKey[]; -extern const size_t sTestCert_Node02_04_PublicKey_Len; -extern const uint8_t sTestCert_Node02_04_PrivateKey[]; -extern const size_t sTestCert_Node02_04_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_04_SubjectKeyId[]; -extern const size_t sTestCert_Node02_04_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_04_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_04_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_05_Chip[]; -extern const size_t sTestCert_Node02_05_Chip_Len; -extern const uint8_t sTestCert_Node02_05_DER[]; -extern const size_t sTestCert_Node02_05_DER_Len; -extern const uint8_t sTestCert_Node02_05_PublicKey[]; -extern const size_t sTestCert_Node02_05_PublicKey_Len; -extern const uint8_t sTestCert_Node02_05_PrivateKey[]; -extern const size_t sTestCert_Node02_05_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_05_SubjectKeyId[]; -extern const size_t sTestCert_Node02_05_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_05_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_05_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_06_Chip[]; -extern const size_t sTestCert_Node02_06_Chip_Len; -extern const uint8_t sTestCert_Node02_06_DER[]; -extern const size_t sTestCert_Node02_06_DER_Len; -extern const uint8_t sTestCert_Node02_06_PublicKey[]; -extern const size_t sTestCert_Node02_06_PublicKey_Len; -extern const uint8_t sTestCert_Node02_06_PrivateKey[]; -extern const size_t sTestCert_Node02_06_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_06_SubjectKeyId[]; -extern const size_t sTestCert_Node02_06_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_06_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_06_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_07_Chip[]; -extern const size_t sTestCert_Node02_07_Chip_Len; -extern const uint8_t sTestCert_Node02_07_DER[]; -extern const size_t sTestCert_Node02_07_DER_Len; -extern const uint8_t sTestCert_Node02_07_PublicKey[]; -extern const size_t sTestCert_Node02_07_PublicKey_Len; -extern const uint8_t sTestCert_Node02_07_PrivateKey[]; -extern const size_t sTestCert_Node02_07_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_07_SubjectKeyId[]; -extern const size_t sTestCert_Node02_07_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_07_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_07_AuthorityKeyId_Len; - -extern const uint8_t sTestCert_Node02_08_Chip[]; -extern const size_t sTestCert_Node02_08_Chip_Len; -extern const uint8_t sTestCert_Node02_08_DER[]; -extern const size_t sTestCert_Node02_08_DER_Len; -extern const uint8_t sTestCert_Node02_08_PublicKey[]; -extern const size_t sTestCert_Node02_08_PublicKey_Len; -extern const uint8_t sTestCert_Node02_08_PrivateKey[]; -extern const size_t sTestCert_Node02_08_PrivateKey_Len; -extern const uint8_t sTestCert_Node02_08_SubjectKeyId[]; -extern const size_t sTestCert_Node02_08_SubjectKeyId_Len; -extern const uint8_t sTestCert_Node02_08_AuthorityKeyId[]; -extern const size_t sTestCert_Node02_08_AuthorityKeyId_Len; +extern const ByteSpan sTestCert_Root01_Chip; +extern const ByteSpan sTestCert_Root01_DER; +extern const ByteSpan sTestCert_Root01_PublicKey; +extern const ByteSpan sTestCert_Root01_PrivateKey; +extern const ByteSpan sTestCert_Root01_SubjectKeyId; +extern const ByteSpan sTestCert_Root01_AuthorityKeyId; + +extern const ByteSpan sTestCert_Root02_Chip; +extern const ByteSpan sTestCert_Root02_DER; +extern const ByteSpan sTestCert_Root02_PublicKey; +extern const ByteSpan sTestCert_Root02_PrivateKey; +extern const ByteSpan sTestCert_Root02_SubjectKeyId; +extern const ByteSpan sTestCert_Root02_AuthorityKeyId; + +extern const ByteSpan sTestCert_Root03_Chip; +extern const ByteSpan sTestCert_Root03_DER; +extern const ByteSpan sTestCert_Root03_PublicKey; +extern const ByteSpan sTestCert_Root03_PrivateKey; +extern const ByteSpan sTestCert_Root03_SubjectKeyId; +extern const ByteSpan sTestCert_Root03_AuthorityKeyId; + +extern const ByteSpan sTestCert_ICA01_Chip; +extern const ByteSpan sTestCert_ICA01_DER; +extern const ByteSpan sTestCert_ICA01_PublicKey; +extern const ByteSpan sTestCert_ICA01_PrivateKey; +extern const ByteSpan sTestCert_ICA01_SubjectKeyId; +extern const ByteSpan sTestCert_ICA01_AuthorityKeyId; + +extern const ByteSpan sTestCert_ICA02_Chip; +extern const ByteSpan sTestCert_ICA02_DER; +extern const ByteSpan sTestCert_ICA02_PublicKey; +extern const ByteSpan sTestCert_ICA02_PrivateKey; +extern const ByteSpan sTestCert_ICA02_SubjectKeyId; +extern const ByteSpan sTestCert_ICA02_AuthorityKeyId; + +extern const ByteSpan sTestCert_ICA01_1_Chip; +extern const ByteSpan sTestCert_ICA01_1_DER; +extern const ByteSpan sTestCert_ICA01_1_PublicKey; +extern const ByteSpan sTestCert_ICA01_1_PrivateKey; +extern const ByteSpan sTestCert_ICA01_1_SubjectKeyId; +extern const ByteSpan sTestCert_ICA01_1_AuthorityKeyId; + +extern const ByteSpan sTestCert_FWSign01_Chip; +extern const ByteSpan sTestCert_FWSign01_DER; +extern const ByteSpan sTestCert_FWSign01_PublicKey; +extern const ByteSpan sTestCert_FWSign01_PrivateKey; +extern const ByteSpan sTestCert_FWSign01_SubjectKeyId; +extern const ByteSpan sTestCert_FWSign01_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node01_01_Chip; +extern const ByteSpan sTestCert_Node01_01_DER; +extern const ByteSpan sTestCert_Node01_01_PublicKey; +extern const ByteSpan sTestCert_Node01_01_PrivateKey; +extern const ByteSpan sTestCert_Node01_01_SubjectKeyId; +extern const ByteSpan sTestCert_Node01_01_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node01_01_Err01_Chip; + +extern const ByteSpan sTestCert_Node01_02_Chip; +extern const ByteSpan sTestCert_Node01_02_DER; +extern const ByteSpan sTestCert_Node01_02_PublicKey; +extern const ByteSpan sTestCert_Node01_02_PrivateKey; +extern const ByteSpan sTestCert_Node01_02_SubjectKeyId; +extern const ByteSpan sTestCert_Node01_02_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_01_Chip; +extern const ByteSpan sTestCert_Node02_01_DER; +extern const ByteSpan sTestCert_Node02_01_PublicKey; +extern const ByteSpan sTestCert_Node02_01_PrivateKey; +extern const ByteSpan sTestCert_Node02_01_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_01_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_02_Chip; +extern const ByteSpan sTestCert_Node02_02_DER; +extern const ByteSpan sTestCert_Node02_02_PublicKey; +extern const ByteSpan sTestCert_Node02_02_PrivateKey; +extern const ByteSpan sTestCert_Node02_02_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_02_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_03_Chip; +extern const ByteSpan sTestCert_Node02_03_DER; +extern const ByteSpan sTestCert_Node02_03_PublicKey; +extern const ByteSpan sTestCert_Node02_03_PrivateKey; +extern const ByteSpan sTestCert_Node02_03_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_03_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_04_Chip; +extern const ByteSpan sTestCert_Node02_04_DER; +extern const ByteSpan sTestCert_Node02_04_PublicKey; +extern const ByteSpan sTestCert_Node02_04_PrivateKey; +extern const ByteSpan sTestCert_Node02_04_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_04_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_05_Chip; +extern const ByteSpan sTestCert_Node02_05_DER; +extern const ByteSpan sTestCert_Node02_05_PublicKey; +extern const ByteSpan sTestCert_Node02_05_PrivateKey; +extern const ByteSpan sTestCert_Node02_05_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_05_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_06_Chip; +extern const ByteSpan sTestCert_Node02_06_DER; +extern const ByteSpan sTestCert_Node02_06_PublicKey; +extern const ByteSpan sTestCert_Node02_06_PrivateKey; +extern const ByteSpan sTestCert_Node02_06_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_06_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_07_Chip; +extern const ByteSpan sTestCert_Node02_07_DER; +extern const ByteSpan sTestCert_Node02_07_PublicKey; +extern const ByteSpan sTestCert_Node02_07_PrivateKey; +extern const ByteSpan sTestCert_Node02_07_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_07_AuthorityKeyId; + +extern const ByteSpan sTestCert_Node02_08_Chip; +extern const ByteSpan sTestCert_Node02_08_DER; +extern const ByteSpan sTestCert_Node02_08_PublicKey; +extern const ByteSpan sTestCert_Node02_08_PrivateKey; +extern const ByteSpan sTestCert_Node02_08_SubjectKeyId; +extern const ByteSpan sTestCert_Node02_08_AuthorityKeyId; } // namespace TestCerts } // namespace chip diff --git a/src/credentials/tests/TestChipCert.cpp b/src/credentials/tests/TestChipCert.cpp index e17de88eee1817..b81b8376fad974 100644 --- a/src/credentials/tests/TestChipCert.cpp +++ b/src/credentials/tests/TestChipCert.cpp @@ -186,7 +186,7 @@ static void TestChipCert_ChipToX509(nlTestSuite * inSuite, void * inContext) // Error Case: MutableByteSpan outCert(outCertBuf); - err = ConvertChipCertToX509Cert(ByteSpan(sTestCert_Node01_01_Err01_Chip, sTestCert_Node01_01_Err01_Chip_Len), outCert); + err = ConvertChipCertToX509Cert(sTestCert_Node01_01_Err01_Chip, outCert); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_TLV_TAG); } @@ -2059,12 +2059,12 @@ static void TestChipCert_ExtractPublicKeyAndSKID(nlTestSuite * inSuite, void * i struct TestCase { uint8_t Cert; - const uint8_t * ExpectedPublicKey; - const uint8_t * ExpectedSKID; + ByteSpan ExpectedPublicKey; + ByteSpan ExpectedSKID; }; // clang-format off - static constexpr TestCase sTestCases[] = { + static const TestCase sTestCases[] = { // Cert ExpectedPublicKey ExpectedSKID // ======================================================================================= { TestCert::kRoot01, sTestCert_Root01_PublicKey, sTestCert_Root01_SubjectKeyId }, @@ -2094,12 +2094,12 @@ static void TestChipCert_ExtractPublicKeyAndSKID(nlTestSuite * inSuite, void * i P256PublicKeySpan publicKey; err = ExtractPublicKeyFromChipCert(cert, publicKey); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, publicKey.data_equal(P256PublicKeySpan(testCase.ExpectedPublicKey))); + NL_TEST_ASSERT(inSuite, publicKey.data_equal(testCase.ExpectedPublicKey)); CertificateKeyId skid; err = ExtractSKIDFromChipCert(cert, skid); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, skid.data_equal(CertificateKeyId(testCase.ExpectedSKID))); + NL_TEST_ASSERT(inSuite, skid.data_equal(testCase.ExpectedSKID)); } } diff --git a/src/credentials/tests/TestFabricTable.cpp b/src/credentials/tests/TestFabricTable.cpp index bb7cfb910c8f73..3bcb5411560e7a 100644 --- a/src/credentials/tests/TestFabricTable.cpp +++ b/src/credentials/tests/TestFabricTable.cpp @@ -89,16 +89,17 @@ static CHIP_ERROR LoadTestFabric_Node01_01(nlTestSuite * inSuite, FabricTable & static Crypto::P256Keypair opKey_Node01_01; FabricIndex fabricIndex; - memcpy(opKeysSerialized.Bytes(), TestCerts::sTestCert_Node01_01_PublicKey, TestCerts::sTestCert_Node01_01_PublicKey_Len); - memcpy(opKeysSerialized.Bytes() + TestCerts::sTestCert_Node01_01_PublicKey_Len, TestCerts::sTestCert_Node01_01_PrivateKey, - TestCerts::sTestCert_Node01_01_PrivateKey_Len); + memcpy(opKeysSerialized.Bytes(), TestCerts::sTestCert_Node01_01_PublicKey.data(), + TestCerts::sTestCert_Node01_01_PublicKey.size()); + memcpy(opKeysSerialized.Bytes() + TestCerts::sTestCert_Node01_01_PublicKey.size(), + TestCerts::sTestCert_Node01_01_PrivateKey.data(), TestCerts::sTestCert_Node01_01_PrivateKey.size()); - ByteSpan rcacSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len); - ByteSpan icacSpan(TestCerts::sTestCert_ICA01_Chip, TestCerts::sTestCert_ICA01_Chip_Len); - ByteSpan nocSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len); + ByteSpan rcacSpan(TestCerts::sTestCert_Root01_Chip); + ByteSpan icacSpan(TestCerts::sTestCert_ICA01_Chip); + ByteSpan nocSpan(TestCerts::sTestCert_Node01_01_Chip); - ReturnErrorOnFailure( - opKeysSerialized.SetLength(TestCerts::sTestCert_Node01_01_PublicKey_Len + TestCerts::sTestCert_Node01_01_PrivateKey_Len)); + ReturnErrorOnFailure(opKeysSerialized.SetLength(TestCerts::sTestCert_Node01_01_PublicKey.size() + + TestCerts::sTestCert_Node01_01_PrivateKey.size())); ReturnErrorOnFailure(opKey_Node01_01.Deserialize(opKeysSerialized)); ReturnErrorOnFailure(fabricTable.AddNewPendingTrustedRootCert(rcacSpan)); @@ -119,15 +120,16 @@ static CHIP_ERROR LoadTestFabric_Node01_02(nlTestSuite * inSuite, FabricTable & FabricIndex fabricIndex; static Crypto::P256Keypair opKey_Node01_02; - memcpy(opKeysSerialized.Bytes(), TestCerts::sTestCert_Node01_02_PublicKey, TestCerts::sTestCert_Node01_02_PublicKey_Len); - memcpy(opKeysSerialized.Bytes() + TestCerts::sTestCert_Node01_02_PublicKey_Len, TestCerts::sTestCert_Node01_02_PrivateKey, - TestCerts::sTestCert_Node01_02_PrivateKey_Len); + memcpy(opKeysSerialized.Bytes(), TestCerts::sTestCert_Node01_02_PublicKey.data(), + TestCerts::sTestCert_Node01_02_PublicKey.size()); + memcpy(opKeysSerialized.Bytes() + TestCerts::sTestCert_Node01_02_PublicKey.size(), + TestCerts::sTestCert_Node01_02_PrivateKey.data(), TestCerts::sTestCert_Node01_02_PrivateKey.size()); - ByteSpan rcacSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len); - ByteSpan nocSpan(TestCerts::sTestCert_Node01_02_Chip, TestCerts::sTestCert_Node01_02_Chip_Len); + ByteSpan rcacSpan(TestCerts::sTestCert_Root01_Chip); + ByteSpan nocSpan(TestCerts::sTestCert_Node01_02_Chip); - ReturnErrorOnFailure( - opKeysSerialized.SetLength(TestCerts::sTestCert_Node01_02_PublicKey_Len + TestCerts::sTestCert_Node01_02_PrivateKey_Len)); + ReturnErrorOnFailure(opKeysSerialized.SetLength(TestCerts::sTestCert_Node01_02_PublicKey.size() + + TestCerts::sTestCert_Node01_02_PrivateKey.size())); ReturnErrorOnFailure(opKey_Node01_02.Deserialize(opKeysSerialized)); ReturnErrorOnFailure(fabricTable.AddNewPendingTrustedRootCert(rcacSpan)); @@ -152,17 +154,18 @@ static CHIP_ERROR LoadTestFabric_Node02_01(nlTestSuite * inSuite, FabricTable & FabricIndex fabricIndex; static Crypto::P256Keypair opKey_Node02_01; - memcpy(opKeysSerialized.Bytes(), TestCerts::sTestCert_Node02_01_PublicKey, TestCerts::sTestCert_Node02_01_PublicKey_Len); - memcpy(opKeysSerialized.Bytes() + TestCerts::sTestCert_Node02_01_PublicKey_Len, TestCerts::sTestCert_Node02_01_PrivateKey, - TestCerts::sTestCert_Node02_01_PrivateKey_Len); + memcpy(opKeysSerialized.Bytes(), TestCerts::sTestCert_Node02_01_PublicKey.data(), + TestCerts::sTestCert_Node02_01_PublicKey.size()); + memcpy(opKeysSerialized.Bytes() + TestCerts::sTestCert_Node02_01_PublicKey.size(), + TestCerts::sTestCert_Node02_01_PrivateKey.data(), TestCerts::sTestCert_Node02_01_PrivateKey.size()); - ByteSpan rcacSpan(TestCerts::sTestCert_Root02_Chip, TestCerts::sTestCert_Root02_Chip_Len); - ByteSpan icacSpan(TestCerts::sTestCert_ICA02_Chip, TestCerts::sTestCert_ICA02_Chip_Len); - ByteSpan nocSpan(TestCerts::sTestCert_Node02_01_Chip, TestCerts::sTestCert_Node02_01_Chip_Len); + ByteSpan rcacSpan(TestCerts::sTestCert_Root02_Chip); + ByteSpan icacSpan(TestCerts::sTestCert_ICA02_Chip); + ByteSpan nocSpan(TestCerts::sTestCert_Node02_01_Chip); NL_TEST_ASSERT(inSuite, - opKeysSerialized.SetLength(TestCerts::sTestCert_Node02_01_PublicKey_Len + - TestCerts::sTestCert_Node02_01_PrivateKey_Len) == CHIP_NO_ERROR); + opKeysSerialized.SetLength(TestCerts::sTestCert_Node02_01_PublicKey.size() + + TestCerts::sTestCert_Node02_01_PrivateKey.size()) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, opKey_Node02_01.Deserialize(opKeysSerialized) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, fabricTable.AddNewPendingTrustedRootCert(rcacSpan) == CHIP_NO_ERROR); @@ -218,7 +221,7 @@ void TestCollidingFabrics(nlTestSuite * inSuite, void * inContext) fabricTable.PermitCollidingFabrics(); NL_TEST_ASSERT(inSuite, LoadTestFabric_Node01_02(inSuite, fabricTable, /* doCommit = */ true) == CHIP_NO_ERROR); - ByteSpan rcacSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len); + ByteSpan rcacSpan(TestCerts::sTestCert_Root01_Chip); Credentials::P256PublicKeySpan rootPublicKeySpan; NL_TEST_ASSERT(inSuite, Credentials::ExtractPublicKeyFromChipCert(rcacSpan, rootPublicKeySpan) == CHIP_NO_ERROR); @@ -228,7 +231,7 @@ void TestCollidingFabrics(nlTestSuite * inSuite, void * inContext) // { chip::Platform::ScopedMemoryBuffer nocBuf; - ByteSpan origNocSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len); + ByteSpan origNocSpan(TestCerts::sTestCert_Node01_01_Chip); NodeId nodeId; FabricId fabricId; @@ -238,7 +241,7 @@ void TestCollidingFabrics(nlTestSuite * inSuite, void * inContext) { chip::Platform::ScopedMemoryBuffer nocBuf; - ByteSpan origNocSpan(TestCerts::sTestCert_Node01_02_Chip, TestCerts::sTestCert_Node01_02_Chip_Len); + ByteSpan origNocSpan(TestCerts::sTestCert_Node01_02_Chip); NodeId nodeId; FabricId fabricId; @@ -2357,12 +2360,12 @@ void TestFabricLookup(nlTestSuite * inSuite, void * inContext) // Attempt lookup of the Root01 fabric. { Crypto::P256PublicKey key; - NL_TEST_ASSERT(inSuite, key.Length() >= TestCerts::sTestCert_Root01_PublicKey_Len); - if (key.Length() < TestCerts::sTestCert_Root01_PublicKey_Len) + NL_TEST_ASSERT(inSuite, key.Length() >= TestCerts::sTestCert_Root01_PublicKey.size()); + if (key.Length() < TestCerts::sTestCert_Root01_PublicKey.size()) { return; } - memcpy(key.Bytes(), TestCerts::sTestCert_Root01_PublicKey, TestCerts::sTestCert_Root01_PublicKey_Len); + memcpy(key.Bytes(), TestCerts::sTestCert_Root01_PublicKey.data(), TestCerts::sTestCert_Root01_PublicKey.size()); auto fabricInfo = fabricTable.FindFabric(key, 0xFAB000000000001D); NL_TEST_ASSERT(inSuite, fabricInfo != nullptr); if (fabricInfo == nullptr) @@ -2376,12 +2379,12 @@ void TestFabricLookup(nlTestSuite * inSuite, void * inContext) // Attempt lookup of the Root02 fabric. { Crypto::P256PublicKey key; - NL_TEST_ASSERT(inSuite, key.Length() >= TestCerts::sTestCert_Root02_PublicKey_Len); - if (key.Length() < TestCerts::sTestCert_Root02_PublicKey_Len) + NL_TEST_ASSERT(inSuite, key.Length() >= TestCerts::sTestCert_Root02_PublicKey.size()); + if (key.Length() < TestCerts::sTestCert_Root02_PublicKey.size()) { return; } - memcpy(key.Bytes(), TestCerts::sTestCert_Root02_PublicKey, TestCerts::sTestCert_Root02_PublicKey_Len); + memcpy(key.Bytes(), TestCerts::sTestCert_Root02_PublicKey.data(), TestCerts::sTestCert_Root02_PublicKey.size()); auto fabricInfo = fabricTable.FindFabric(key, 0xFAB000000000001D); NL_TEST_ASSERT(inSuite, fabricInfo != nullptr); if (fabricInfo == nullptr) diff --git a/src/crypto/tests/CHIPCryptoPALTest.cpp b/src/crypto/tests/CHIPCryptoPALTest.cpp index 98be91ee13c706..4c4b37d39bddf7 100644 --- a/src/crypto/tests/CHIPCryptoPALTest.cpp +++ b/src/crypto/tests/CHIPCryptoPALTest.cpp @@ -2104,7 +2104,7 @@ static void TestX509_CertChainValidation(nlTestSuite * inSuite, void * inContext { sTestCert_PAA_FFF2_ValInPast_Cert, sTestCert_PAI_FFF2_8006_ValInPast_Cert, sTestCert_DAC_FFF2_8006_0024_ValInPast_Cert, CHIP_NO_ERROR, CertificateChainValidationResult::kSuccess }, { sTestCert_PAA_FFF2_ValInFuture_Cert, sTestCert_PAI_FFF2_8006_ValInFuture_Cert, sTestCert_DAC_FFF2_8006_0025_ValInFuture_Cert, CHIP_NO_ERROR, CertificateChainValidationResult::kSuccess }, // Valid cases without intermediate: - { ByteSpan(sTestCert_Root01_DER, sTestCert_Root01_DER_Len), ByteSpan(), ByteSpan(sTestCert_Node01_02_DER, sTestCert_Node01_02_DER_Len), CHIP_NO_ERROR, CertificateChainValidationResult::kSuccess }, + { sTestCert_Root01_DER, ByteSpan(), sTestCert_Node01_02_DER, CHIP_NO_ERROR, CertificateChainValidationResult::kSuccess }, // Error cases with invalid (empty Span) inputs: { ByteSpan(), sTestCert_PAI_FFF1_8000_Cert, sTestCert_DAC_FFF1_8000_0000_Cert, CHIP_ERROR_INVALID_ARGUMENT, CertificateChainValidationResult::kRootArgumentInvalid }, { sTestCert_PAA_FFF1_Cert, sTestCert_PAI_FFF1_8000_Cert, ByteSpan(), CHIP_ERROR_INVALID_ARGUMENT, CertificateChainValidationResult::kLeafArgumentInvalid }, diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index c0a6e6ac2c5b48..b4e090d3eb6b93 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -252,15 +252,16 @@ CHIP_ERROR InitCredentialSets() P256SerializedKeypair opKeysSerialized; // TODO: Rename gCommissioner* to gInitiator* - memcpy(opKeysSerialized.Bytes(), sTestCert_Node01_02_PublicKey, sTestCert_Node01_02_PublicKey_Len); - memcpy(opKeysSerialized.Bytes() + sTestCert_Node01_02_PublicKey_Len, sTestCert_Node01_02_PrivateKey, - sTestCert_Node01_02_PrivateKey_Len); + memcpy(opKeysSerialized.Bytes(), sTestCert_Node01_02_PublicKey.data(), sTestCert_Node01_02_PublicKey.size()); + memcpy(opKeysSerialized.Bytes() + sTestCert_Node01_02_PublicKey.size(), sTestCert_Node01_02_PrivateKey.data(), + sTestCert_Node01_02_PrivateKey.size()); - ReturnErrorOnFailure(opKeysSerialized.SetLength(sTestCert_Node01_02_PublicKey_Len + sTestCert_Node01_02_PrivateKey_Len)); + ReturnErrorOnFailure( + opKeysSerialized.SetLength(sTestCert_Node01_02_PublicKey.size() + sTestCert_Node01_02_PrivateKey.size())); - chip::ByteSpan rcacSpan(sTestCert_Root01_Chip, sTestCert_Root01_Chip_Len); - chip::ByteSpan icacSpan(sTestCert_ICA01_Chip, sTestCert_ICA01_Chip_Len); - chip::ByteSpan nocSpan(sTestCert_Node01_02_Chip, sTestCert_Node01_02_Chip_Len); + chip::ByteSpan rcacSpan(sTestCert_Root01_Chip); + chip::ByteSpan icacSpan(sTestCert_ICA01_Chip); + chip::ByteSpan nocSpan(sTestCert_Node01_02_Chip); chip::ByteSpan opKeySpan(opKeysSerialized.ConstBytes(), opKeysSerialized.Length()); ReturnErrorOnFailure( @@ -281,11 +282,12 @@ CHIP_ERROR InitCredentialSets() P256SerializedKeypair opKeysSerialized; auto deviceOpKey = Platform::MakeUnique(); - memcpy(opKeysSerialized.Bytes(), sTestCert_Node01_01_PublicKey, sTestCert_Node01_01_PublicKey_Len); - memcpy(opKeysSerialized.Bytes() + sTestCert_Node01_01_PublicKey_Len, sTestCert_Node01_01_PrivateKey, - sTestCert_Node01_01_PrivateKey_Len); + memcpy(opKeysSerialized.Bytes(), sTestCert_Node01_01_PublicKey.data(), sTestCert_Node01_01_PublicKey.size()); + memcpy(opKeysSerialized.Bytes() + sTestCert_Node01_01_PublicKey.size(), sTestCert_Node01_01_PrivateKey.data(), + sTestCert_Node01_01_PrivateKey.size()); - ReturnErrorOnFailure(opKeysSerialized.SetLength(sTestCert_Node01_01_PublicKey_Len + sTestCert_Node01_01_PrivateKey_Len)); + ReturnErrorOnFailure( + opKeysSerialized.SetLength(sTestCert_Node01_01_PublicKey.size() + sTestCert_Node01_01_PrivateKey.size())); ReturnErrorOnFailure(deviceOpKey->Deserialize(opKeysSerialized)); @@ -295,9 +297,9 @@ CHIP_ERROR InitCredentialSets() ReturnErrorOnFailure( InitFabricTable(gDeviceFabrics, &gDeviceStorageDelegate, &gDeviceOperationalKeystore, &gDeviceOpCertStore)); - chip::ByteSpan rcacSpan(sTestCert_Root01_Chip, sTestCert_Root01_Chip_Len); - chip::ByteSpan icacSpan(sTestCert_ICA01_Chip, sTestCert_ICA01_Chip_Len); - chip::ByteSpan nocSpan(sTestCert_Node01_01_Chip, sTestCert_Node01_01_Chip_Len); + chip::ByteSpan rcacSpan(sTestCert_Root01_Chip); + chip::ByteSpan icacSpan(sTestCert_ICA01_Chip); + chip::ByteSpan nocSpan(sTestCert_Node01_01_Chip); ReturnErrorOnFailure(gDeviceFabrics.AddNewFabricForTest(rcacSpan, icacSpan, nocSpan, ByteSpan{}, &gDeviceFabricIndex)); }