Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures.html

Issue 289073005: [webcrypto] Hook up parameter normalization for RSA-OAEP. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures.html
diff --git a/LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures.html b/LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures.html
new file mode 100644
index 0000000000000000000000000000000000000000..d0a3c3f0a80e19bba338e2dbae52226630274579
--- /dev/null
+++ b/LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/js-test.js"></script>
+<script src="resources/common.js"></script>
+<script src="resources/keys.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Tests bad algorithm inputs for RSA-OAEP encrypt");
+
+jsTestIsAsync = true;
+
+var data = new Uint8Array(16);
+
+function importPublicKey()
+{
+ var usages = ['encrypt'];
+ var extractable = true;
+
+ var importData = hexStringToUint8Array(kKeyData.rsa1.spki);
+ var importAlgorithm = { name: 'rsa-oaep', hash: {name: 'SHA-256'} };
+
+ return crypto.subtle.importKey('spki', importData, importAlgorithm, extractable, usages);
+}
+
+Promise.resolve(null).then(function(result) {
+ return importPublicKey();
+}).then(function(result) {
+ publicKey = result;
+
+ shouldEvaluateAs("publicKey.algorithm.name", "RSA-OAEP");
+ shouldEvaluateAs("publicKey.algorithm.hash.name", "SHA-256");
+ shouldEvaluateAs("publicKey.type", "public");
+ shouldEvaluateAs("publicKey.extractable", true);
+ shouldEvaluateAs("publicKey.usages.join(',')", "encrypt");
+
+ return crypto.subtle.encrypt({name: "rsa-oaep", label: -1}, publicKey, data);
+}).then(failAndFinishJSTest, function(result) {
+ logError(result);
+
+ return crypto.subtle.encrypt({name: "rsa-oaep", label: "foo"}, publicKey, data);
+}).then(failAndFinishJSTest, function(result) {
+ logError(result);
+}).then(finishJSTest, failAndFinishJSTest);
+
+</script>
+
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698