Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Side by Side Diff: content/test/data/webcrypto/ecdsa.json

Issue 698363002: webcrypto: Add ECDSA algorithm (chromium-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extract_more
Patch Set: sigh, more android pedantry Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/test/data/webcrypto/ec_private_keys.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // This file contains known answers for ECDSA verify() testing.
2 // The tests include successful verifications, as well as malformed inputs -- ba d keys, malformed signature, etc.
3 //
4 // These are the possible fields for each test:
5 // "key_format" -- The format of the key data. Can be one of: {"jwk", "spki", "nist".
6 // "key" -- The public key data. Either a dictionary JWK, or hex encoded bytes (for SPKI)
7 // "msg" -- The hex-encoded message to be verified
8 // "sig" -- The hex-encoded ECDSA signature as a concatenation of "r" and "s".
9 // "error" -- Optional. If provided, either the importKey() or verify() is exp ected to fail with the indicated error.
10 // "verify_result" -- Expected boolean result from verify().
11 [
12
13 // --------------------------------------------------------------------------
14 // Successful verifications (P256, P384, P521)
15 // --------------------------------------------------------------------------
16
17 // From http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvecto rs.zip (SigVer.rsp)
18 {
19 "curve": "P-256",
20 "hash": "sha-512",
21 "key_format": "jwk",
22 "key": {
23 "kty": "EC",
24 "crv": "P-256",
25 "x": "nLDPaTA9r8dh1ORoe07PA55tNKuWSvgIENjVWKSo1vc",
26 "y": "LVEjOheIkgqG7gihlix576MX-3h54pfa0hRtuZX6HHg"
27 },
28 "msg": "6e2932153301a4eef680e6428929adae988c108d668a31ff55d0489947d75ff81a46 bf89e84d6401f023be6e87688fbcd784d785ca846735524acb52d00452c84040a479e7cc33093644 1d93bbe722a9432a6e1db112b5c9403b10272cb1347fd619d463f7a9d223ad76fde06d8a6883500f b843235abff98e241bdfb5538c3e",
29 "sig": "4b9f91e4285287261a1d1c923cf619cd52c175cfe7f1be60a5258c610348ba3d28c4 5f901d71c41b298638ec0d6a85d7fcb0c33bbfec5a9c810846b639289a84",
30 "verify_result": true
31 },
32
33 // Same test as above, except the key format is SPKI.
34 {
35 "curve": "P-256",
36 "hash": "sha-512",
37 "key_format": "spki",
38 "key": "3059301306072A8648CE3D020106082A8648CE3D030107034200049CB0CF69303DAF C761D4E4687B4ECF039E6D34AB964AF80810D8D558A4A8D6F72D51233A1788920A86EE08A1962C79 EFA317FB7879E297DAD2146DB995FA1C78",
39 "msg": "6e2932153301a4eef680e6428929adae988c108d668a31ff55d0489947d75ff81a46 bf89e84d6401f023be6e87688fbcd784d785ca846735524acb52d00452c84040a479e7cc33093644 1d93bbe722a9432a6e1db112b5c9403b10272cb1347fd619d463f7a9d223ad76fde06d8a6883500f b843235abff98e241bdfb5538c3e",
40 "sig": "4b9f91e4285287261a1d1c923cf619cd52c175cfe7f1be60a5258c610348ba3d28c4 5f901d71c41b298638ec0d6a85d7fcb0c33bbfec5a9c810846b639289a84",
41 "verify_result": true
42 },
43
44 // From http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvecto rs.zip (SigVer.rsp)
45 {
46 "curve": "P-384",
47 "hash": "sha-1",
48 "key_format": "jwk",
49 "key": {
50 "kty": "EC",
51 "crv": "P-384",
52 "x": "CHSi4Lj_RI8OVDIeJ_Tx5k0GTN630m9FjDLpMBIPTlfchcJpP5d-7UqOzI25gbTZ",
53 "y": "H2lEbfT0xvXeGQA_RfiR0OvNL__bXIHAQOjWmUxDx_7tuYpKMe37NeiaMAE8O5Jn"
54 },
55 "msg": "3f0783a58e66f3d2c0ccfb5fac3f09db6f8609d0592bc77fdffed9cf0e137d26a867 057665f3ad81beebbbdb723d5a47c580828f10f7347ab8a9c24d195f736dfae6eae37d88fe3b4735 e7c669a80ac1913e5c24c8c1d5cdb15f994f3ec2f1c774752e14f596b38c2fbf037616d608244d3d a7d4badf351330f947e04cc350e7",
56 "sig": "8d9d3e3d0b2b2871ea2f03f27ba8699f214be8d875c0d770b0fff1c4ce341f0c834a c11f9ec12bfdb8320b1724c8c22062150dfba8e65c0c7be7ef81c87241d2c37a83c27eb31ccc2b3c 3957670a744c81be6d741340b5189cc0c547df81b0d2",
57 "verify_result": true
58 },
59
60 // From http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvecto rs.zip (SigVer.rsp)
61 {
62 "curve": "P-384",
63 "hash": "sha-256",
64 "key_format": "jwk",
65 "key": {
66 "kty": "EC",
67 "crv": "P-384",
68 "x": "hqwS3Qp_5bgf2uhrEkNdMW75OSo_ULMHq2XZxged0NLYGdwJ4ihhRZwu2Z-6tm-u",
69 "y": "rIREB3qu1tbMrL5npMqs7gtaCUo1dcoS6ktHdMAw_hyHDJJJAj9dxNmtbjM2aMw4"
70 },
71 "msg": "862cf14c65ff85f4fdd8a39302056355c89c6ea1789c056262b077dab33abbfda007 0fce188c6330de84dfc512744e9fa0f7b03ce0c14858db1952750d7bbe6bd9c8726c0eae61e6cf28 77c655b1f0e0ce825430a9796e7420e5c174eab7a50459e291510bc515141738900d390217c5a522 e4bde547e57287d8139dc916504e",
72 "sig": "798065f1d1cbd3a1897794f4a025ed47565df773843f4fa74c85fe4d30e3a394783e c5723b530fc5f57906f946ce15e8b57166044c57c7d9582066805b5885abc06e0bfc02433850c2b7 4973205ca357a2da94a65172086f5a1580baa697400b",
73 "verify_result": true
74 },
75
76 // From http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvecto rs.zip (SigVer.rsp)
77 {
78 "curve": "P-521",
79 "hash": "sha-1",
80 "key_format": "jwk",
81 "key": {
82 "kty": "EC",
83 "crv": "P-521",
84 "x": "APUKCHAyUMFfBDyMRumXg0NSRc-Y9PJpSw4vjQKaUU3W8LCG1O2JIADNVZAQeq5pxMCn qV98905XcKB9XbVbzkq0",
85 "y": "APLHcLq4ub5M227NPcJsaY2g0lmc6_PZBPf5yjpV5kcxgQ1zzTFyZOULq6S8KGCFfhbW y7eVAbyeOjK9Fy6opx3u"
86 },
87 "msg": "9bbbbe8a72130e1f023fb77be4648c80e1722d98bd478882383026c5c4e874887399 7c5a38e0a173ed461546422d7691393dc2aceb0c0775068bc7145e33bf6a9e34f7fc6acc8f079a26 5168e54d3cca8d40aa04c1afd0909aa3df50908d7324aa7861b50f471fbfa5d615b0d718132c8195 7b178ad936deb89fde37147f8ae6",
88 "sig": "001e7cbb20c9a66abf149c79d11859051d35cfddd04f420dd23bd3206c82b29e7824 53cabfefe792e4e3e68c9bf6bf50d5a00ba5dd73b41378fb46e91ca797dbb25000f1e9252573c003 cb77f22c8c6d56f2149f7e8d88d699983da9250c8edfd4b9f864a46c48819524651886e3fd56492f 4b6c75fb50a1d59e8bfc25f9fd42dc4e1d37",
89 "verify_result": true
90 },
91
92 // --------------------------------------------------------------------------
93 // Bad public keys (import fails)
94 // --------------------------------------------------------------------------
95
96 // Import Error: P-521 is requested by importKey(), however the JWK's curve is for P-256.
97 {
98 "curve": "P-521",
99 "key_format": "jwk",
100 "key": {
101 "kty": "EC",
102 "crv": "P-256",
103 "x": "APUKCHAyUMFfBDyMRumXg0NSRc-Y9PJpSw4vjQKaUU3W8LCG1O2JIADNVZAQeq5pxMCn qV98905XcKB9XbVbzkq0",
104 "y": "APLHcLq4ub5M227NPcJsaY2g0lmc6_PZBPf5yjpV5kcxgQ1zzTFyZOULq6S8KGCFfhbW y7eVAbyeOjK9Fy6opx3u"
105 },
106 "error": "DataError: The JWK's \"crv\" member specifies a different curve th an requested"
107 },
108
109 // Import Error: P-521 is requested by importKey(), however the JWK's algorith m implies P-256
110 {
111 "curve": "P-521",
112 "key_format": "jwk",
113 "key": {
114 "kty": "EC",
115 "alg": "ES256",
116 "crv": "P-521",
117 "x": "APUKCHAyUMFfBDyMRumXg0NSRc-Y9PJpSw4vjQKaUU3W8LCG1O2JIADNVZAQeq5pxMCn qV98905XcKB9XbVbzkq0",
118 "y": "APLHcLq4ub5M227NPcJsaY2g0lmc6_PZBPf5yjpV5kcxgQ1zzTFyZOULq6S8KGCFfhbW y7eVAbyeOjK9Fy6opx3u"
119 },
120 "error": "DataError: The JWK \"alg\" property was inconsistent with that spe cified by the Web Crypto call"
121 },
122
123 // Import Error: crv is missing
124 {
125 "curve": "P-384",
126 "key_format": "jwk",
127 "key": {
128 "kty": "EC",
129 "x": "hqwS3Qp_5bgf2uhrEkNdMW75OSo_ULMHq2XZxged0NLYGdwJ4ihhRZwu2Z-6tm-u",
130 "y": "rIREB3qu1tbMrL5npMqs7gtaCUo1dcoS6ktHdMAw_hyHDJJJAj9dxNmtbjM2aMw4"
131 },
132 "error": "DataError: The required JWK property \"crv\" was missing"
133 },
134
135 // Import Error: x is missing
136 {
137 "curve": "P-384",
138 "key_format": "jwk",
139 "key": {
140 "kty": "EC",
141 "crv": "P-384",
142 "y": "rIREB3qu1tbMrL5npMqs7gtaCUo1dcoS6ktHdMAw_hyHDJJJAj9dxNmtbjM2aMw4"
143 },
144 "error": "DataError: The required JWK property \"x\" was missing"
145 },
146
147 // Import Error: Invalid key (x was corrupted)
148 {
149 "curve": "P-256",
150 "key_format": "jwk",
151 "key": {
152 "kty": "EC",
153 "crv": "P-256",
154 "x": "nLPPaTA9r8dh1ORoe07PA55tNKuWSvgIENjVWKSo1vc",
155 "y": "LVEjOheIkgqG7gihlix576MX-3h54pfa0hRtuZX6HHg"
156 },
157 "error": "OperationError"
158 },
159
160 // Import Error: Incorrect kty.
161 {
162 "curve": "P-384",
163 "key_format": "jwk",
164 "key": {
165 "kty": "RSA",
166 "crv": "P-384",
167 "x": "hqwS3Qp_5bgf2uhrEkNdMW75OSo_ULMHq2XZxged0NLYGdwJ4ihhRZwu2Z-6tm-u",
168 "y": "rIREB3qu1tbMrL5npMqs7gtaCUo1dcoS6ktHdMAw_hyHDJJJAj9dxNmtbjM2aMw4"
169 },
170 "error": "DataError: The JWK \"kty\" property was not \"EC\""
171 },
172
173 // Import Error: SPKI data is empty.
174 {
175 "curve": "P-384",
176 "key_format": "spki",
177 "key": "",
178 "error": "DataError: No key data was provided"
179 },
180
181 // Import Error: SPKI data is invalid.
182 {
183 "curve": "P-384",
184 "key_format": "spki",
185 "key": "00010203",
186 "error": "DataError"
187 },
188
189 // Import Error: SPKI data is invalid (1 byte was corrupted)
190 {
191 "curve": "P-256",
192 "key_format": "spki",
193 "key": "3059301306072A8648CE3D020106082A8748CE3D030107034200049CB0CF69303DAF C761D4E4687B4ECF039E6D34AB964AF80810D8D558A4A8D6F72D51233A1788920A86EE08A1962C79 EFA317FB7879E297DAD2146DB995FA1C78",
194 "error": "DataError"
195 },
196
197 // Import Error: SPKI data is invalid (1 byte truncated from end)
198 {
199 "curve": "P-256",
200 "key_format": "spki",
201 "key": "3059301306072A8648CE3D020106082A8648CE3D030107034200049CB0CF69303DAF C761D4E4687B4ECF039E6D34AB964AF80810D8D558A4A8D6F72D51233A1788920A86EE08A1962C79 EFA317FB7879E297DAD2146DB995FA1C",
202 "error": "DataError"
203 },
204
205 // Import Error: Valid SPKI data was provided, however it is for an RSA key
206 {
207 "curve": "P-256",
208 "key_format": "spki",
209 "key": "30819f300d06092a864886f70d010101050003818d0030818902818100a56e4a0e70 1017589a5187dc7ea841d156f2ec0e36ad52a44dfeb1e61f7ad991d8c51056ffedb162b4c0f283a1 2a88a394dff526ab7291cbb307ceabfce0b1dfd5cd9508096d5b2b8b6df5d671ef6377c0921cb23c 270a70e2598e6ff89d19f105acc2d3f0cb35f29280e1386b6f64c4ef22e1e1f20d0ce8cffb2249bd 9a21370203010001",
210 "error": "DataError"
211 },
212
213 // Import Error: JWK was given where the "x" member is not zero-padded.
214 {
215 "curve": "P-256",
216 "key_format": "jwk",
217 "key": {
218 "kty": "EC",
219 "crv": "P-256",
220 "x": "2A0aLWA8otEPMLZFAksn2h5JC3HrJNNu4MRksc-b2Q",
221 "y": "lZYURbYRHyeqmHQOEKxrVVJZzL0_BByXwMCwRKzAN_k"
222 },
223 "error": "DataError: The JWK's \"x\" member defines an octet string of lengt h 31 bytes but should be 32"
224 },
225
226 // Import Error: JWK was given where the "x" member is not zero-padded.
227 {
228 "curve": "P-256",
229 "key_format": "jwk",
230 "key": {
231 "kty": "EC",
232 "crv": "P-256",
233 "x": "V_S9kHyUTFiXiIJNovS89K0ctDtXe2qthCWjs4J7Bb0",
234 "y": "e-6aI45DddCJGrGWqgH83fFjn_eS7s8ygoeZJbh2Bg"
235 },
236 "error": "DataError: The JWK's \"y\" member defines an octet string of lengt h 31 bytes but should be 32"
237 },
238
239 // Import Error: The SPKI is valid, however contains 3 trailing bytes.
240 {
241 "curve": "P-256",
242 "key_format": "spki",
243 "key": "3059301306072A8648CE3D020106082A8648CE3D030107034200049CB0CF69303DAF C761D4E4687B4ECF039E6D34AB964AF80810D8D558A4A8D6F72D51233A1788920A86EE08A1962C79 EFA317FB7879E297DAD2146DB995FA1C78000000",
244 "error": "DataError"
245 },
246
247 // --------------------------------------------------------------------------
248 // Bad signature
249 // --------------------------------------------------------------------------
250
251 // The signature was truncated by 1 byte. Verification should fail (with false , not an operation error).
252 {
253 "curve": "P-256",
254 "hash": "sha-512",
255 "key_format": "jwk",
256 "key": {
257 "kty": "EC",
258 "crv": "P-256",
259 "x": "nLDPaTA9r8dh1ORoe07PA55tNKuWSvgIENjVWKSo1vc",
260 "y": "LVEjOheIkgqG7gihlix576MX-3h54pfa0hRtuZX6HHg"
261 },
262 "msg": "6e2932153301a4eef680e6428929adae988c108d668a31ff55d0489947d75ff81a46 bf89e84d6401f023be6e87688fbcd784d785ca846735524acb52d00452c84040a479e7cc33093644 1d93bbe722a9432a6e1db112b5c9403b10272cb1347fd619d463f7a9d223ad76fde06d8a6883500f b843235abff98e241bdfb5538c3e",
263 "sig": "4b9f91e4285287261a1d1c923cf619cd52c175cfe7f1be60a5258c610348ba3d28c4 5f901d71c41b298638ec0d6a85d7fcb0c33bbfec5a9c810846b639289a",
264 "verify_result": false
265 },
266
267 // The signature was made using SHA-512, however verification is being done
268 // using SHA-1. Verification using SHA-1 should therefore fail.
269 {
270 "curve": "P-256",
271 "hash": "sha-1",
272 "key_format": "jwk",
273 "key": {
274 "kty": "EC",
275 "crv": "P-256",
276 "x": "nLDPaTA9r8dh1ORoe07PA55tNKuWSvgIENjVWKSo1vc",
277 "y": "LVEjOheIkgqG7gihlix576MX-3h54pfa0hRtuZX6HHg"
278 },
279 "msg": "6e2932153301a4eef680e6428929adae988c108d668a31ff55d0489947d75ff81a46 bf89e84d6401f023be6e87688fbcd784d785ca846735524acb52d00452c84040a479e7cc33093644 1d93bbe722a9432a6e1db112b5c9403b10272cb1347fd619d463f7a9d223ad76fde06d8a6883500f b843235abff98e241bdfb5538c3e",
280 "sig": "4b9f91e4285287261a1d1c923cf619cd52c175cfe7f1be60a5258c610348ba3d28c4 5f901d71c41b298638ec0d6a85d7fcb0c33bbfec5a9c810846b639289a84",
281 "verify_result": false
282 },
283
284 // Signature is zero-padded.
285 // The siganture is the concatenation of "r" and "s". In this test case both
286 // "r" and "s" are zero-padded by 1. It would be possible to support such a
287 // signature, however the expectation is that it fails.
288 {
289 "curve": "P-384",
290 "hash": "sha-1",
291 "key_format": "jwk",
292 "key": {
293 "kty": "EC",
294 "crv": "P-384",
295 "x": "CHSi4Lj_RI8OVDIeJ_Tx5k0GTN630m9FjDLpMBIPTlfchcJpP5d-7UqOzI25gbTZ",
296 "y": "H2lEbfT0xvXeGQA_RfiR0OvNL__bXIHAQOjWmUxDx_7tuYpKMe37NeiaMAE8O5Jn"
297 },
298 "msg": "3f0783a58e66f3d2c0ccfb5fac3f09db6f8609d0592bc77fdffed9cf0e137d26a867 057665f3ad81beebbbdb723d5a47c580828f10f7347ab8a9c24d195f736dfae6eae37d88fe3b4735 e7c669a80ac1913e5c24c8c1d5cdb15f994f3ec2f1c774752e14f596b38c2fbf037616d608244d3d a7d4badf351330f947e04cc350e7",
299 "sig": "008d9d3e3d0b2b2871ea2f03f27ba8699f214be8d875c0d770b0fff1c4ce341f0c83 4ac11f9ec12bfdb8320b1724c8c2200062150dfba8e65c0c7be7ef81c87241d2c37a83c27eb31ccc 2b3c3957670a744c81be6d741340b5189cc0c547df81b0d2",
300 "verify_result": false
301 },
302
303 // Empty signature.
304 {
305 "curve": "P-384",
306 "hash": "sha-1",
307 "key_format": "jwk",
308 "key": {
309 "kty": "EC",
310 "crv": "P-384",
311 "x": "CHSi4Lj_RI8OVDIeJ_Tx5k0GTN630m9FjDLpMBIPTlfchcJpP5d-7UqOzI25gbTZ",
312 "y": "H2lEbfT0xvXeGQA_RfiR0OvNL__bXIHAQOjWmUxDx_7tuYpKMe37NeiaMAE8O5Jn"
313 },
314 "msg": "3f0783a58e66f3d2c0ccfb5fac3f09db6f8609d0592bc77fdffed9cf0e137d26a867 057665f3ad81beebbbdb723d5a47c580828f10f7347ab8a9c24d195f736dfae6eae37d88fe3b4735 e7c669a80ac1913e5c24c8c1d5cdb15f994f3ec2f1c774752e14f596b38c2fbf037616d608244d3d a7d4badf351330f947e04cc350e7",
315 "sig": "",
316 "verify_result": false
317 }
318 ]
OLDNEW
« no previous file with comments | « content/test/data/webcrypto/ec_private_keys.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698