Changeset 256425 in webkit
- Timestamp:
- Feb 11, 2020 9:41:20 PM (4 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r256422 r256425 1 2020-02-11 Tomoki Imai <Tomoki.Imai@sony.com> 2 3 Add WebCrypto LayoutTests to check if PKCS#7 padding is correctly implemented in AES-CBC 4 https://bugs.webkit.org/show_bug.cgi?id=207174 5 6 Reviewed by Jiewen Tan. 7 8 WebCrypto AES-CBC specification requires PKCS#7 padding, 9 10 Add decrypt/encrypt test cases for 0 ~ 33 bytes data. 11 It covers the boundary values where the padding size are changed, namely, 0, 1, 15, 16, 17, 31, 32, and 33. 12 13 * crypto/subtle/aes-cbc-import-key-decrypt-expected.txt: 14 * crypto/subtle/aes-cbc-import-key-decrypt.html: 15 * crypto/subtle/aes-cbc-import-key-encrypt-expected.txt: 16 * crypto/subtle/aes-cbc-import-key-encrypt.html: 17 1 18 2020-02-11 Lauro Moura <lmoura@igalia.com> 2 19 -
trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-decrypt-expected.txt
r208918 r256425 4 4 5 5 6 Expected plain text: 7 PASS bytesToASCIIString(plainText) is expectedPlainText 8 Expected plain text: A 9 PASS bytesToASCIIString(plainText) is expectedPlainText 10 Expected plain text: AB 11 PASS bytesToASCIIString(plainText) is expectedPlainText 12 Expected plain text: ABC 13 PASS bytesToASCIIString(plainText) is expectedPlainText 14 Expected plain text: ABCD 15 PASS bytesToASCIIString(plainText) is expectedPlainText 16 Expected plain text: ABCDE 17 PASS bytesToASCIIString(plainText) is expectedPlainText 18 Expected plain text: ABCDEF 19 PASS bytesToASCIIString(plainText) is expectedPlainText 20 Expected plain text: ABCDEFG 21 PASS bytesToASCIIString(plainText) is expectedPlainText 22 Expected plain text: ABCDEFGH 23 PASS bytesToASCIIString(plainText) is expectedPlainText 24 Expected plain text: ABCDEFGHI 25 PASS bytesToASCIIString(plainText) is expectedPlainText 26 Expected plain text: ABCDEFGHIJ 27 PASS bytesToASCIIString(plainText) is expectedPlainText 28 Expected plain text: ABCDEFGHIJK 29 PASS bytesToASCIIString(plainText) is expectedPlainText 30 Expected plain text: ABCDEFGHIJKL 31 PASS bytesToASCIIString(plainText) is expectedPlainText 32 Expected plain text: ABCDEFGHIJKLM 33 PASS bytesToASCIIString(plainText) is expectedPlainText 34 Expected plain text: ABCDEFGHIJKLMN 35 PASS bytesToASCIIString(plainText) is expectedPlainText 36 Expected plain text: ABCDEFGHIJKLMNO 37 PASS bytesToASCIIString(plainText) is expectedPlainText 38 Expected plain text: ABCDEFGHIJKLMNOP 39 PASS bytesToASCIIString(plainText) is expectedPlainText 40 Expected plain text: ABCDEFGHIJKLMNOPQ 41 PASS bytesToASCIIString(plainText) is expectedPlainText 42 Expected plain text: ABCDEFGHIJKLMNOPQR 43 PASS bytesToASCIIString(plainText) is expectedPlainText 44 Expected plain text: ABCDEFGHIJKLMNOPQRS 45 PASS bytesToASCIIString(plainText) is expectedPlainText 46 Expected plain text: ABCDEFGHIJKLMNOPQRST 47 PASS bytesToASCIIString(plainText) is expectedPlainText 48 Expected plain text: ABCDEFGHIJKLMNOPQRSTU 49 PASS bytesToASCIIString(plainText) is expectedPlainText 50 Expected plain text: ABCDEFGHIJKLMNOPQRSTUV 51 PASS bytesToASCIIString(plainText) is expectedPlainText 52 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVW 53 PASS bytesToASCIIString(plainText) is expectedPlainText 54 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWX 55 PASS bytesToASCIIString(plainText) is expectedPlainText 56 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXY 57 PASS bytesToASCIIString(plainText) is expectedPlainText 58 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZ 59 PASS bytesToASCIIString(plainText) is expectedPlainText 60 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZA 61 PASS bytesToASCIIString(plainText) is expectedPlainText 62 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZAB 63 PASS bytesToASCIIString(plainText) is expectedPlainText 64 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABC 65 PASS bytesToASCIIString(plainText) is expectedPlainText 66 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCD 67 PASS bytesToASCIIString(plainText) is expectedPlainText 68 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE 69 PASS bytesToASCIIString(plainText) is expectedPlainText 70 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF 71 PASS bytesToASCIIString(plainText) is expectedPlainText 72 Expected plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG 6 73 PASS bytesToASCIIString(plainText) is expectedPlainText 7 74 PASS successfullyParsed is true -
trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-decrypt.html
r208918 r256425 15 15 16 16 var extractable = false; 17 var cipherText = hexStringToUint8Array("2ffa4618784dfd414b22c40c6330d022");18 17 var aesCbcParams = { 19 18 name: "aes-cbc", … … 21 20 } 22 21 var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr"); 23 var expectedPlainText = "Hello, World!";24 22 25 crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["decrypt"]).then(function(key) {26 return crypto.subtle.decrypt(aesCbcParams, key, cipherText);27 }).then(function(result) {28 plainText = result;29 23 30 shouldBe("bytesToASCIIString(plainText)", "expectedPlainText"); 24 // Test 0 ~ 33 bytes plain text data. 25 // It covers the boundary values where the padding size are changed, namely, 0, 1, 15, 16, 17, 31, 32, and 33. 26 // 16 comes from the AES-CBC block size, which is 128bit = 16 bytes. 31 27 28 // Pair of expected plain text and cipher text 29 var testCases = [ 30 [ 31 "", 32 "54695f2b49d2c35b5f4675c59669c7d5" 33 ], 34 [ 35 "A", 36 "7f3224da4b207bd3b55a3ba55f95c8dd" 37 ], 38 [ 39 "AB", 40 "05b7b4caa28897ff5fa0b8cac9821070" 41 ], 42 [ 43 "ABC", 44 "c5fcd82c93ca70630e77871408cb60a5" 45 ], 46 [ 47 "ABCD", 48 "8c68b0ba2952761877f30e26eb43e98b" 49 ], 50 [ 51 "ABCDE", 52 "6e5845ce085801492ecdb3da47e54e0d" 53 ], 54 [ 55 "ABCDEF", 56 "a2bf7011f0560504fd2d3f6f4fa85179" 57 ], 58 [ 59 "ABCDEFG", 60 "bfbe3717d97b8e8dbb362aa32a5d6715" 61 ], 62 [ 63 "ABCDEFGH", 64 "ac55dadf6d3d1be1fede0e33e9de021a" 65 ], 66 [ 67 "ABCDEFGHI", 68 "f5adfd70b6a907441aa1e1b8d03138b8" 69 ], 70 [ 71 "ABCDEFGHIJ", 72 "b4a2d688f3a9bd307efe62643d80ead0" 73 ], 74 [ 75 "ABCDEFGHIJK", 76 "d5cce76a9416b3c00c4d2e0bb2879134" 77 ], 78 [ 79 "ABCDEFGHIJKL", 80 "7b87f2b55433d595ed02cd3417c510a4" 81 ], 82 [ 83 "ABCDEFGHIJKLM", 84 "29f5af157bda78fdde9550aaadfc467d" 85 ], 86 [ 87 "ABCDEFGHIJKLMN", 88 "bd86ff3b780b56d4faf98bd7f818de59" 89 ], 90 [ 91 "ABCDEFGHIJKLMNO", 92 "8f7d4ffd08155e67b2f936aa7eedd918" 93 ], 94 [ 95 "ABCDEFGHIJKLMNOP", 96 "bb57e6bd078639a31e3762035652ddba8b641840a083e33027a0aea305e95a64" 97 ], 98 [ 99 "ABCDEFGHIJKLMNOPQ", 100 "bb57e6bd078639a31e3762035652ddbaad705f7fda061c4486fbce2b3a470b59" 101 ], 102 [ 103 "ABCDEFGHIJKLMNOPQR", 104 "bb57e6bd078639a31e3762035652ddbad5c1de41aa0a5d2f03dd129e419b99b9" 105 ], 106 [ 107 "ABCDEFGHIJKLMNOPQRS", 108 "bb57e6bd078639a31e3762035652ddba9ca7c65d2137e0e4e1b752d7d5a7619a" 109 ], 110 [ 111 "ABCDEFGHIJKLMNOPQRST", 112 "bb57e6bd078639a31e3762035652ddba946ca5063ae30b7b068b7a0ddb573143" 113 ], 114 [ 115 "ABCDEFGHIJKLMNOPQRSTU", 116 "bb57e6bd078639a31e3762035652ddba3e53d6b22634ba2d0033aa1f74984017" 117 ], 118 [ 119 "ABCDEFGHIJKLMNOPQRSTUV", 120 "bb57e6bd078639a31e3762035652ddba9be121a85ec7b87d14d069821f241817" 121 ], 122 [ 123 "ABCDEFGHIJKLMNOPQRSTUVW", 124 "bb57e6bd078639a31e3762035652ddbaeb91126c4649fbf256d2698a8b3cd108" 125 ], 126 [ 127 "ABCDEFGHIJKLMNOPQRSTUVWX", 128 "bb57e6bd078639a31e3762035652ddba5fda70f10d9c190691a58c8014226b09" 129 ], 130 [ 131 "ABCDEFGHIJKLMNOPQRSTUVWXY", 132 "bb57e6bd078639a31e3762035652ddbaca22ea606b337f0e549bd6c8134026c2" 133 ], 134 [ 135 "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 136 "bb57e6bd078639a31e3762035652ddbac5883abd9ff470ad8d5aefe0726131b8" 137 ], 138 [ 139 "ABCDEFGHIJKLMNOPQRSTUVWXYZA", 140 "bb57e6bd078639a31e3762035652ddba0ba1680b7ca9ca18f9bdc30a2213e138" 141 ], 142 [ 143 "ABCDEFGHIJKLMNOPQRSTUVWXYZAB", 144 "bb57e6bd078639a31e3762035652ddba34795f08b688add2ac28d579c1e4a735" 145 ], 146 [ 147 "ABCDEFGHIJKLMNOPQRSTUVWXYZABC", 148 "bb57e6bd078639a31e3762035652ddba5e6174bbd7d9848e19dadc7316a51905" 149 ], 150 [ 151 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 152 "bb57e6bd078639a31e3762035652ddba758897c9b84584efaf7bba27e80e2971" 153 ], 154 [ 155 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE", 156 "bb57e6bd078639a31e3762035652ddba23aecf5b5981c3a0b9967c6d5faf2f44" 157 ], 158 [ 159 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF", 160 "bb57e6bd078639a31e3762035652ddbace7c8364cc84b579dbb16765cba58de65123694ddc958e0c9436f6687338fc6e" 161 ], 162 [ 163 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 164 "bb57e6bd078639a31e3762035652ddbace7c8364cc84b579dbb16765cba58de659650a237cd9a2764e9b92749843fd22" 165 ] 166 ]; 167 168 Promise.all(testCases.map(function(testCase){ 169 var expectedPlainText = testCase[0]; 170 var cipherText = testCase[1]; 171 return crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["decrypt"]).then(function(key) { 172 return crypto.subtle.decrypt(aesCbcParams, key, hexStringToUint8Array(cipherText)); 173 }).then(function(plainText) { 174 return { 175 plainText: plainText, 176 cipherText: cipherText, 177 expectedPlainText: expectedPlainText 178 }; 179 }); 180 })).then(function(results) { 181 for (var result of results) { 182 plainText = result.plainText; 183 cipherText = result.cipherText; 184 expectedPlainText = result.expectedPlainText; 185 debug("Expected plain text: " + expectedPlainText); 186 shouldBe("bytesToASCIIString(plainText)", "expectedPlainText"); 187 } 32 188 finishJSTest(); 33 189 }); -
trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-encrypt-expected.txt
r208891 r256425 4 4 5 5 6 Plain text: 7 PASS bytesToHexString(cipherText) is expectedCipherText 8 Plain text: A 9 PASS bytesToHexString(cipherText) is expectedCipherText 10 Plain text: AB 11 PASS bytesToHexString(cipherText) is expectedCipherText 12 Plain text: ABC 13 PASS bytesToHexString(cipherText) is expectedCipherText 14 Plain text: ABCD 15 PASS bytesToHexString(cipherText) is expectedCipherText 16 Plain text: ABCDE 17 PASS bytesToHexString(cipherText) is expectedCipherText 18 Plain text: ABCDEF 19 PASS bytesToHexString(cipherText) is expectedCipherText 20 Plain text: ABCDEFG 21 PASS bytesToHexString(cipherText) is expectedCipherText 22 Plain text: ABCDEFGH 23 PASS bytesToHexString(cipherText) is expectedCipherText 24 Plain text: ABCDEFGHI 25 PASS bytesToHexString(cipherText) is expectedCipherText 26 Plain text: ABCDEFGHIJ 27 PASS bytesToHexString(cipherText) is expectedCipherText 28 Plain text: ABCDEFGHIJK 29 PASS bytesToHexString(cipherText) is expectedCipherText 30 Plain text: ABCDEFGHIJKL 31 PASS bytesToHexString(cipherText) is expectedCipherText 32 Plain text: ABCDEFGHIJKLM 33 PASS bytesToHexString(cipherText) is expectedCipherText 34 Plain text: ABCDEFGHIJKLMN 35 PASS bytesToHexString(cipherText) is expectedCipherText 36 Plain text: ABCDEFGHIJKLMNO 37 PASS bytesToHexString(cipherText) is expectedCipherText 38 Plain text: ABCDEFGHIJKLMNOP 39 PASS bytesToHexString(cipherText) is expectedCipherText 40 Plain text: ABCDEFGHIJKLMNOPQ 41 PASS bytesToHexString(cipherText) is expectedCipherText 42 Plain text: ABCDEFGHIJKLMNOPQR 43 PASS bytesToHexString(cipherText) is expectedCipherText 44 Plain text: ABCDEFGHIJKLMNOPQRS 45 PASS bytesToHexString(cipherText) is expectedCipherText 46 Plain text: ABCDEFGHIJKLMNOPQRST 47 PASS bytesToHexString(cipherText) is expectedCipherText 48 Plain text: ABCDEFGHIJKLMNOPQRSTU 49 PASS bytesToHexString(cipherText) is expectedCipherText 50 Plain text: ABCDEFGHIJKLMNOPQRSTUV 51 PASS bytesToHexString(cipherText) is expectedCipherText 52 Plain text: ABCDEFGHIJKLMNOPQRSTUVW 53 PASS bytesToHexString(cipherText) is expectedCipherText 54 Plain text: ABCDEFGHIJKLMNOPQRSTUVWX 55 PASS bytesToHexString(cipherText) is expectedCipherText 56 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXY 57 PASS bytesToHexString(cipherText) is expectedCipherText 58 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZ 59 PASS bytesToHexString(cipherText) is expectedCipherText 60 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZA 61 PASS bytesToHexString(cipherText) is expectedCipherText 62 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZAB 63 PASS bytesToHexString(cipherText) is expectedCipherText 64 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABC 65 PASS bytesToHexString(cipherText) is expectedCipherText 66 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCD 67 PASS bytesToHexString(cipherText) is expectedCipherText 68 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE 69 PASS bytesToHexString(cipherText) is expectedCipherText 70 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF 71 PASS bytesToHexString(cipherText) is expectedCipherText 72 Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG 6 73 PASS bytesToHexString(cipherText) is expectedCipherText 7 74 PASS successfullyParsed is true -
trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-encrypt.html
r208891 r256425 15 15 16 16 var extractable = false; 17 var plainText = asciiToUint8Array("Hello, World!"); 17 18 18 var aesCbcParams = { 19 19 name: "aes-cbc", … … 21 21 } 22 22 var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr"); 23 var expectedCipherText = "2ffa4618784dfd414b22c40c6330d022";24 23 25 crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]).then(function(key) { 26 return crypto.subtle.encrypt(aesCbcParams, key, plainText); 27 }).then(function(result) { 28 cipherText = result; 24 // Test 0 ~ 33 bytes plain text data. 25 // It covers the boundary values where the padding size are changed, namely, 0, 1, 15, 16, 17, 31, 32, and 33. 26 // 16 comes from the AES-CBC block size, which is 128bit = 16 bytes. 29 27 30 shouldBe("bytesToHexString(cipherText)", "expectedCipherText"); 28 // Pair of plain text and expected cipher text 29 var testCases = [ 30 [ 31 "", 32 "54695f2b49d2c35b5f4675c59669c7d5" 33 ], 34 [ 35 "A", 36 "7f3224da4b207bd3b55a3ba55f95c8dd" 37 ], 38 [ 39 "AB", 40 "05b7b4caa28897ff5fa0b8cac9821070" 41 ], 42 [ 43 "ABC", 44 "c5fcd82c93ca70630e77871408cb60a5" 45 ], 46 [ 47 "ABCD", 48 "8c68b0ba2952761877f30e26eb43e98b" 49 ], 50 [ 51 "ABCDE", 52 "6e5845ce085801492ecdb3da47e54e0d" 53 ], 54 [ 55 "ABCDEF", 56 "a2bf7011f0560504fd2d3f6f4fa85179" 57 ], 58 [ 59 "ABCDEFG", 60 "bfbe3717d97b8e8dbb362aa32a5d6715" 61 ], 62 [ 63 "ABCDEFGH", 64 "ac55dadf6d3d1be1fede0e33e9de021a" 65 ], 66 [ 67 "ABCDEFGHI", 68 "f5adfd70b6a907441aa1e1b8d03138b8" 69 ], 70 [ 71 "ABCDEFGHIJ", 72 "b4a2d688f3a9bd307efe62643d80ead0" 73 ], 74 [ 75 "ABCDEFGHIJK", 76 "d5cce76a9416b3c00c4d2e0bb2879134" 77 ], 78 [ 79 "ABCDEFGHIJKL", 80 "7b87f2b55433d595ed02cd3417c510a4" 81 ], 82 [ 83 "ABCDEFGHIJKLM", 84 "29f5af157bda78fdde9550aaadfc467d" 85 ], 86 [ 87 "ABCDEFGHIJKLMN", 88 "bd86ff3b780b56d4faf98bd7f818de59" 89 ], 90 [ 91 "ABCDEFGHIJKLMNO", 92 "8f7d4ffd08155e67b2f936aa7eedd918" 93 ], 94 [ 95 "ABCDEFGHIJKLMNOP", 96 "bb57e6bd078639a31e3762035652ddba8b641840a083e33027a0aea305e95a64" 97 ], 98 [ 99 "ABCDEFGHIJKLMNOPQ", 100 "bb57e6bd078639a31e3762035652ddbaad705f7fda061c4486fbce2b3a470b59" 101 ], 102 [ 103 "ABCDEFGHIJKLMNOPQR", 104 "bb57e6bd078639a31e3762035652ddbad5c1de41aa0a5d2f03dd129e419b99b9" 105 ], 106 [ 107 "ABCDEFGHIJKLMNOPQRS", 108 "bb57e6bd078639a31e3762035652ddba9ca7c65d2137e0e4e1b752d7d5a7619a" 109 ], 110 [ 111 "ABCDEFGHIJKLMNOPQRST", 112 "bb57e6bd078639a31e3762035652ddba946ca5063ae30b7b068b7a0ddb573143" 113 ], 114 [ 115 "ABCDEFGHIJKLMNOPQRSTU", 116 "bb57e6bd078639a31e3762035652ddba3e53d6b22634ba2d0033aa1f74984017" 117 ], 118 [ 119 "ABCDEFGHIJKLMNOPQRSTUV", 120 "bb57e6bd078639a31e3762035652ddba9be121a85ec7b87d14d069821f241817" 121 ], 122 [ 123 "ABCDEFGHIJKLMNOPQRSTUVW", 124 "bb57e6bd078639a31e3762035652ddbaeb91126c4649fbf256d2698a8b3cd108" 125 ], 126 [ 127 "ABCDEFGHIJKLMNOPQRSTUVWX", 128 "bb57e6bd078639a31e3762035652ddba5fda70f10d9c190691a58c8014226b09" 129 ], 130 [ 131 "ABCDEFGHIJKLMNOPQRSTUVWXY", 132 "bb57e6bd078639a31e3762035652ddbaca22ea606b337f0e549bd6c8134026c2" 133 ], 134 [ 135 "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 136 "bb57e6bd078639a31e3762035652ddbac5883abd9ff470ad8d5aefe0726131b8" 137 ], 138 [ 139 "ABCDEFGHIJKLMNOPQRSTUVWXYZA", 140 "bb57e6bd078639a31e3762035652ddba0ba1680b7ca9ca18f9bdc30a2213e138" 141 ], 142 [ 143 "ABCDEFGHIJKLMNOPQRSTUVWXYZAB", 144 "bb57e6bd078639a31e3762035652ddba34795f08b688add2ac28d579c1e4a735" 145 ], 146 [ 147 "ABCDEFGHIJKLMNOPQRSTUVWXYZABC", 148 "bb57e6bd078639a31e3762035652ddba5e6174bbd7d9848e19dadc7316a51905" 149 ], 150 [ 151 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 152 "bb57e6bd078639a31e3762035652ddba758897c9b84584efaf7bba27e80e2971" 153 ], 154 [ 155 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE", 156 "bb57e6bd078639a31e3762035652ddba23aecf5b5981c3a0b9967c6d5faf2f44" 157 ], 158 [ 159 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF", 160 "bb57e6bd078639a31e3762035652ddbace7c8364cc84b579dbb16765cba58de65123694ddc958e0c9436f6687338fc6e" 161 ], 162 [ 163 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 164 "bb57e6bd078639a31e3762035652ddbace7c8364cc84b579dbb16765cba58de659650a237cd9a2764e9b92749843fd22" 165 ] 166 ]; 31 167 168 Promise.all(testCases.map(function(testCase){ 169 var plainText = testCase[0]; 170 var expectedCipherText = testCase[1]; 171 return crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]).then(function(key) { 172 return crypto.subtle.encrypt(aesCbcParams, key, asciiToUint8Array(plainText)); 173 }).then(function(cipherText) { 174 return { 175 plainText: plainText, 176 cipherText: cipherText, 177 expectedCipherText: expectedCipherText 178 }; 179 }); 180 })).then(function(results) { 181 for (var result of results) { 182 plainText = result.plainText; 183 cipherText = result.cipherText; 184 expectedCipherText = result.expectedCipherText; 185 debug("Plain text: " + plainText); 186 shouldBe("bytesToHexString(cipherText)", "expectedCipherText"); 187 } 32 188 finishJSTest(); 33 189 });
Note: See TracChangeset
for help on using the changeset viewer.