Skip to content

Commit

Permalink
Add test with X.509 invalid pathLen extension (#27322)
Browse files Browse the repository at this point in the history
* Add test with X.509 invalid pathLen extension

- Just some test added, no functional change

* Restyled by clang-format

---------

Co-authored-by: tennessee.carmelveilleux@gmail.com <tennessee@google.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
3 people authored and pull[bot] committed Jan 23, 2024
1 parent 7fd3bc8 commit 2128948
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/crypto/tests/CHIPCryptoPALTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,7 @@ static void TestX509_VerifyAttestationCertificateFormat(nlTestSuite * inSuite, v
{ ByteSpan{kPaiPathLenMissing}, Crypto::AttestationCertType::kPAI, CHIP_ERROR_INTERNAL },
{ ByteSpan{kPaiPathLen1}, Crypto::AttestationCertType::kPAI, CHIP_ERROR_INTERNAL },
{ ByteSpan{kPaaPathLen2}, Crypto::AttestationCertType::kPAA, CHIP_ERROR_INTERNAL },
{ ByteSpan{kWrongPathLenFormat}, Crypto::AttestationCertType::kPAI, CHIP_ERROR_INTERNAL },
};
// clang-format on

Expand Down
39 changes: 39 additions & 0 deletions src/crypto/tests/DacValidationExplicitVectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,42 @@ const uint8_t kPaaPathLen2[448] = {
0x1a, 0xfc, 0xfb, 0x51, 0x6f, 0x6b, 0x46, 0x47, 0xfc, 0xa7, 0xf4, 0x86, 0x35, 0xb2, 0xac, 0xb8, 0xb8, 0x8d, 0x9b, 0xc2, 0x39,
0x89, 0xd7, 0x2d, 0x42, 0x0d, 0xde, 0x6b,
};

/*
-----BEGIN CERTIFICATE-----
MIIBuzCCAWKgAwIBAgIIEl3k+yzkQuowCgYIKoZIzj0EAwIwGjEYMBYGA1UEAwwP
TWF0dGVyIFRlc3QgUEFBMB4XDTIxMDYyODE0MjM0M1oXDTMzMDYyODE0MjM0Mlow
RjEYMBYGA1UEAwwPTWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZG
MjEUMBIGCisGAQQBgqJ8AgIMBDgwMDUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC
AAQso3JRSRbamUuVk4C2aycB9M84CPOT9xaxI4nC+VqK8vSTJiploKPr+BvganEH
MqCqoC/1KO+Vi/0gMmMvvYhfo2YwZDASBgNVHRMBAf8ECDAGAQH/EwExMA4GA1Ud
DwEB/wQEAwIBBjAdBgNVHQ4EFgQU2tRnb1BtRUPblHbWGGkcZ0lyjQgwHwYDVR0j
BBgwFoAUeFznBbhrj05vx5OqYMtD6mlogtUwCgYIKoZIzj0EAwIDRwAwRAIgYreX
c1Ny+5HZRSxqT4gPVP5z5ZkhZXUSYW7GHaqs8VACID/8iIGshdedcjAbI6sQO+At
evcOqLypxnhGVlL2gQnf
-----END CERTIFICATE-----
*/
const uint8_t kWrongPathLenFormat[447] = {
0x30, 0x82, 0x01, 0xbb, 0x30, 0x82, 0x01, 0x62, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x12, 0x5d, 0xe4, 0xfb, 0x2c, 0xe4,
0x42, 0xea, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16, 0x06,
0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41,
0x30, 0x1e, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x17, 0x0d, 0x33, 0x33,
0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x32, 0x5a, 0x30, 0x46, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04,
0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x49, 0x31, 0x14, 0x30,
0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x32, 0x31, 0x14,
0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x35, 0x30,
0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
0x07, 0x03, 0x42, 0x00, 0x04, 0x2c, 0xa3, 0x72, 0x51, 0x49, 0x16, 0xda, 0x99, 0x4b, 0x95, 0x93, 0x80, 0xb6, 0x6b, 0x27, 0x01,
0xf4, 0xcf, 0x38, 0x08, 0xf3, 0x93, 0xf7, 0x16, 0xb1, 0x23, 0x89, 0xc2, 0xf9, 0x5a, 0x8a, 0xf2, 0xf4, 0x93, 0x26, 0x2a, 0x65,
0xa0, 0xa3, 0xeb, 0xf8, 0x1b, 0xe0, 0x6a, 0x71, 0x07, 0x32, 0xa0, 0xaa, 0xa0, 0x2f, 0xf5, 0x28, 0xef, 0x95, 0x8b, 0xfd, 0x20,
0x32, 0x63, 0x2f, 0xbd, 0x88, 0x5f, 0xa3, 0x66, 0x30, 0x64, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04,
0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x13, 0x01, 0x31, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04,
0x03, 0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xda, 0xd4, 0x67, 0x6f, 0x50, 0x6d,
0x45, 0x43, 0xdb, 0x94, 0x76, 0xd6, 0x18, 0x69, 0x1c, 0x67, 0x49, 0x72, 0x8d, 0x08, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23,
0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x78, 0x5c, 0xe7, 0x05, 0xb8, 0x6b, 0x8f, 0x4e, 0x6f, 0xc7, 0x93, 0xaa, 0x60, 0xcb, 0x43,
0xea, 0x69, 0x68, 0x82, 0xd5, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30,
0x44, 0x02, 0x20, 0x62, 0xb7, 0x97, 0x73, 0x53, 0x72, 0xfb, 0x91, 0xd9, 0x45, 0x2c, 0x6a, 0x4f, 0x88, 0x0f, 0x54, 0xfe, 0x73,
0xe5, 0x99, 0x21, 0x65, 0x75, 0x12, 0x61, 0x6e, 0xc6, 0x1d, 0xaa, 0xac, 0xf1, 0x50, 0x02, 0x20, 0x3f, 0xfc, 0x88, 0x81, 0xac,
0x85, 0xd7, 0x9d, 0x72, 0x30, 0x1b, 0x23, 0xab, 0x10, 0x3b, 0xe0, 0x2d, 0x7a, 0xf7, 0x0e, 0xa8, 0xbc, 0xa9, 0xc6, 0x78, 0x46,
0x56, 0x52, 0xf6, 0x81, 0x09, 0xdf,
};

0 comments on commit 2128948

Please sign in to comment.