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

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

Issue 1077273002: html_viewer: Move webcrypto to a place where html_viewer can use it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT Created 5 years, 8 months 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/content_tests.gypi ('k') | content/test/data/webcrypto/aes_ctr.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 [
2 // F.2.1 (CBC-AES128.Encrypt)
3 // http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
4 {
5 "key_format": "raw",
6 "key": "2b7e151628aed2a6abf7158809cf4f3c",
7 "iv": "000102030405060708090a0b0c0d0e0f",
8 "plain_text": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8 e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
9 // Added a padding block: encryption of {0x10, 0x10, ... 0x10}) (not given b y the
10 // NIST test vector)
11 "cipher_text": "7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a9176 78b273bed6b8e3c1743b7116e69e222295163ff1caa1681fac09120eca307586e1a78cb82807230e 1321d3fae00d18cc2012"
12 },
13
14 // F.2.6 CBC-AES256.Decrypt [*]
15 // http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
16 //
17 // [*] Truncated 3 bytes off the plain text, so block 4 differs from the
18 // NIST vector.
19 {
20 "key_format": "raw",
21 "key": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
22 "iv": "000102030405060708090a0b0c0d0e0f",
23 // Truncated the last block to make it more interesting.
24 "plain_text": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8 e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be6",
25 // Last block differs from source vector (due to truncation)
26 "cipher_text": "f58c4c04d6e5f1ba779eabfb5f7bfbd69cfc4e967edb808d679f777bc670 2c7d39f23369a9d9bacfa530e26304231461c9aaf02a6a54e9e242ccbf48c59daca6"
27 },
28
29 // Taken from encryptor_unittest.cc (EncryptorTest.EmptyEncrypt())
30 {
31 "key_format": "raw",
32 "key": "3132383d5369787465656e4279746573",
33 "iv": "5377656574205369787465656e204956",
34 "plain_text": "",
35 "cipher_text": "8518b8878d34e7185e300d0fcc426396"
36 },
37
38 // Fail encrypting because the IV is too small.
39 {
40 "key_format": "raw",
41 "key": "3132383d5369787465656e4279746573",
42 "iv": "5300",
43 "plain_text": "0000",
44 "encrypt_error": "OperationError: The \"iv\" has an unexpected length -- mus t be 16 bytes"
45 },
46
47 // Fail decrypting because the IV is too small.
48 {
49 "key_format": "raw",
50 "key": "3132383d5369787465656e4279746573",
51 "iv": "5300",
52 "cipher_text": "8518b8878d34e7185e300d0fcc426396",
53 "decrypt_error": "OperationError: The \"iv\" has an unexpected length -- mus t be 16 bytes"
54 },
55
56 // Fail encrypting because the IV is too large.
57 {
58 "key_format": "raw",
59 "key": "3132383d5369787465656e4279746573",
60 "iv": "5377656574205369787465656e2049560000000000000000",
61 "plain_text": "0000",
62 "encrypt_error": "OperationError: The \"iv\" has an unexpected length -- mus t be 16 bytes"
63 },
64
65 // Fail decrypting because the IV is too large.
66 {
67 "key_format": "raw",
68 "key": "3132383d5369787465656e4279746573",
69 "iv": "5377656574205369787465656e2049560000000000000000",
70 "cipher_text": "8518b8878d34e7185e300d0fcc426396",
71 "decrypt_error": "OperationError: The \"iv\" has an unexpected length -- mus t be 16 bytes"
72 },
73
74 // Fail importing the key because not enough bytes were specified.
75 {
76 "key_format": "raw",
77 "key": "31",
78 "import_error": "DataError: AES key data must be 128 or 256 bits"
79 },
80
81 // Fail importing because the wrong format was specified
82 {
83 "key_format": "spki",
84 "key": "3132383d5369787465656e4279746573",
85 "import_error": "NotSupported: Unsupported import key format for algorithm"
86 },
87
88 // Fail importing because the wrong format was specified
89 {
90 "key_format": "pkcs8",
91 "key": "3132383d5369787465656e4279746573",
92 "import_error": "NotSupported: Unsupported import key format for algorithm"
93 },
94
95 // Fail decrypting an empty cipher text
96 {
97 "key_format": "raw",
98 "key": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
99 "iv": "000102030405060708090a0b0c0d0e0f",
100 "cipher_text": "",
101 "decrypt_error": "OperationError"
102 },
103
104 // Decrypt a truncated cipher text (removed an entire block).
105 {
106 "key_format": "raw",
107 "key": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
108 "iv": "000102030405060708090a0b0c0d0e0f",
109 "cipher_text": "f58c4c04d6e5f1ba779eabfb5f7bfbd69cfc4e967edb808d679f777bc670 2c7d39f23369a9d9bacfa530e26304231461",
110 "decrypt_error": "OperationError"
111 },
112
113 // Decrypt truncated cipher text (stripped 3 byte).
114 {
115 "key_format": "raw",
116 "key": "2b7e151628aed2a6abf7158809cf4f3c",
117 "iv": "000102030405060708090a0b0c0d0e0f",
118 "cipher_text": "7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a9176 78b273bed6b8e3c1743b7116e69e222295163ff1caa1681fac09120eca307586e1a78cb82807230e 1321d3fae00d18",
119 "decrypt_error": "OperationError"
120 },
121
122 // JWK: key_ops has duplicates
123 {
124 "key_format": "jwk",
125 "key": {
126 "kty": "oct",
127 "k": "GADWrMRHwQfoNaXU5fZvTg",
128 "key_ops": [ "encrypt", "decrypt", "encrypt" ]
129 },
130 "import_error": "DataError: The \"key_ops\" member of the JWK dictionary con tains duplicate usages."
131 },
132
133 // JWK: key_ops has (unrecognized duplicates)
134 {
135 "key_format": "jwk",
136 "key": {
137 "kty": "oct",
138 "k": "GADWrMRHwQfoNaXU5fZvTg",
139 "key_ops": [ "foopy", "decrypt", "foopy" ]
140 },
141 "import_error": "DataError: The \"key_ops\" member of the JWK dictionary con tains duplicate usages."
142 },
143
144 // JWK: alg present but incorrect (expecting A128CBC).
145 {
146 "key_format": "jwk",
147 "key": {
148 "kty": "oct",
149 "alg": "A127CBC",
150 "k": "GADWrMRHwQfoNaXU5fZvTg"
151 },
152 "import_error": "DataError: The JWK \"alg\" member was inconsistent with tha t specified by the Web Crypto call"
153 },
154
155 // JWK: Invalid kty
156 {
157 "key_format": "jwk",
158 "key": {
159 "kty": "foo",
160 "k": "GADWrMRHwQfoNaXU5fZvTg"
161 },
162 "import_error": "DataError: The JWK \"kty\" member was not \"oct\""
163 },
164
165 // JWK: Missing kty.
166 {
167 "key_format": "jwk",
168 "key": {
169 "k": "GADWrMRHwQfoNaXU5fZvTg"
170 },
171 "import_error": "DataError: The required JWK member \"kty\" was missing"
172 },
173
174 // JWK: kty is wrong type
175 {
176 "key_format": "jwk",
177 "key": {
178 "kty": 0.1,
179 "k": "GADWrMRHwQfoNaXU5fZvTg"
180 },
181 "import_error": "DataError: The JWK member \"kty\" must be a string"
182 },
183
184 // JWK: Invalid use
185 {
186 "key_format": "jwk",
187 "key": {
188 "kty": "oct",
189 "use": "foo",
190 "k": "GADWrMRHwQfoNaXU5fZvTg"
191 },
192 "import_error": "DataError: The JWK \"use\" member could not be parsed"
193 },
194
195 // JWK: Invalid use (wrong type)
196 {
197 "key_format": "jwk",
198 "key": {
199 "kty": "oct",
200 "use": true,
201 "k": "GADWrMRHwQfoNaXU5fZvTg"
202 },
203 "import_error": "DataError: The JWK member \"use\" must be a string"
204 },
205
206 // JWK: Invalid ext (wrong type)
207 {
208 "key_format": "jwk",
209 "key": {
210 "kty": "oct",
211 "k": "GADWrMRHwQfoNaXU5fZvTg",
212 "ext": 0
213 },
214 "import_error": "DataError: The JWK member \"ext\" must be a boolean"
215 },
216
217 // JWK: Invalid key_ops (wrong type)
218 {
219 "key_format": "jwk",
220 "key": {
221 "kty": "oct",
222 "k": "GADWrMRHwQfoNaXU5fZvTg",
223 "key_ops": true
224 },
225 "import_error": "DataError: The JWK member \"key_ops\" must be a list"
226 },
227
228 // JWK: unrecognized values in "key_ops". This is OK.
229 {
230 "key_format": "jwk",
231 "key": {
232 "kty": "oct",
233 "k": "GADWrMRHwQfoNaXU5fZvTg",
234 "key_ops": ["foo", "bar", "encrypt", "decrypt"]
235 }
236 },
237
238 // JWK: non-string entry in key_ops
239 {
240 "key_format": "jwk",
241 "key": {
242 "kty": "oct",
243 "k": "GADWrMRHwQfoNaXU5fZvTg",
244 "key_ops": ["encrypt", 3]
245 },
246 "import_error": "DataError: The JWK member \"key_ops[1]\" must be a string"
247 },
248
249 // JWK: missing k
250 {
251 "key_format": "jwk",
252 "key": {
253 "kty": "oct"
254 },
255 "import_error": "DataError: The required JWK member \"k\" was missing"
256 },
257
258 // JWK: Bad Base64 encoding for k
259 {
260 "key_format": "jwk",
261 "key": {
262 "kty": "oct",
263 "k": "Qk3f0DsytU8lfza2au #$% Htaw2xpop9GYyTuH0p5GghxTI="
264 },
265 "import_error": "DataError: The JWK member \"k\" could not be base64url deco ded or contained padding"
266 },
267
268 // JWK: empty k
269 {
270 "key_format": "jwk",
271 "key": {
272 "kty": "oct",
273 "k": ""
274 },
275 "import_error": "DataError: AES key data must be 128 or 256 bits"
276 },
277
278 // JWK: empty k (with alg specified)
279 {
280 "key_format": "jwk",
281 "key": {
282 "kty": "oct",
283 "alg": "A128CBC",
284 "k": ""
285 },
286 "import_error": "DataError: The JWK \"k\" member did not include the right l ength of key data for the given algorithm."
287 },
288
289 // JWK: k actual length (120 bits) inconsistent with alg (128 bits)
290 {
291 "key_format": "jwk",
292 "key": {
293 "kty": "oct",
294 "alg": "A128CBC",
295 "k": "AVj42h0Y5aqGtE3yluKL"
296 },
297 "import_error": "DataError: The JWK \"k\" member did not include the right l ength of key data for the given algorithm."
298 },
299
300 // JWK: k actual length (192 bits) inconsistent with alg (128 bits)
301 {
302 "key_format": "jwk",
303 "key": {
304 "kty": "oct",
305 "alg": "A128CBC",
306 "k": "dGhpcyAgaXMgIDI0ICBieXRlcyBsb25n"
307 },
308 "import_error": "DataError: The JWK \"k\" member did not include the right l ength of key data for the given algorithm."
309 },
310
311 // AES 192-bit is not allowed: http://crbug.com/381829
312 {
313 "key_format": "raw",
314 "key": "5377656574205369787465656e2049560000000000000000",
315 "import_error": "OperationError: 192-bit AES keys are not supported"
316 },
317
318 // JWK: AES 192-bit is not allowed: http://crbug.com/381829
319 {
320 "key_format": "jwk",
321 "key": {
322 "kty": "oct",
323 "alg": "A192CBC",
324 "k": "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh"
325 },
326 "import_error": "OperationError: 192-bit AES keys are not supported"
327 }
328 ]
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/test/data/webcrypto/aes_ctr.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698