1 // This file contains incorrect key data in a variety of formats.
2 // "key" -- either a dictionary for JWK, or hex encoded bytes for PKCS8/SPKI.
3 // "key_format" -- one of: "jwk", "pkcs8", "spki"
4 // "error" -- The expected rejection reason when importing the key.
6 // --------------------------------------------------------------------------
8 // --------------------------------------------------------------------------
9 // TODO(eroman): Group the bad public keys by format type.
11 // Import Error: P-521 is requested by importKey(), however the JWK's curve is for P-256.
18 "x": "APUKCHAyUMFfBDyMRumXg0NSRc-Y9PJpSw4vjQKaUU3W8LCG1O2JIADNVZAQeq5pxMCnqV98905XcKB9XbVbzkq0",
19 "y": "APLHcLq4ub5M227NPcJsaY2g0lmc6_PZBPf5yjpV5kcxgQ1zzTFyZOULq6S8KGCFfhbWy7eVAbyeOjK9Fy6opx3u"
21 "error": "DataError: The JWK's \"crv\" member specifies a different curve than requested"
24 // Import Error: P-521 is requested by importKey(), however the JWK's algorithm implies P-256
32 "x": "APUKCHAyUMFfBDyMRumXg0NSRc-Y9PJpSw4vjQKaUU3W8LCG1O2JIADNVZAQeq5pxMCnqV98905XcKB9XbVbzkq0",
33 "y": "APLHcLq4ub5M227NPcJsaY2g0lmc6_PZBPf5yjpV5kcxgQ1zzTFyZOULq6S8KGCFfhbWy7eVAbyeOjK9Fy6opx3u"
35 "error": "DataError: The JWK \"alg\" member was inconsistent with that specified by the Web Crypto call"
38 // Import Error: crv is missing
44 "x": "hqwS3Qp_5bgf2uhrEkNdMW75OSo_ULMHq2XZxged0NLYGdwJ4ihhRZwu2Z-6tm-u",
45 "y": "rIREB3qu1tbMrL5npMqs7gtaCUo1dcoS6ktHdMAw_hyHDJJJAj9dxNmtbjM2aMw4"
47 "error": "DataError: The required JWK member \"crv\" was missing"
50 // Import Error: x is missing
57 "y": "rIREB3qu1tbMrL5npMqs7gtaCUo1dcoS6ktHdMAw_hyHDJJJAj9dxNmtbjM2aMw4"
59 "error": "DataError: The required JWK member \"x\" was missing"
62 // Import Error: Invalid key (x was corrupted)
69 "x": "nLPPaTA9r8dh1ORoe07PA55tNKuWSvgIENjVWKSo1vc",
70 "y": "LVEjOheIkgqG7gihlix576MX-3h54pfa0hRtuZX6HHg"
75 // Import Error: Incorrect kty.
82 "x": "hqwS3Qp_5bgf2uhrEkNdMW75OSo_ULMHq2XZxged0NLYGdwJ4ihhRZwu2Z-6tm-u",
83 "y": "rIREB3qu1tbMrL5npMqs7gtaCUo1dcoS6ktHdMAw_hyHDJJJAj9dxNmtbjM2aMw4"
85 "error": "DataError: The JWK \"kty\" member was not \"EC\""
88 // Import Error: SPKI data is empty.
96 // Import Error: SPKI data is invalid.
104 // Import Error: SPKI data is invalid (1 byte was corrupted)
107 "key_format": "spki",
108 "key": "3059301306072A8648CE3D020106082A8748CE3D030107034200049CB0CF69303DAFC761D4E4687B4ECF039E6D34AB964AF80810D8D558A4A8D6F72D51233A1788920A86EE08A1962C79EFA317FB7879E297DAD2146DB995FA1C78",
112 // Import Error: SPKI data is invalid (1 byte truncated from end)
115 "key_format": "spki",
116 "key": "3059301306072A8648CE3D020106082A8648CE3D030107034200049CB0CF69303DAFC761D4E4687B4ECF039E6D34AB964AF80810D8D558A4A8D6F72D51233A1788920A86EE08A1962C79EFA317FB7879E297DAD2146DB995FA1C",
120 // Import Error: Valid SPKI data was provided, however it is for an RSA key
123 "key_format": "spki",
124 "key": "30819f300d06092a864886f70d010101050003818d0030818902818100a56e4a0e701017589a5187dc7ea841d156f2ec0e36ad52a44dfeb1e61f7ad991d8c51056ffedb162b4c0f283a12a88a394dff526ab7291cbb307ceabfce0b1dfd5cd9508096d5b2b8b6df5d671ef6377c0921cb23c270a70e2598e6ff89d19f105acc2d3f0cb35f29280e1386b6f64c4ef22e1e1f20d0ce8cffb2249bd9a21370203010001",
128 // Import Error: JWK was given where the "x" member is not zero-padded.
135 "x": "2A0aLWA8otEPMLZFAksn2h5JC3HrJNNu4MRksc-b2Q",
136 "y": "lZYURbYRHyeqmHQOEKxrVVJZzL0_BByXwMCwRKzAN_k"
138 "error": "DataError: The JWK's \"x\" member defines an octet string of length 31 bytes but should be 32"
141 // Import Error: JWK was given where the "x" member is not zero-padded.
148 "x": "V_S9kHyUTFiXiIJNovS89K0ctDtXe2qthCWjs4J7Bb0",
149 "y": "e-6aI45DddCJGrGWqgH83fFjn_eS7s8ygoeZJbh2Bg"
151 "error": "DataError: The JWK's \"y\" member defines an octet string of length 31 bytes but should be 32"
154 // Import Error: The SPKI is valid, however contains 3 trailing bytes.
157 "key_format": "spki",
158 "key": "3059301306072A8648CE3D020106082A8648CE3D030107034200049CB0CF69303DAFC761D4E4687B4ECF039E6D34AB964AF80810D8D558A4A8D6F72D51233A1788920A86EE08A1962C79EFA317FB7879E297DAD2146DB995FA1C78000000",
162 // --------------------------------------------------------------------------
163 // Bad private keys (JWK)
164 // --------------------------------------------------------------------------
166 // The "d" parameter was modified, such that it is no longer consistent with
174 "d": "H-M5UMX0YRKK6ZLCvf3xxzsWFfVxvVZ-YNGaofSM30I",
175 "x": "fBEMZtz9qAf25p5F3bPHT2mhSE0gPo3Frajpqd18s8c",
176 "y": "DfRImG5RveXRV2-ZkB-cLGqAakf9kHZDpyuDVZfvyMY"
178 "error": "DataError: The imported EC key is invalid"
181 // The "d" parameter is empty.
189 "x": "fBEMZtz9qAf25p5F3bPHT2mhSE0gPo3Frajpqd18s8c",
190 "y": "DfRImG5RveXRV2-ZkB-cLGqAakf9kHZDpyuDVZfvyMY"
192 "error": "DataError: The JWK's \"d\" member defines an octet string of length 0 bytes but should be 32"
195 // The y parameter has been modified (no longer a valid point on curve).
202 "d": "pJLOj6kAhMIn4aMveXTTnp_2en6HBew0GbNftgdYK-vUYeCxUgrHbsLdTptj665x",
203 "x": "5V_ubEnY1SP1znv5wEJc5P9lBwi33lz7CVkBUjl5p_BCYC2zCFRzU2mBO1w_Xvho",
204 "y": "KPWcxdxQlJKpiNOKjiUZ3j0MT9D72wmT448YUGwXYGxeJCSSRvHOlJg6U2HFvpg-"
209 // --------------------------------------------------------------------------
210 // Bad private keys (PKCS8)
211 // --------------------------------------------------------------------------
213 // The private key is exactly equal to the order, and the public key is
214 // private key * order.
217 "key_format": "pkcs8",
218 "key": "3066020100301306072A8648CE3D020106082A8648CE3D030107044C304A0201010420FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551A12303210000FFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551",
222 // The private key is exactly equal to the order, and the public key is
226 "key_format": "pkcs8",
227 "key": "3041020100301306072A8648CE3D020106082A8648CE3D030107042730250201010420FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551",
228 "error": "DataError: The imported EC key is invalid"
231 // The private key is exactly equal to the order + 11, and the public key is
232 // private key * order.
235 "key_format": "pkcs8",
236 "key": "3081EE020100301006072A8648CE3D020106052B810400230481D63081D3020101044201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386414A181890381860004008A75841259FDEDFF546F1A39573B4315CFED5DC7ED7C17849543EF2C54F2991652F3DBC5332663DA1BD19B1AEBE3191085015C024FA4C9A902ECC0E02DDA0CDB9A0096FB303FCBBA2129849D0CA877054FB2293ADD566210BD0493ED2E95D4E0B9B82B1BC8A90E8B42A4AB3892331914A95336DCAC80E3F4819B5D58874F92CE48C808",
237 "error": "DataError: The imported EC key is invalid"
240 // The private key is exactly equal to the order + 11, and the public key is
244 "key_format": "pkcs8",
245 "key": "3060020100301006072A8648CE3D020106052B8104002304493047020101044201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386414",
246 "error": "DataError: The imported EC key is invalid"