Commit 50079844 authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

device/fido: fix COSE Keys in test data.

The COSE Key structures in our unittests were not in the correct format.

Change-Id: Ib2a7a914beaf3fdb4cd851076c49eae969810f44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2177189
Commit-Queue: Adam Langley <agl@chromium.org>
Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Cr-Commit-Position: refs/heads/master@{#765399}
parent 86b7fcbf
...@@ -647,24 +647,24 @@ TEST(CTAPResponseTest, TestSerializeGetInfoResponse) { ...@@ -647,24 +647,24 @@ TEST(CTAPResponseTest, TestSerializeGetInfoResponse) {
TEST(CTAPResponseTest, TestSerializeMakeCredentialResponse) { TEST(CTAPResponseTest, TestSerializeMakeCredentialResponse) {
constexpr uint8_t kCoseEncodedPublicKey[] = { constexpr uint8_t kCoseEncodedPublicKey[] = {
// clang-format off // clang-format off
// map(3) // map(5)
0xa3, 0xa5,
// "x" 0x01, // unsigned(1) kty
0x61, 0x78, 0x02, // unsigned(2) EC2
0x03, // unsigned(3) alg
0x26, // negative(6) ES256
0x20, // negative(0) crv
0x01, // unsigned(1) P-256
0x21, // negative(1) x
// byte(32) // byte(32)
0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4, 0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4,
0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6, 0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6,
0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a, 0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a,
// "y" 0x22, // negative(2) y
0x61, 0x79,
// byte(32) // byte(32)
0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21, 0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21,
0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61, 0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61,
0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84, 0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84,
// "fmt"
0x63, 0x61, 0x6c, 0x67,
// "ES256"
0x65, 0x45, 0x53, 0x32, 0x35, 0x36,
// clang-format on // clang-format on
}; };
......
...@@ -1216,8 +1216,8 @@ constexpr uint8_t kTestMakeCredentialResponse[] = { ...@@ -1216,8 +1216,8 @@ constexpr uint8_t kTestMakeCredentialResponse[] = {
0x66, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x66, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64,
// key(02) - Authenticator Data // key(02) - Authenticator Data
0x02, 0x02,
// Byte(154) // Byte(148)
0x58, 0x9a, 0x58, 0x94,
// RP ID hash // RP ID hash
0x11, 0x94, 0x22, 0x8d, 0xa8, 0xfd, 0xbd, 0xee, 0xfd, 0x26, 0x1b, 0xd7, 0x11, 0x94, 0x22, 0x8d, 0xa8, 0xfd, 0xbd, 0xee, 0xfd, 0x26, 0x1b, 0xd7,
0xb6, 0x59, 0x5c, 0xfd, 0x70, 0xa5, 0x0d, 0x70, 0xc6, 0x40, 0x7b, 0xcf, 0xb6, 0x59, 0x5c, 0xfd, 0x70, 0xa5, 0x0d, 0x70, 0xc6, 0x40, 0x7b, 0xcf,
...@@ -1235,24 +1235,24 @@ constexpr uint8_t kTestMakeCredentialResponse[] = { ...@@ -1235,24 +1235,24 @@ constexpr uint8_t kTestMakeCredentialResponse[] = {
0x89, 0x59, 0xce, 0xad, 0x5b, 0x5c, 0x48, 0x16, 0x4e, 0x8a, 0xbc, 0xd6, 0x89, 0x59, 0xce, 0xad, 0x5b, 0x5c, 0x48, 0x16, 0x4e, 0x8a, 0xbc, 0xd6,
0xd9, 0x43, 0x5c, 0x6f, 0xd9, 0x43, 0x5c, 0x6f,
// Public key in COSE_key format // Public key in COSE_key format
// map(3) // map(5)
0xa3, 0xa5,
// "x" 0x01, // unsigned(1) kty
0x61, 0x78, 0x02, // unsigned(2) EC2
// Byte(32) 0x03, // unsigned(3) alg
0x26, // negative(6) ES256
0x20, // negative(0) crv
0x01, // unsigned(1) P-256
0x21, // negative(1) x
// byte(32)
0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4, 0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4,
0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6, 0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6,
0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a, 0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a,
// "y" 0x22, // negative(2) y
0x61, 0x79, // byte(32)
// Byte(32)
0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21, 0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21,
0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61, 0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61,
0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84, 0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84,
// "alg"
0x63, 0x61, 0x6c, 0x67,
// "ES256"
0x65, 0x45, 0x53, 0x32, 0x35, 0x36,
// Key(03) - Attestation object // Key(03) - Attestation object
0x03, 0x03,
// Map - Attestation object // Map - Attestation object
...@@ -1540,24 +1540,24 @@ constexpr uint8_t kCtap2MakeCredentialAuthData[] = { ...@@ -1540,24 +1540,24 @@ constexpr uint8_t kCtap2MakeCredentialAuthData[] = {
0x89, 0x59, 0xce, 0xad, 0x5b, 0x5c, 0x48, 0x16, 0x4e, 0x8a, 0xbc, 0xd6, 0x89, 0x59, 0xce, 0xad, 0x5b, 0x5c, 0x48, 0x16, 0x4e, 0x8a, 0xbc, 0xd6,
0xd9, 0x43, 0x5c, 0x6f, 0xd9, 0x43, 0x5c, 0x6f,
// Public key in COSE_key format // Public key in COSE_key format
// map(3) // map(5)
0xa3, 0xa5,
// "x" 0x01, // unsigned(1) kty
0x61, 0x78, 0x02, // unsigned(2) EC2
0x03, // unsigned(3) alg
0x26, // negative(6) ES256
0x20, // negative(0) crv
0x01, // unsigned(1) P-256
0x21, // negative(1) x
// byte(32) // byte(32)
0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4, 0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4,
0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6, 0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6,
0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a, 0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a,
// "y" 0x22, // negative(2) y
0x61, 0x79,
// byte(32) // byte(32)
0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21, 0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21,
0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61, 0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61,
0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84, 0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84,
// "alg"
0x63, 0x61, 0x6c, 0x67,
// "ES256"
0x65, 0x45, 0x53, 0x32, 0x35, 0x36,
// clang-format on // clang-format on
}; };
...@@ -1596,8 +1596,8 @@ constexpr uint8_t kNoneAttestationResponse[] = { ...@@ -1596,8 +1596,8 @@ constexpr uint8_t kNoneAttestationResponse[] = {
0x68, 0x68,
// text(8) - "authData" // text(8) - "authData"
0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61,
// bytes(154) // bytes(148)
0x58, 0x9a, 0x58, 0x94,
// byte data // byte data
0x11, 0x94, 0x22, 0x8D, 0xA8, 0xFD, 0xBD, 0xEE, 0xFD, 0x26, 0x1B, 0xD7, 0x11, 0x94, 0x22, 0x8D, 0xA8, 0xFD, 0xBD, 0xEE, 0xFD, 0x26, 0x1B, 0xD7,
0xB6, 0x59, 0x5C, 0xFD, 0x70, 0xA5, 0x0D, 0x70, 0xC6, 0x40, 0x7B, 0xCF, 0xB6, 0x59, 0x5C, 0xFD, 0x70, 0xA5, 0x0D, 0x70, 0xC6, 0x40, 0x7B, 0xCF,
...@@ -1610,24 +1610,24 @@ constexpr uint8_t kNoneAttestationResponse[] = { ...@@ -1610,24 +1610,24 @@ constexpr uint8_t kNoneAttestationResponse[] = {
0x00, 0x10, 0x89, 0x59, 0xce, 0xad, 0x5b, 0x5c, 0x48, 0x16, 0x4e, 0x8a, 0x00, 0x10, 0x89, 0x59, 0xce, 0xad, 0x5b, 0x5c, 0x48, 0x16, 0x4e, 0x8a,
0xbc, 0xd6, 0xd9, 0x43, 0x5c, 0x6f, 0xbc, 0xd6, 0xd9, 0x43, 0x5c, 0x6f,
// Public key in COSE_key format // Public key in COSE_key format
// map(3) // map(5)
0xa3, 0xa5,
// "x" 0x01, // unsigned(1) kty
0x61, 0x78, 0x02, // unsigned(2) EC2
0x03, // unsigned(3) alg
0x26, // negative(6) ES256
0x20, // negative(0) crv
0x01, // unsigned(1) P-256
0x21, // negative(1) x
// byte(32) // byte(32)
0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4, 0x58, 0x20, 0xf7, 0xc4, 0xf4, 0xa6, 0xf1, 0xd7, 0x95, 0x38, 0xdf, 0xa4,
0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6, 0xc9, 0xac, 0x50, 0x84, 0x8d, 0xf7, 0x08, 0xbc, 0x1c, 0x99, 0xf5, 0xe6,
0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a, 0x0e, 0x51, 0xb4, 0x2a, 0x52, 0x1b, 0x35, 0xd3, 0xb6, 0x9a,
// "y" 0x22, // negative(2) y
0x61, 0x79,
// byte(32) // byte(32)
0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21, 0x58, 0x20, 0xde, 0x7b, 0x7d, 0x6c, 0xa5, 0x64, 0xe7, 0x0e, 0xa3, 0x21,
0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61, 0xa4, 0xd5, 0xd9, 0x6e, 0xa0, 0x0e, 0xf0, 0xe2, 0xdb, 0x89, 0xdd, 0x61,
0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84, 0xd4, 0x89, 0x4c, 0x15, 0xac, 0x58, 0x5b, 0xd2, 0x36, 0x84,
// "alg"
0x63, 0x61, 0x6c, 0x67,
// "ES256"
0x65, 0x45, 0x53, 0x32, 0x35, 0x36,
// clang-format on // clang-format on
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment