Changeset 212465 in webkit
- Timestamp:
- Feb 16, 2017 2:31:14 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r212460 r212465 1 2017-02-16 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes 4 https://bugs.webkit.org/show_bug.cgi?id=167026 5 6 Reviewed by Chris Dumez. 7 8 * crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html: 9 * crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html: 10 Order of attributes inside JWK is different after this patch. 11 12 * crypto/subtle/aes-import-key-malformed-parameters-expected.txt: 13 * crypto/subtle/aes-import-key-malformed-parameters.html: 14 * crypto/subtle/hmac-import-key-malformed-parameters-expected.txt: 15 * crypto/subtle/hmac-import-key-malformed-parameters.html: 16 * crypto/subtle/rsa-import-key-malformed-parameters-expected.txt: 17 * crypto/subtle/rsa-import-key-malformed-parameters.html: 18 * crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js: 19 1 20 2017-02-16 Ryan Haddad <ryanhaddad@apple.com> 2 21 -
trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html
r209155 r212465 35 35 iv: asciiToUint8Array("jnOw99oOZFLIEPMr"), 36 36 } 37 var expectWrappedKey = " 848aa2f70ee18e2953520132a79cf479b03a8732a3cc73f8c51c68456d3c2557e8be9d5911b2a74267e282a87ffeed88dfbac38a22c26ba621f83915d7539420a4dc0b2329c585b442967367c1ea6c1126f98c4f13b7c8cb7402b86a5844c19420ea333dc33d908be89172f8bac59b403fe202f32c8eed19f431cedfc3383f536f3557163b1311ae42ee5486c6dafee968640d6b6999c687f37fba8d65cc662f1c84f16245665e4af41c98e8b63632cc1d19e2bece2154c7eab1905f3f6ab17b495cefec3508e9b451f2ea1422b97f275dfdc118f46af02040250d0e55d8d8d172b969bbcf7314a257f10b98d2c47c6c72a727acaf4c96340d590ebcebc61f73b7a868b490f3c1e17c59ea479a3b8db5574153de46cfdbb07cfc5e95ebcf7ad3d5fa057ba946d6da872c4bef3af6d7013e222c227650d0022c94d306cb14e203aad378d171c7c24f824c31b81fd18265e0de2f4b415584ebc4adeb5880c4eddbc88b854699f7aa74d6a10ca5df8978f27b5d1372b31ea67a9c4841ae101ea6ad78df0580b70358e6933ac92f7faee5320af329d8349a7b98690708a388737604be0affaa0669410d8d93dc4e4f57e14583253f11e5b27c89b84f1f3038bae6d9b37e3eb64b63ad1880627aef3b19e3e851cfae639ec46dd06fd131b51f530b37260b836d9013d8ad7c8640096070f96984c528ee5e20b69f3cd98a269621cd886ccb16d9c526a87cd5c458541309bb7fa4f3337305d76fc050d39ca8b1fdb0675a11a40ffde9cebb33ddc485e5dc5e7667b08c2a3e0136d063a447aee5a8f650429c5e422a706c4c240a4d11f4a9b5782f2cba2575f0c32cb477a9f0cef97fa993977104181315ff90e46f3b12b8b00f4a7611c42b1bb53d0e6021ab21ee8ae606d9f06dfedb891763007e020977c28b46d5f33bc35c12061d90ebbe02cab58783c0cac0c6f14ed735204f23d0eb6a9fe9edea2aecb1ac213f58b42d5d96374ec70ca288a31016ba02adef43250d717e9fab8982a1a180b1f3944d450c159010fd23f354d88502ec702882ae3edd567c6a6edf3cb2e34edc13f410a25d97298ab9062ddb566576fa8b6599bba205bab55aa5f3f37edaf7733cf249e69c74da975ef249ca673da749d86babebdf55410a389720ac943f1e9d921f5d69c5789636cb904fb9263744236eade9acae889a01c237ab3436101463dfa9d92f936c1b652c80f3abba76023ebe5b9bfdd54735e3a3494de18a456967f58758e546021feef3fa3e6c239981aa06f1f7ddc415d957ff9919bbec5f36af092a81ba6c14fe644d2ee98a2fcdee2ed70b87a53ffa327b25b4569c5886b15f2bd583d6f5bd7e951a915142baa08c6a9c343c200678a005fad22a337d2c5627f8c816db2525a7e121849b9da756eee68a240452849ffdb9651f998257c62e8fdcdc48dadfc3ebb18f7eb5461442008846a629ec8149c052f357bf5889095047b272bce0ff505953e7cd525b24c838ba6e9ed91922a30eeb858de8556f19f761d0287d768876346a5dcac3dbadd7a30072c9338162be5812166d961f4031f962ef668781d39d0fc69fe5f4494e31ec082d4a0140e368b69975beeba120ef9b651ead531b4d44296bd3cfe2ce7f97bb5bb4921061b12c2e1c4c10928c0980ff8d488a2282d0c056a40260167410e39664f75ff1f1249820e174eed978318a05e654b8aa6c60b70001a7a04f0aff17597dd9ab3ccc34f5ba2e352b7244dd3dccb462d7175b95ae3970ec5858e2312aac7c2c79a37b53d089f988720a4c04df6328a384004d0d51eafb9486623099a98e69be5169201c88824acc2bb0e1790889014a1797c168e98d19f0787c2935cfbc3bf24c4adad69a81e0e6adf8c21e3c4789064aa31a025dff5cc6eaba3f3e43f10a9d531f47963372120e2366b84c281ed968d9d11c1d103826c9362741e1267d1a3e8d2188761fa876b7b09617df14130c07209f1f1188ff40971b86607dee14d556a880447901c69d29cb16c027c3aae316ff00132bdfcd0e39c5e201252c9771483ccb275b0c67b3cb4dcd19198c7718634460254dfd6f8df4374b8bedee7dd20ce411b5f987cac2ce17492aa78f919c6d5e555000f47f7b8a9896d448bc4fc13e40a9e5c02258d509a7289f44d7250e89260233bf96702bb3d350451f03d802e0e37d9f01cce4c78869403493eb9890c2c09109d1f427f59cf091cd1c836e25a9bb065041407c2183f643bce2e72db1e7caeac42e2d8379f8b84df2cc7b1d055f42d6f62e0cb5771a14ae8872792350e5f770115a86564f60a785c53325c8c084afe214da3cac1783e2be9099d96ddbe9cc3ea3dd1d3ae50526b4afe24397420a3e4fa697613421";37 var expectWrappedKey = "995a93379575a0c677a7d48dbe7d496f64a53769eafae1e6a1d0f6a57d2c7f69748cdaeeff1fe7e13eb9c6d4597458ed22d369d5c6043b6ab30c79f1e7082cb3a57e19e53e607a0b26090317f45b24266c662923bb3b8c0fd7447860c52b3052da1bddda729a8bc19c447e4acd2b7da6b13fad0c4e022f7d76cb804c8aaebaed4566e2e14b02e81689f47314bf49c599c9b3700f2e23df498816bbe3ffe139cc0ed0500e762b4f3341b159950abd362ada4158e21b8ba0ed0f01a441d6a730e6a5717fd939b2e8b418d86f632ed2f3c7fea57d1ad67914afc41e4153c5b799f91c49f4db257d06477c748f7405c1394fbc8523c0a6fd31bf8368573defb47353d55c3bd5a7adfa5d9a54412823a5cfed93e632af8bdb929f0113d5ff021c0cf40d98e0f8dbaadf2c8c3878196a616e607fb5f7db4420a587cac87771c2ee6028d7f5036e1ffcb88b7f4c72a155890e8bb99c74a02aa80d4ed22ad27d4a60e9d532ab4c461a776a16e6b88ae8365b3987eab6fd2d02f9de9febc28d6f4a5467a3ef8e92c36d4e971d8c0801526393260f11eed75b6fb70ed3822c60bf7dcc6c8d4ef21ce74449365019033dfb9b8f9793198d68d406ca5dce366fb7b515c85c4ff47f6b5b3692397632d22eb6026f05a9e39f2be3be75d8aa1876aa4bac108d3ce67914c95cba31c5c072d9ddcbbbb90e34bc16c60ce812bfbb34cb76e4e7f68c0e5d6eb7647853731cab8ef4b8e3a557c84ca2b6aae9eec06bef30edf1280ef534c8698baa265d08b75ca3a29a4fbed50afdaa48e8cfebff211e9d64e63c0e3ba077f9a9c6f77a5b865a25850334d42df4f55cb7d0e1fb59590fea96d757eac310be056427b55b10342a3dd522a712d86e589183fa278dbc3c6654c12d777e9fa2a030aba5747aa345a46e7754bda59f530e5e8dfdedfc343bb789fdfc138210d5ab587f581c006760ba3d6b5875e2a34ae16f9cbded2882f5e6ffd9904518b789123ca6d19eeda979dab4ba8437b8d660354a28dac7e917cdf061cd7748d624e0af4ab9c2a5c18389e71accc495945dc83e7ea7c7724434ab375551c6fd2b0070229ec791aa680be539799aa168cf5a955721d249e676ee434141f93d1977fd8d635e387496cac6c3509a71df4fac016ca7885ae7fa7fe601c6ed62a83d0313b7d07476501e5e8b3821a1fedfa91e842cffa3cc255db1a50091aa6b391d1014cc1e59c3f36425102a03acabf06525f44c87422a889ed78c1e78a2a4d9ab244a30155005e954111d4c3384f63153adc276861021a76289f266fb7d6eda300d39102bee7d7047e32b0ced7a90e0b27f201ad8960ecb83a8003ef1e3de97b2ddf00f5b8344f1f103c6b0c5a90804201f9ac26c544e7f3cca7d4d10a7388b2460a83dfbc9c7544b9e7ce2488907f2da06b48ec209c8e9a4688261c1a1b63c940b07c2053b60b06b20421810ffbef6a4d482d7ba7d80cb6ea04222797e4ee40564612bfb15b57b34afcab259efb03e2f7a7a1622b06df5825d6cf2fd0bf63749e2c6e89b358cfe0167f0577c571953dba4b4bb3591c922b2605ccc4ccb5a3ba1a38a8983d885d867713be90d2e796fd7cb8d465925927feaeae45ef931dc7806a6ecc94810a7a39a87c6158e85866a8c2bdd3b88522c23fc4a969f60994e3cfb1be584c3f418b1e19009ac53b38d9d015af213acd5f0e9d65ee78d59c10e94973eb08b79403483591662cc9b45ac13360e262c77bb3f71f32f0f3fa35ce75daf7ca39c4c81abbabc478d6c51ffdadee0787bc98617e3ef85d87a2447103e43f910019ee95d829a4dda87339fb1437aabf4bdc884ac470853622835e825229299b838ed75024ed28050ac858aa5ba9df18ff072e878c7f1fb2da444a8eb92de07e77fd1cf7c19e589646cdbce436de837b44b78420ee9ed1bc74b5b49d98758b1b80bf17f1a2836a2a9958990a6205bd20e969c91ed56b196b0dd64fc3545e5d9278a75f0368bd4ec1a88f396e374d19a3e622f65709a522b2b1ffc70aac843f879e4507cc675a513eb868e1116fa2c8e0215afa1ddaaa99d2698879944180a4da38873c512998a7a0c51b44c8655302b703a9251a9f3acd9465d9f3eab1b7555317fdd97ccf0305a56e32a34daa62a8a4d16f280db7fd54bff1ed916d04c3e346b5de79b833d9ba42789be91a42fdad20c239eaa51f411fde79f0d6274a055fa98fabbc583714ed4baa168660493a55a7fdf5b66dc4d6afb05224da3b3f81ca8274b1be0d31da40b80ee9f0a56448bcbc6f8142aea8ab0169764dac201c7c8733e3f9b7212be22a39c12e30cde9ed5fe3042db4a51a1b85e0d23fc7b237224473be41ef6a8db014cda53969b1acdd0b732a5"; 38 38 39 39 crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["wrapKey"]).then(function(result) { -
trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html
r209155 r212465 29 29 iv: asciiToUint8Array("jnOw99oOZFLIEPMr"), 30 30 } 31 var expectWrappedKey = " 848aa2f70ee18e2953520132a79cf47946e00c99362340bb690edc9ab5315757462c128278c6232e770e7437c56ed722a8e1703855f7f3e565394e1a6a0305c4ef1b30fa4c7f72d1a239cc6c6ba067898798a36a75132c66b4a2d3fb942886affd3ea3b2756b0ddc886c01e3b93107469b82124468408ef8ab548b85aa8f206c312d74ce4f2c679eb147a275cefda64d5bdc4a2b5b90a4ac9ad3eb5f2cf19f5f87653211f59b4731ba61125582a233951097dea65db05899d587d1dcfccab9ab7410ab3010b89066506dbacbc6b73e4b564792751388fa0f58d55c59c14a08c9dfb0f78100b0f5cc29d62328822636d30a6a153ec5cd4727ad5e47b419c48544565637ac5789863d43b7da78cf4383d09d66e9d458e436dbfbee75e382b2bab49eec2c7491ff93cf099fe92feaf4658e30889fd12d3ae61cd5e8c8e1e56a079b662f90cd10cdbdbb4d12eefb36d825e1a043e82f5a98f8960d655d3f9ed5af31e581fa846cc582f6cee5c25e0b3c32050534ae957ce27860d470ba26da2c7d6fa621b0faa8becad58e9e55bb2a9d984b042f25df21482529870d271cbf5508a0edfc3cb37316c11f16b342bc1f1f98aa";31 var expectWrappedKey = "995a93379575a0c677a7d48dbe7d496fe4d8c9be49cdaf48e88398a769c2825d94396edb75683ed54e3ca0ac1f352f6b92486ef68186ef37d2b6be27ddd4bdaafbea98ec8c0dfc62353714f11219d4c69271a06507909f6dc50fd136f06265e5bfe9b2de09a704db4b4acd1d2834eefaab814484b70d77984455a1bad47e94cedc467939ea7495387087aff0eec9dfa4bf6c5baa6df37328a7068128930adc129a1874c323f315e993a27c667f1e02ffab5cc235bb7d270696875f43bb198f453cdef134ffe171c855c4641678527819dce552e4cd97fb30404075869aba085634327774cd7b71e7d0ea306f2d92d64658778897489fff205645e1a1b57832349ef1e6abef7c6780aa085b7d55c55693d69cf439497925dc8239791130d4387387188f2dea13d2825b2690456df80f6f1694351c8f33eb37bc44f2ad3f8f6d0a0e98c1510c6a5f64209288516aec0b30f85ed0b129a5ffc4840a9b5f0374c37304ad4f3d81572417813172929dd08f8a853ab57d3bc5d72eeeca932d8a05d3eb74d2ceba39b87cd7113abb30de3d05448162b50b17de8603fa4b5e7f8ab267cc6b8fdc830d76a35eb4078597b6301176"; 32 32 33 33 crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["wrapKey"]).then(function(result) { -
trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt
r208548 r212465 10 10 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: "A256CBC"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 11 11 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: "A128CBC"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 12 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 13 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 14 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 15 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 12 16 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A192KW"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 13 17 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: "A256KW"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 14 18 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: "A128KW"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 15 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-cbc", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 19 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 20 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 21 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 22 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 16 23 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "!!!", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 24 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 17 25 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", use: "sig"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 26 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", use: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 18 27 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", key_ops: ["encrypt", "decrypt"]}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 28 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", key_ops: [ ]}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 19 29 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", ext: false}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 20 30 PASS successfullyParsed is true -
trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html
r208548 r212465 27 27 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: "A256CBC"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 28 28 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: "A128CBC"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 29 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 30 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 31 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 32 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 29 33 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A192KW"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])'); 30 34 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: "A256KW"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])'); 31 35 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: "A128KW"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])'); 32 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-cbc", extractable, ["wrapKey", "unwrapKey"])'); 36 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])'); 37 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])'); 38 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])'); 39 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])'); 33 40 // Jwk: wrong k format 34 41 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "!!!", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 42 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 35 43 // Jwk: wrong use 36 44 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", use: "sig"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 45 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", use: ""}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 37 46 // Jwk: wrong key_ops 38 47 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", key_ops: ["encrypt", "decrypt"]}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 48 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", key_ops: [ ]}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); 39 49 // Jwk: wrong ext 40 50 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", ext: false}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])'); -
trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters-expected.txt
r208737 r212465 14 14 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS512"}, {name: "hmac", hash: "sha-384"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 15 15 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1"}, {name: "hmac", hash: "sha-512"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 16 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 17 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-224"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 18 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-256"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 19 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-384"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 20 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-512"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 16 21 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "!!!", alg: "foo"}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 22 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "", alg: "foo"}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 17 23 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", use: "enc"}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 24 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", use: ""}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 18 25 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", key_ops: ["sign"]}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 19 26 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", ext: false}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. -
trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters.html
r208737 r212465 31 31 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS512"}, {name: "hmac", hash: "sha-384"}, extractable, ["sign", "verify"])'); 32 32 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1"}, {name: "hmac", hash: "sha-512"}, extractable, ["sign", "verify"])'); 33 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); 34 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-224"}, extractable, ["sign", "verify"])'); 35 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-256"}, extractable, ["sign", "verify"])'); 36 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-384"}, extractable, ["sign", "verify"])'); 37 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: ""}, {name: "hmac", hash: "sha-512"}, extractable, ["sign", "verify"])'); 33 38 // Jwk: wrong k format 34 39 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "!!!", alg: "foo"}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); 40 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "", alg: "foo"}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); 35 41 // Jwk: wrong use 36 42 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", use: "enc"}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); 43 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", use: ""}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); 37 44 // Jwk: wrong key_ops 38 45 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", key_ops: ["sign"]}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); -
trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt
r209633 r212465 6 6 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 7 7 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 8 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: ""}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 8 9 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["sign"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 9 10 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 11 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 10 12 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 11 13 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 14 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: ""}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 12 15 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: "sig"}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 16 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: ""}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 13 17 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: "enc"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 18 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 14 19 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: "sig"}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 20 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: ""}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 15 21 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "foo"}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 22 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 16 23 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS224"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 17 24 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS256"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-224"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. … … 19 26 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS512"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-384"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 20 27 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS1"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-512"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 28 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 29 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-224"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 30 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-256"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 31 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-384"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 32 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-512"}, extractable, ["verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 21 33 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP-224"}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 22 34 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP-256"}, {name: "RSA-OAEP", hash: "sha-224"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. … … 24 36 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP-512"}, {name: "RSA-OAEP", hash: "sha-384"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 25 37 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP"}, {name: "RSA-OAEP", hash: "sha-512"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 38 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 39 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-224"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 40 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-256"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 41 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-384"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 42 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-512"}, extractable, ["encrypt", "wrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 26 43 PASS crypto.subtle.importKey("jwk", {kty: "oct", n: n, e: e}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 27 44 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, key_ops: ["sign", "verify"]}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. … … 37 54 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d, p: p, q: q, dp: dp, qi: qi}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 38 55 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d, p: p, q: q, dp: dp, dq: dq}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 56 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: "", e: e, d: d, p: p, q: q, dp: dp, dq: dq, qi: qi}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 57 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d, p: "", q: q, dp: dp, dq: dq, qi: qi}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 39 58 PASS crypto.subtle.importKey("spki", spkiKey, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. 40 59 PASS crypto.subtle.importKey("spki", spkiKey, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["sign"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range. -
trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html
r209633 r212465 36 36 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])'); 37 37 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 38 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: ""}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 38 39 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["sign"])'); 39 40 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"])'); 41 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"])'); 40 42 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"])'); 41 43 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"])'); 44 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: ""}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"])'); 42 45 // Jwk: Wrong use 43 46 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: "sig"}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 47 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: ""}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 44 48 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: "enc"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"])'); 49 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"])'); 45 50 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: "sig"}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"])'); 51 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, use: ""}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"])'); 46 52 // Jwk: Wrong alg 47 53 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "foo"}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 54 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 48 55 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS224"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"])'); 49 56 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS256"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-224"}, extractable, ["verify"])'); … … 51 58 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS512"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-384"}, extractable, ["verify"])'); 52 59 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RS1"}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-512"}, extractable, ["verify"])'); 60 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"])'); 61 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-224"}, extractable, ["verify"])'); 62 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-256"}, extractable, ["verify"])'); 63 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-384"}, extractable, ["verify"])'); 64 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSASSA-PKCS1-v1_5", hash: "sha-512"}, extractable, ["verify"])'); 53 65 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP-224"}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"])'); 54 66 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP-256"}, {name: "RSA-OAEP", hash: "sha-224"}, extractable, ["encrypt", "wrapKey"])'); … … 56 68 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP-512"}, {name: "RSA-OAEP", hash: "sha-384"}, extractable, ["encrypt", "wrapKey"])'); 57 69 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: "RSA-OAEP"}, {name: "RSA-OAEP", hash: "sha-512"}, extractable, ["encrypt", "wrapKey"])'); 70 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"])'); 71 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-224"}, extractable, ["encrypt", "wrapKey"])'); 72 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-256"}, extractable, ["encrypt", "wrapKey"])'); 73 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-384"}, extractable, ["encrypt", "wrapKey"])'); 74 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, alg: ""}, {name: "RSA-OAEP", hash: "sha-512"}, extractable, ["encrypt", "wrapKey"])'); 58 75 // Jwk: Wrong kty 59 76 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", n: n, e: e}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); … … 75 92 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d, p: p, q: q, dp: dp, qi: qi}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])'); 76 93 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d, p: p, q: q, dp: dp, dq: dq}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])'); 94 // Empty n, p 95 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: "", e: e, d: d, p: p, q: q, dp: dp, dq: dq, qi: qi}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])'); 96 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, d: d, p: "", q: q, dp: dp, dq: dq, qi: qi}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])'); 77 97 // Spki: Wrong usages 78 98 shouldReject('crypto.subtle.importKey("spki", spkiKey, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])'); -
trunk/LayoutTests/crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js
r209155 r212465 21 21 iv: asciiToUint8Array("jnOw99oOZFLIEPMr"), 22 22 } 23 var expectWrappedKey = " 848aa2f70ee18e2953520132a79cf47946e00c99362340bb690edc9ab5315757462c128278c6232e770e7437c56ed722a8e1703855f7f3e565394e1a6a0305c4ef1b30fa4c7f72d1a239cc6c6ba067898798a36a75132c66b4a2d3fb942886affd3ea3b2756b0ddc886c01e3b93107469b82124468408ef8ab548b85aa8f206c312d74ce4f2c679eb147a275cefda64d5bdc4a2b5b90a4ac9ad3eb5f2cf19f5f87653211f59b4731ba61125582a233951097dea65db05899d587d1dcfccab9ab7410ab3010b89066506dbacbc6b73e4b564792751388fa0f58d55c59c14a08c9dfb0f78100b0f5cc29d62328822636d30a6a153ec5cd4727ad5e47b419c48544565637ac5789863d43b7da78cf4383d09d66e9d458e436dbfbee75e382b2bab49eec2c7491ff93cf099fe92feaf4658e30889fd12d3ae61cd5e8c8e1e56a079b662f90cd10cdbdbb4d12eefb36d825e1a043e82f5a98f8960d655d3f9ed5af31e581fa846cc582f6cee5c25e0b3c32050534ae957ce27860d470ba26da2c7d6fa621b0faa8becad58e9e55bb2a9d984b042f25df21482529870d271cbf5508a0edfc3cb37316c11f16b342bc1f1f98aa";23 var expectWrappedKey = "995a93379575a0c677a7d48dbe7d496fe4d8c9be49cdaf48e88398a769c2825d94396edb75683ed54e3ca0ac1f352f6b92486ef68186ef37d2b6be27ddd4bdaafbea98ec8c0dfc62353714f11219d4c69271a06507909f6dc50fd136f06265e5bfe9b2de09a704db4b4acd1d2834eefaab814484b70d77984455a1bad47e94cedc467939ea7495387087aff0eec9dfa4bf6c5baa6df37328a7068128930adc129a1874c323f315e993a27c667f1e02ffab5cc235bb7d270696875f43bb198f453cdef134ffe171c855c4641678527819dce552e4cd97fb30404075869aba085634327774cd7b71e7d0ea306f2d92d64658778897489fff205645e1a1b57832349ef1e6abef7c6780aa085b7d55c55693d69cf439497925dc8239791130d4387387188f2dea13d2825b2690456df80f6f1694351c8f33eb37bc44f2ad3f8f6d0a0e98c1510c6a5f64209288516aec0b30f85ed0b129a5ffc4840a9b5f0374c37304ad4f3d81572417813172929dd08f8a853ab57d3bc5d72eeeca932d8a05d3eb74d2ceba39b87cd7113abb30de3d05448162b50b17de8603fa4b5e7f8ab267cc6b8fdc830d76a35eb4078597b6301176"; 24 24 25 25 crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["wrapKey"]).then(function(result) { -
trunk/Source/WebCore/ChangeLog
r212463 r212465 1 2017-02-16 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes 4 https://bugs.webkit.org/show_bug.cgi?id=167026 5 6 Reviewed by Chris Dumez. 7 8 Covered by existing tests. 9 10 * bindings/js/JSSubtleCryptoCustom.cpp: 11 (WebCore::jsSubtleCryptoFunctionExportKeyPromise): 12 (WebCore::jsSubtleCryptoFunctionWrapKeyPromise): 13 (WebCore::toJSValueFromJsonWebKey): Deleted. 14 * crypto/JsonWebKey.h: 15 * crypto/JsonWebKey.idl: 16 * crypto/RsaOtherPrimesInfo.idl: 17 Change std::optional<String> to String in order to use toJS<IDLDictionary<JsonWebKey>>. 18 * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: 19 (WebCore::CryptoAlgorithmAES_CBC::importKey): 20 * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: 21 (WebCore::CryptoAlgorithmAES_KW::importKey): 22 * crypto/algorithms/CryptoAlgorithmHMAC.cpp: 23 (WebCore::CryptoAlgorithmHMAC::importKey): 24 * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: 25 (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): 26 * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: 27 (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): 28 * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: 29 (WebCore::CryptoAlgorithmRSA_OAEP::importKey): 30 * crypto/keys/CryptoKeyAES.cpp: 31 (WebCore::CryptoKeyAES::importJwk): 32 Only check if key_ops contains all of the specified usages when key_ops field of jwk is present, 33 as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations 34 * crypto/keys/CryptoKeyAES.h: 35 * crypto/keys/CryptoKeyHMAC.cpp: 36 (WebCore::CryptoKeyHMAC::importJwk): 37 * crypto/keys/CryptoKeyHMAC.h: 38 * crypto/keys/CryptoKeyRSA.cpp: 39 (WebCore::CryptoKeyRSA::importJwk): 40 Accommodate the change from std::optional<String> to String. 41 * crypto/mac/CryptoKeyRSAMac.cpp: 42 (WebCore::CryptoKeyRSA::create): 43 Add a null check for p. 44 1 45 2017-02-16 Antti Koivisto <antti@apple.com> 2 46 -
trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp
r212207 r212465 360 360 } 361 361 362 // FIXME: We should get rid of this once https://bugs.webkit.org/show_bug.cgi?id=163711 is fixed.363 static JSValue toJSValueFromJsonWebKey(JSDOMGlobalObject& globalObject, JsonWebKey&& key)364 {365 ExecState& state = *globalObject.globalExec();366 VM& vm = state.vm();367 368 auto* result = constructEmptyObject(&state);369 result->putDirect(vm, Identifier::fromString(&vm, "kty"), toJS<IDLDOMString>(state, key.kty));370 if (key.use)371 result->putDirect(vm, Identifier::fromString(&vm, "use"), toJS<IDLDOMString>(state, key.use.value()));372 if (key.key_ops)373 result->putDirect(vm, Identifier::fromString(&vm, "key_ops"), toJS<IDLSequence<IDLEnumeration<CryptoKeyUsage>>>(state, globalObject, key.key_ops.value()));374 if (key.alg)375 result->putDirect(vm, Identifier::fromString(&vm, "alg"), toJS<IDLDOMString>(state, key.alg.value()));376 if (key.ext)377 result->putDirect(vm, Identifier::fromString(&vm, "ext"), toJS<IDLBoolean>(state, key.ext.value()));378 if (key.crv)379 result->putDirect(vm, Identifier::fromString(&vm, "crv"), toJS<IDLDOMString>(state, key.crv.value()));380 if (key.x)381 result->putDirect(vm, Identifier::fromString(&vm, "x"), toJS<IDLDOMString>(state, key.x.value()));382 if (key.y)383 result->putDirect(vm, Identifier::fromString(&vm, "y"), toJS<IDLDOMString>(state, key.y.value()));384 if (key.d)385 result->putDirect(vm, Identifier::fromString(&vm, "d"), toJS<IDLDOMString>(state, key.d.value()));386 if (key.n)387 result->putDirect(vm, Identifier::fromString(&vm, "n"), toJS<IDLDOMString>(state, key.n.value()));388 if (key.e)389 result->putDirect(vm, Identifier::fromString(&vm, "e"), toJS<IDLDOMString>(state, key.e.value()));390 if (key.p)391 result->putDirect(vm, Identifier::fromString(&vm, "p"), toJS<IDLDOMString>(state, key.p.value()));392 if (key.q)393 result->putDirect(vm, Identifier::fromString(&vm, "q"), toJS<IDLDOMString>(state, key.q.value()));394 if (key.dp)395 result->putDirect(vm, Identifier::fromString(&vm, "dp"), toJS<IDLDOMString>(state, key.dp.value()));396 if (key.dq)397 result->putDirect(vm, Identifier::fromString(&vm, "dq"), toJS<IDLDOMString>(state, key.dq.value()));398 if (key.qi)399 result->putDirect(vm, Identifier::fromString(&vm, "qi"), toJS<IDLDOMString>(state, key.qi.value()));400 if (key.oth) {401 MarkedArgumentBuffer list;402 for (auto& value : key.oth.value()) {403 auto* info = constructEmptyObject(&state);404 info->putDirect(vm, Identifier::fromString(&vm, "r"), toJS<IDLDOMString>(state, value.r));405 info->putDirect(vm, Identifier::fromString(&vm, "d"), toJS<IDLDOMString>(state, value.d));406 info->putDirect(vm, Identifier::fromString(&vm, "t"), toJS<IDLDOMString>(state, value.t));407 list.append(info);408 }409 result->putDirect(vm, Identifier::fromString(&vm, "oth"), constructArray(&state, static_cast<Structure*>(nullptr), list));410 }411 if (key.k)412 result->putDirect(vm, Identifier::fromString(&vm, "k"), toJS<IDLDOMString>(state, key.k.value()));413 414 return result;415 }416 417 362 static RefPtr<CryptoKey> toCryptoKey(ExecState& state, JSValue value) 418 363 { … … 866 811 } 867 812 case SubtleCrypto::KeyFormat::Jwk: 868 capturedPromise->resolve<IDL Any>(toJSValueFromJsonWebKey(*(capturedPromise->globalObject()), WTFMove(WTF::get<JsonWebKey>(key))));813 capturedPromise->resolve<IDLDictionary<JsonWebKey>>(WTFMove(WTF::get<JsonWebKey>(key))); 869 814 return; 870 815 } … … 955 900 break; 956 901 case SubtleCrypto::KeyFormat::Jwk: { 957 auto jwk = toJS ValueFromJsonWebKey(*(promise->globalObject()), WTFMove(WTF::get<JsonWebKey>(key)));902 auto jwk = toJS<IDLDictionary<JsonWebKey>>(*(promise->globalObject()->globalExec()), *(promise->globalObject()), WTFMove(WTF::get<JsonWebKey>(key))); 958 903 String jwkString = JSONStringify(promise->globalObject()->globalExec(), jwk, 0); 959 904 CString jwkUtf8String = jwkString.utf8(StrictConversion); -
trunk/Source/WebCore/crypto/JsonWebKey.h
r208985 r212465 36 36 struct JsonWebKey { 37 37 String kty; 38 std::optional<String>use;38 String use; 39 39 // FIXME: Consider merging key_ops and usages. 40 40 std::optional<Vector<CryptoKeyUsage>> key_ops; 41 41 CryptoKeyUsageBitmap usages; 42 std::optional<String>alg;42 String alg; 43 43 44 44 std::optional<bool> ext; 45 45 46 std::optional<String>crv;47 std::optional<String>x;48 std::optional<String>y;49 std::optional<String>d;50 std::optional<String>n;51 std::optional<String>e;52 std::optional<String>p;53 std::optional<String>q;54 std::optional<String>dp;55 std::optional<String>dq;56 std::optional<String>qi;46 String crv; 47 String x; 48 String y; 49 String d; 50 String n; 51 String e; 52 String p; 53 String q; 54 String dp; 55 String dq; 56 String qi; 57 57 std::optional<Vector<RsaOtherPrimesInfo>> oth; 58 std::optional<String>k;58 String k; 59 59 }; 60 60 -
trunk/Source/WebCore/crypto/JsonWebKey.idl
r208602 r212465 26 26 [ 27 27 Conditional=SUBTLE_CRYPTO, 28 JSGenerateToJSObject, 28 29 ] dictionary JsonWebKey { 29 30 // The following fields are defined in Section 3.1 of JSON Web Key -
trunk/Source/WebCore/crypto/RsaOtherPrimesInfo.idl
r208548 r212465 26 26 [ 27 27 Conditional=SUBTLE_CRYPTO, 28 JSGenerateToJSObject, 28 29 ] dictionary RsaOtherPrimesInfo { 29 30 // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
r209390 r212465 121 121 break; 122 122 case SubtleCrypto::KeyFormat::Jwk: { 123 auto checkAlgCallback = [](size_t length, const std::optional<String>& alg) -> bool {123 auto checkAlgCallback = [](size_t length, const String& alg) -> bool { 124 124 switch (length) { 125 125 case CryptoKeyAES::s_length128: 126 return !alg || alg.value()== ALG128;126 return alg.isNull() || alg == ALG128; 127 127 case CryptoKeyAES::s_length192: 128 return !alg || alg.value()== ALG192;128 return alg.isNull() || alg == ALG192; 129 129 case CryptoKeyAES::s_length256: 130 return !alg || alg.value()== ALG256;130 return alg.isNull() || alg == ALG256; 131 131 } 132 132 return false; -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp
r210257 r212465 95 95 break; 96 96 case SubtleCrypto::KeyFormat::Jwk: { 97 result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, [](size_t length, const std::optional<String>& alg) -> bool {97 result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, [](size_t length, const String& alg) -> bool { 98 98 switch (length) { 99 99 case CryptoKeyAES::s_length128: 100 return !alg || alg.value()== ALG128;100 return alg.isNull() || alg == ALG128; 101 101 case CryptoKeyAES::s_length192: 102 return !alg || alg.value()== ALG192;102 return alg.isNull() || alg == ALG192; 103 103 case CryptoKeyAES::s_length256: 104 return !alg || alg.value()== ALG256;104 return alg.isNull() || alg == ALG256; 105 105 } 106 106 return false; -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp
r210257 r212465 120 120 break; 121 121 case SubtleCrypto::KeyFormat::Jwk: { 122 auto checkAlgCallback = [](CryptoAlgorithmIdentifier hash, const std::optional<String>& alg) -> bool {122 auto checkAlgCallback = [](CryptoAlgorithmIdentifier hash, const String& alg) -> bool { 123 123 switch (hash) { 124 124 case CryptoAlgorithmIdentifier::SHA_1: 125 return !alg || alg.value()== ALG1;125 return alg.isNull() || alg == ALG1; 126 126 case CryptoAlgorithmIdentifier::SHA_224: 127 return !alg || alg.value()== ALG224;127 return alg.isNull() || alg == ALG224; 128 128 case CryptoAlgorithmIdentifier::SHA_256: 129 return !alg || alg.value()== ALG256;129 return alg.isNull() || alg == ALG256; 130 130 case CryptoAlgorithmIdentifier::SHA_384: 131 return !alg || alg.value()== ALG384;131 return alg.isNull() || alg == ALG384; 132 132 case CryptoAlgorithmIdentifier::SHA_512: 133 return !alg || alg.value()== ALG512;133 return alg.isNull() || alg == ALG512; 134 134 default: 135 135 return false; -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
r210257 r212465 107 107 case SubtleCrypto::KeyFormat::Jwk: { 108 108 JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data)); 109 if (usages && (( key.d && (usages ^ CryptoKeyUsageDecrypt)) || (!key.d&& (usages ^ CryptoKeyUsageEncrypt)))) {109 if (usages && ((!key.d.isNull() && (usages ^ CryptoKeyUsageDecrypt)) || (key.d.isNull() && (usages ^ CryptoKeyUsageEncrypt)))) { 110 110 exceptionCallback(SYNTAX_ERR); 111 111 return; 112 112 } 113 if (usages && key.use && key.use.value()!= "enc") {113 if (usages && !key.use.isNull() && key.use != "enc") { 114 114 exceptionCallback(DataError); 115 115 return; 116 116 } 117 if ( key.alg && key.alg.value()!= ALG) {117 if (!key.alg.isNull() && key.alg != ALG) { 118 118 exceptionCallback(DataError); 119 119 return; -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
r210257 r212465 118 118 JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data)); 119 119 120 if (usages && (( key.d && (usages ^ CryptoKeyUsageSign)) || (!key.d&& (usages ^ CryptoKeyUsageVerify)))) {120 if (usages && ((!key.d.isNull() && (usages ^ CryptoKeyUsageSign)) || (key.d.isNull() && (usages ^ CryptoKeyUsageVerify)))) { 121 121 exceptionCallback(SYNTAX_ERR); 122 122 return; 123 123 } 124 if (usages && key.use && key.use.value()!= "sig") {124 if (usages && !key.use.isNull() && key.use != "sig") { 125 125 exceptionCallback(DataError); 126 126 return; … … 130 130 switch (rsaParameters.hashIdentifier) { 131 131 case CryptoAlgorithmIdentifier::SHA_1: 132 isMatched = !key.alg || key.alg.value()== ALG1;132 isMatched = key.alg.isNull() || key.alg == ALG1; 133 133 break; 134 134 case CryptoAlgorithmIdentifier::SHA_224: 135 isMatched = !key.alg || key.alg.value()== ALG224;135 isMatched = key.alg.isNull() || key.alg == ALG224; 136 136 break; 137 137 case CryptoAlgorithmIdentifier::SHA_256: 138 isMatched = !key.alg || key.alg.value()== ALG256;138 isMatched = key.alg.isNull() || key.alg == ALG256; 139 139 break; 140 140 case CryptoAlgorithmIdentifier::SHA_384: 141 isMatched = !key.alg || key.alg.value()== ALG384;141 isMatched = key.alg.isNull() || key.alg == ALG384; 142 142 break; 143 143 case CryptoAlgorithmIdentifier::SHA_512: 144 isMatched = !key.alg || key.alg.value()== ALG512;144 isMatched = key.alg.isNull() || key.alg == ALG512; 145 145 break; 146 146 default: -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
r210257 r212465 121 121 122 122 bool isUsagesAllowed = false; 123 if ( key.d) {123 if (!key.d.isNull()) { 124 124 isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageDecrypt); 125 125 isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageUnwrapKey); … … 136 136 } 137 137 138 if (usages && key.use && key.use.value()!= "enc") {138 if (usages && !key.use.isNull() && key.use != "enc") { 139 139 exceptionCallback(DataError); 140 140 return; … … 144 144 switch (rsaParameters.hashIdentifier) { 145 145 case CryptoAlgorithmIdentifier::SHA_1: 146 isMatched = !key.alg || key.alg.value()== ALG1;146 isMatched = key.alg.isNull() || key.alg == ALG1; 147 147 break; 148 148 case CryptoAlgorithmIdentifier::SHA_224: 149 isMatched = !key.alg || key.alg.value()== ALG224;149 isMatched = key.alg.isNull() || key.alg == ALG224; 150 150 break; 151 151 case CryptoAlgorithmIdentifier::SHA_256: 152 isMatched = !key.alg || key.alg.value()== ALG256;152 isMatched = key.alg.isNull() || key.alg == ALG256; 153 153 break; 154 154 case CryptoAlgorithmIdentifier::SHA_384: 155 isMatched = !key.alg || key.alg.value()== ALG384;155 isMatched = key.alg.isNull() || key.alg == ALG384; 156 156 break; 157 157 case CryptoAlgorithmIdentifier::SHA_512: 158 isMatched = !key.alg || key.alg.value()== ALG512;158 isMatched = key.alg.isNull() || key.alg == ALG512; 159 159 break; 160 160 default: -
trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp
r208737 r212465 88 88 if (keyData.kty != "oct") 89 89 return nullptr; 90 if ( !keyData.k)90 if (keyData.k.isNull()) 91 91 return nullptr; 92 92 Vector<uint8_t> octetSequence; 93 if (!base64URLDecode(keyData.k .value(), octetSequence))93 if (!base64URLDecode(keyData.k, octetSequence)) 94 94 return nullptr; 95 95 if (!callback(octetSequence.size() * 8, keyData.alg)) 96 96 return nullptr; 97 if (usages && keyData.use && keyData.use.value()!= "enc")97 if (usages && !keyData.use.isNull() && keyData.use != "enc") 98 98 return nullptr; 99 if (keyData. usages && ((keyData.usages & usages) != usages))99 if (keyData.key_ops && ((keyData.usages & usages) != usages)) 100 100 return nullptr; 101 101 if (keyData.ext && !keyData.ext.value() && extractable) -
trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h
r208985 r212465 69 69 static RefPtr<CryptoKeyAES> generate(CryptoAlgorithmIdentifier, size_t lengthBits, bool extractable, CryptoKeyUsageBitmap); 70 70 static RefPtr<CryptoKeyAES> importRaw(CryptoAlgorithmIdentifier, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap); 71 using CheckAlgCallback = WTF::Function<bool(size_t, const std::optional<String>&)>;71 using CheckAlgCallback = Function<bool(size_t, const String&)>; 72 72 static RefPtr<CryptoKeyAES> importJwk(CryptoAlgorithmIdentifier, JsonWebKey&&, bool extractable, CryptoKeyUsageBitmap, CheckAlgCallback&&); 73 73 -
trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp
r208737 r212465 98 98 if (keyData.kty != "oct") 99 99 return nullptr; 100 if ( !keyData.k)100 if (keyData.k.isNull()) 101 101 return nullptr; 102 102 Vector<uint8_t> octetSequence; 103 if (!base64URLDecode(keyData.k .value(), octetSequence))103 if (!base64URLDecode(keyData.k, octetSequence)) 104 104 return nullptr; 105 105 if (!callback(hash, keyData.alg)) 106 106 return nullptr; 107 if (usages && keyData.use && keyData.use.value()!= "sig")107 if (usages && !keyData.use.isNull() && keyData.use != "sig") 108 108 return nullptr; 109 109 if (keyData.usages && ((keyData.usages & usages) != usages)) -
trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h
r208985 r212465 65 65 static RefPtr<CryptoKeyHMAC> generate(size_t lengthBits, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap); 66 66 static RefPtr<CryptoKeyHMAC> importRaw(size_t lengthBits, CryptoAlgorithmIdentifier hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap); 67 using CheckAlgCallback = WTF::Function<bool(CryptoAlgorithmIdentifier, const std::optional<String>&)>;67 using CheckAlgCallback = Function<bool(CryptoAlgorithmIdentifier, const String&)>; 68 68 static RefPtr<CryptoKeyHMAC> importJwk(size_t lengthBits, CryptoAlgorithmIdentifier hash, JsonWebKey&&, bool extractable, CryptoKeyUsageBitmap, CheckAlgCallback&&); 69 69 -
trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp
r208985 r212465 44 44 return nullptr; 45 45 46 if ( !keyData.n || !keyData.e)46 if (keyData.n.isNull() || keyData.e.isNull()) 47 47 return nullptr; 48 48 Vector<uint8_t> modulus; 49 if (!WTF::base64URLDecode(keyData.n .value(), modulus))49 if (!WTF::base64URLDecode(keyData.n, modulus)) 50 50 return nullptr; 51 51 // Per RFC 7518 Section 6.3.1.1: https://tools.ietf.org/html/rfc7518#section-6.3.1.1 52 if (!modulus [0])52 if (!modulus.isEmpty() && !modulus[0]) 53 53 modulus.remove(0); 54 54 Vector<uint8_t> exponent; 55 if (!WTF::base64URLDecode(keyData.e .value(), exponent))55 if (!WTF::base64URLDecode(keyData.e, exponent)) 56 56 return nullptr; 57 if ( !keyData.d) {57 if (keyData.d.isNull()) { 58 58 // import public key 59 59 auto publicKeyComponents = CryptoKeyDataRSAComponents::createPublic(WTFMove(modulus), WTFMove(exponent)); … … 64 64 // import private key 65 65 Vector<uint8_t> privateExponent; 66 if (!WTF::base64URLDecode(keyData.d .value(), privateExponent))66 if (!WTF::base64URLDecode(keyData.d, privateExponent)) 67 67 return nullptr; 68 if ( !keyData.p && !keyData.q && !keyData.dp && !keyData.dp && !keyData.qi) {68 if (keyData.p.isNull() && keyData.q.isNull() && keyData.dp.isNull() && keyData.dp.isNull() && keyData.qi.isNull()) { 69 69 auto privateKeyComponents = CryptoKeyDataRSAComponents::createPrivate(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent)); 70 70 // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. … … 72 72 } 73 73 74 if ( !keyData.p || !keyData.q || !keyData.dp || !keyData.dq || !keyData.qi)74 if (keyData.p.isNull() || keyData.q.isNull() || keyData.dp.isNull() || keyData.dq.isNull() || keyData.qi.isNull()) 75 75 return nullptr; 76 76 CryptoKeyDataRSAComponents::PrimeInfo firstPrimeInfo; 77 77 CryptoKeyDataRSAComponents::PrimeInfo secondPrimeInfo; 78 if (!WTF::base64URLDecode(keyData.p .value(), firstPrimeInfo.primeFactor))78 if (!WTF::base64URLDecode(keyData.p, firstPrimeInfo.primeFactor)) 79 79 return nullptr; 80 if (!WTF::base64URLDecode(keyData.dp .value(), firstPrimeInfo.factorCRTExponent))80 if (!WTF::base64URLDecode(keyData.dp, firstPrimeInfo.factorCRTExponent)) 81 81 return nullptr; 82 if (!WTF::base64URLDecode(keyData.q .value(), secondPrimeInfo.primeFactor))82 if (!WTF::base64URLDecode(keyData.q, secondPrimeInfo.primeFactor)) 83 83 return nullptr; 84 if (!WTF::base64URLDecode(keyData.dq .value(), secondPrimeInfo.factorCRTExponent))84 if (!WTF::base64URLDecode(keyData.dq, secondPrimeInfo.factorCRTExponent)) 85 85 return nullptr; 86 if (!WTF::base64URLDecode(keyData.qi .value(), secondPrimeInfo.factorCRTCoefficient))86 if (!WTF::base64URLDecode(keyData.qi, secondPrimeInfo.factorCRTCoefficient)) 87 87 return nullptr; 88 88 if (!keyData.oth) { -
trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp
r209633 r212465 132 132 return nullptr; 133 133 } 134 // When an empty vector p is provided to CCRSACryptorCreateFromData to create a private key, it crashes. 135 // <rdar://problem/30550228> tracks the issue. 136 if (keyData.type() == CryptoKeyDataRSAComponents::Type::Private && keyData.firstPrimeInfo().primeFactor.isEmpty()) 137 return nullptr; 138 134 139 CCRSACryptorRef cryptor; 135 140 // FIXME: It is so weired that we recaculate the private exponent from first prime factor and second prime factor,
Note: See TracChangeset
for help on using the changeset viewer.