| OLD | NEW |
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('../../resources/js-test.js'); | 2 importScripts('../../resources/js-test.js'); |
| 3 importScripts('common.js'); | 3 importScripts('common.js'); |
| 4 } | 4 } |
| 5 | 5 |
| 6 function shouldEvaluateAsSilent(expressionToEval, expectedResult) | 6 function shouldEvaluateAsSilent(expressionToEval, expectedResult) |
| 7 { | 7 { |
| 8 var result = eval(expressionToEval); | 8 var result = eval(expressionToEval); |
| 9 if (result !== expectedResult) { | 9 if (result !== expectedResult) { |
| 10 testFailed(expressionToEval + " evaluated to " + result + " instead of "
+ expectedResult); | 10 testFailed(expressionToEval + " evaluated to " + result + " instead of "
+ expectedResult); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // exportKeyPromise | 116 // exportKeyPromise |
| 117 exportedKeyData = result[3]; | 117 exportedKeyData = result[3]; |
| 118 shouldEvaluateAsSilent("bytesToHexString(exportedKeyData)", testCase.key
); | 118 shouldEvaluateAsSilent("bytesToHexString(exportedKeyData)", testCase.key
); |
| 119 }); | 119 }); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Very similar to aes-gcm-encrypt-decrypt.hml | 122 // Very similar to aes-gcm-encrypt-decrypt.hml |
| 123 function testAesGcm() | 123 function testAesGcm() |
| 124 { | 124 { |
| 125 var testCase = { | 125 var testCase = { |
| 126 "key": "ae7972c025d7f2ca3dd37dcc3d41c506671765087c6b61b8", | 126 "key": "e03548984a7ec8eaf0870637df0ac6bc17f7159315d0ae26a764fd224e483810", |
| 127 "iv": "984c1379e6ba961c828d792d", | 127 "iv": "f4feb26b846be4cd224dbc5133a5ae13814ebe19d3032acdd3a006463fdb71e83a9
d5d96679f26cc1719dd6b4feb3bab5b4b7993d0c0681f36d105ad3002fb66b201538e2b7479838ab
83402b0d816cd6e0fe5857e6f4adf92de8ee72b122ba1ac81795024943b7d0151bbf84ce87c8911f
512c397d14112296da7ecdd0da52a", |
| 128 "plainText": "d30b02c343487105219d6fa080acc743", | 128 "cipherText": "fda718aa1ec163487e21afc34f5a3a34795a9ee71dd3e7ee9a18fdb2418
1dc982b29c6ec723294a130ca2234952bb0ef68c0f3", |
| 129 "cipherText": "c4489fa64a6edf80e7e6a3b8855bc37c", | 129 "additionalData": "aab26eb3e7acd09a034a9e2651636ab3868e51281590ecc948355e4
57da42b7ad1391c7be0d9e82895e506173a81857c3226829fbd6dfb3f9657a71a2934445d7c05fa9
401cddd5109016ba32c3856afaadc48de80b8a01b57cb", |
| 130 "additionalData": "edd8f630f9bbc31b0acf122998f15589d6e6e3e1a3ec89e0c6a6ece
751610ebbf57fdfb9d82028ff1d9faebe37a268c1", | 130 "authenticationTag": "4795fbe0", |
| 131 "authenticationTag": "772ee7de0f91a981c36c93a35c88" | 131 "plainText": "69fd0c9da10b56ec6786333f8d76d4b74f8a434195f2f241f088b2520fb5
fa29455df9893164fb1638abe6617915d9497a8fe2" |
| 132 }; | 132 } |
| 133 | 133 |
| 134 var key = null; | 134 var key = null; |
| 135 var keyData = hexStringToUint8Array(testCase.key); | 135 var keyData = hexStringToUint8Array(testCase.key); |
| 136 var iv = hexStringToUint8Array(testCase.iv); | 136 var iv = hexStringToUint8Array(testCase.iv); |
| 137 var additionalData = hexStringToUint8Array(testCase.additionalData); | 137 var additionalData = hexStringToUint8Array(testCase.additionalData); |
| 138 var tag = hexStringToUint8Array(testCase.authenticationTag); | 138 var tag = hexStringToUint8Array(testCase.authenticationTag); |
| 139 var usages = ['encrypt', 'decrypt']; | 139 var usages = ['encrypt', 'decrypt']; |
| 140 var extractable = false; | 140 var extractable = false; |
| 141 | 141 |
| 142 var tagLengthBits = tag.byteLength * 8; | 142 var tagLengthBits = tag.byteLength * 8; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 }); | 178 }); |
| 179 } | 179 } |
| 180 | 180 |
| 181 Promise.all([ | 181 Promise.all([ |
| 182 testHmac(), | 182 testHmac(), |
| 183 testGenerateRsaKey(), | 183 testGenerateRsaKey(), |
| 184 testAesGcm(), | 184 testAesGcm(), |
| 185 testHmac(), | 185 testHmac(), |
| 186 testAesGcm(), | 186 testAesGcm(), |
| 187 ]).then(notifySuccess, notifyFailure); | 187 ]).then(notifySuccess, notifyFailure); |
| OLD | NEW |