| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="../resources/common.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script> |
| description("Test decrypting using RSA-OAEP SHA-1 with an imported key"); |
| |
| jsTestIsAsync = true; |
| |
| var extractable = false; |
| var cipherText = hexStringToUint8Array("64ea45b5234b05666dc21ca6f7cd6ecb0be8ce4576c0bbe9686e70c9f3ab67a9f0a4db226554f217ba7259634c7b70eb422633277d83aeb2181a001099bacbca8b5b534a77843fe611f646838999e82e681f1d1724ef0e9f65ac3020128c56ea90a0345d936e8e226b363687c7b57146eecd4ab599760661a278671b5b249051b1f1720d6e78085e321ce82867df81a67b8606e340850b189fcd08d63b1ac8ce9a97300b8c15c3c475c97f1266606b48b67a15c28937d88e0749c83212737732c74a7fdf79188405c6df72b9ee2b753f4f70ae35f2f035c5827e0c87fcceeef1c4e303c0e89ecc76773fb58e6f5a06b792ae7a1b58ee7bf09893c8fd2b93da0d"); |
| 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-oXRDwfmyMXEdEU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xj9a8JfViuMCqzR-mL1rGIUQ5ARGhNcSsRlyKTqz5BlWlVKmXIx_p-DeVwPWiJJy4k_FqyBxrnxkzomHfrxk", |
| }; |
| var rsaOaepParams = { |
| name: "rsa-oaep" |
| } |
| 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(); |
| }); |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |