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

Unified Diff: LayoutTests/crypto/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html

Issue 298023002: [webcrypto] Import WebKit's webcrypto tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove FIXME for unrecognized jwk usages (supported now) Created 6 years, 6 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
Index: LayoutTests/crypto/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html
diff --git a/LayoutTests/crypto/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html b/LayoutTests/crypto/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html
new file mode 100644
index 0000000000000000000000000000000000000000..e34dc4c9ff134d6f416d76bc869a7632ee4b2229
--- /dev/null
+++ b/LayoutTests/crypto/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/js-test.js"></script>
+<script src="resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test generating an RSA key pair for RSASSA-PKCS1-v1_5 when exponent has leading zeroes.");
+
+jsTestIsAsync = true;
+
+var algorithmKeyGen = {
+ name: "RSASSA-PKCS1-v1_5",
+ hash: {name: "sha-256"},
+ // RsaKeyGenParams
+ modulusLength: 2048,
+ publicExponent: new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01]), // Equivalent to 65537
+};
+var extractable = true;
+
+debug("Generating a key pair...");
+crypto.subtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then(function(result) {
+ keyPair = result;
+ shouldBe("keyPair.toString()", "'[object KeyPair]'");
+ shouldBe("keyPair.publicKey.type", "'public'");
+ shouldBe("keyPair.publicKey.algorithm.name", "'RSASSA-PKCS1-v1_5'");
+ shouldBe("keyPair.publicKey.algorithm.modulusLength", "2048");
+ shouldBe("bytesToHexString(keyPair.publicKey.algorithm.publicExponent)", "'010001'");
+ shouldBe("bytesToHexString(keyPair.privateKey.algorithm.publicExponent)", "'010001'");
+ shouldBe("keyPair.publicKey.usages", '["verify"]');
+
+ shouldBe("keyPair.privateKey.type", "'private'");
+ shouldBe("keyPair.privateKey.algorithm.name", "'RSASSA-PKCS1-v1_5'");
+ shouldBe("keyPair.privateKey.algorithm.modulusLength", "2048");
+ shouldBe("keyPair.privateKey.usages", '["sign"]');
+}).then(finishJSTest, failAndFinishJSTest);
+</script>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698