| importScripts('../../../../resources/js-test-pre.js'); |
| importScripts('../../../resources/common.js'); |
| |
| description("Test decrypting using RSA-OAEP SHA-1 with an imported key and a label in workers"); |
| |
| jsTestIsAsync = true; |
| |
| var extractable = false; |
| var cipherText = hexStringToUint8Array("346dc8f3a158e494004cf82c0843ab1c1e7a612263a1c44d941309175a3d2598997be651f2d3419f89923843ca344414d45989e886aaa79573d96d4f3f777af3b2e9fcd44b51c00a8e4395bf54ac89d88559c712d49853de448e190fad886c45fa0742f2ddf18e5f6155eb7f38348217efd67c14ef141e81f3b1c1804b3bb437ef1b23a25dadb594985c500181208c74cd2068cbfdccc02db7113ed5e72d7a3543a78ec9c2070715e409ab10687762358f786c669e592e467107a13caaaadc3c341facf249baf743a3b93c49f73ea5634052f1a6ee46265e02391dd2cbcd4a523bfee8321470279fff63b87a4a53465b4736fb31ee99e9b0379761f3e630f636"); |
| var jwkKey = { |
| kty: "RSA", |
| alg: "RSA-OAEP", |
| use: "enc", |
| key_ops: ["decrypt", "unwrapKey"], |
| ext: true, |
| n: "lxHN0N9VRZ0_pl0xv3-NXx70WnjkODSkQ5LjHXTFy3DOQsvkagFzD9HqYQezCmcewLjdK5PLwSesDoMdfL6tusBHcvyit1kvydYFQ3NLbENNkYsiBG5_nW4IQGL6JKbZ5iGdUop98QHKm6YZR1u4zrAtxM6bVEo05VvhjRS0M8yWoZVi-7Vdsc0LqI0Qdq_NoctX5Fu-AqiBN7Uo1HkYGcP2oC82J_J5cjw98BQiP5kDWThq9RK-X6S-EUALx_m4iG6iOYKTA3SQyf1xBqFaXXoEJjcckbOqkegecz5b-YWUh8iZPvhwnt-RZwpIbLJgKwz19ndkn9KvoEEw7YbEow", |
| e: "AQAB", |
| d: "cj5DkDakjM2bKduGWJREO-_zyEtuA1dD9doqKMd7IRuA0CDS7puEAS20-oXRDwfmyMXEdEUDrGGtCxh6fzDPvs_T-JA3GUK4EgHo3xZcrlXDXlKCeil6Fnr0gISZOIh5dkBrcdVL4quBJe4ZZc5m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zomHfrxk", |
| }; |
| var rsaOaepParams = { |
| name: "rsa-oaep", |
| label: asciiToUint8Array("WebKit.org"), |
| } |
| var expectedPlainText = "Hello, World!"; |
| |
| crypto.subtle.importKey("jwk", jwkKey, {name: "RSA-OAEP", hash: "SHA-1"}, extractable, ["decrypt"]).then(function(key) { |
| return crypto.subtle.decrypt(rsaOaepParams, key, cipherText); |
| }).then(function(result) { |
| plainText = result; |
| |
| shouldBe("bytesToASCIIString(plainText)", "expectedPlainText"); |
| |
| finishJSTest(); |
| }); |