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

Unified Diff: LayoutTests/crypto/rsa-oaep-key-manipulation.html

Issue 806913006: [WebCrypto] Move LayoutTests from crypto to crypto/subtle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update path for deserialize legacy tests Created 6 years 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/rsa-oaep-key-manipulation.html
diff --git a/LayoutTests/crypto/rsa-oaep-key-manipulation.html b/LayoutTests/crypto/rsa-oaep-key-manipulation.html
deleted file mode 100644
index 83f6822f3837f0c5f375810d39289a4c7da8b9c2..0000000000000000000000000000000000000000
--- a/LayoutTests/crypto/rsa-oaep-key-manipulation.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!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, importing and exporting RSA keys for RSA-OAEP. Test that they can't be used with another algorithm.");
-
-jsTestIsAsync = true;
-
-var algorithmKeyGen = {
- name: "RSA-OAEP",
- hash: {name: "sha-1"},
- // RsaKeyGenParams
- modulusLength: 512,
- publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
-};
-var extractable = true;
-
-debug("Generating a key pair...");
-crypto.subtle.generateKey(algorithmKeyGen, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
- keyPair = result;
- shouldBe("keyPair.toString()", "'[object Object]'");
- shouldBe("keyPair.publicKey.type", "'public'");
- shouldBe("keyPair.publicKey.algorithm.name", "'RSA-OAEP'");
- shouldBe("keyPair.publicKey.algorithm.modulusLength", "512");
- shouldBe("keyPair.publicKey.usages", '["encrypt", "wrapKey"]');
- shouldBe("bytesToHexString(keyPair.publicKey.algorithm.publicExponent)", "'010001'");
- shouldBe("keyPair.publicKey.algorithm.hash.name", "'SHA-1'");
- shouldBe("keyPair.privateKey.type", "'private'");
- shouldBe("keyPair.privateKey.algorithm.name", "'RSA-OAEP'");
- shouldBe("keyPair.privateKey.algorithm.modulusLength", "512");
- shouldBe("keyPair.privateKey.usages", '["decrypt", "unwrapKey"]');
- shouldBe("bytesToHexString(keyPair.privateKey.algorithm.publicExponent)", "'010001'");
- shouldBe("keyPair.privateKey.algorithm.hash.name", "'SHA-1'");
-
- debug("\nTesting that the keys can't be used with different algorithms...");
- iv = hexStringToUint8Array("000102030405060708090a0b0c0d0e0f");
-
- return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.privateKey, hexStringToUint8Array("00"));
-}, failAndFinishJSTest).then(failAndFinishJSTest, function(result) {
- logError(result);
- return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.publicKey, hexStringToUint8Array("00"));
-}, failAndFinishJSTest).then(failAndFinishJSTest, function(result) {
- logError(result);
- debug("\nTrying to export keys to raw...");
- return crypto.subtle.exportKey('raw', keyPair.publicKey);
-}, failAndFinishJSTest).then(failAndFinishJSTest, function(result) {
- logError(result);
- testPassed("Promise rejected for exporting public key");
- return crypto.subtle.exportKey('raw', keyPair.privateKey);
-}).then(failAndFinishJSTest, function(result) {
- logError(result);
- testPassed("Promise rejected for exporting private key");
-
- debug("\nExporting public key to JWK...");
- return crypto.subtle.exportKey("jwk", keyPair.publicKey);
-}).then(function(result) {
- jwkPublicKey = result;
- shouldBe("jwkPublicKey.alg", "'RSA-OAEP'");
- shouldBe("jwkPublicKey.ext", "true");
- shouldBe("jwkPublicKey.key_ops", "['encrypt', 'wrapKey']");
- shouldBe("jwkPublicKey.use", "undefined");
- shouldBe("jwkPublicKey.kty", "'RSA'");
- shouldBe("bytesToHexString(Base64URL.parse(jwkPublicKey.e))", "'010001'");
-
- debug("\nImporting it back...");
- return crypto.subtle.importKey("jwk", jwkPublicKey, { name: "RSA-OAEP", hash: {name: "sha-1"} }, extractable, ["encrypt", "wrapKey"]);
-}).then(function(result) {
- exportedPublicKey = result;
- shouldBe("exportedPublicKey.type", "'public'");
- shouldBe("exportedPublicKey.algorithm.name", "'RSA-OAEP'");
- shouldBe("exportedPublicKey.algorithm.modulusLength", "512");
- shouldBe("bytesToHexString(exportedPublicKey.algorithm.publicExponent)", "'010001'");
- shouldBe("exportedPublicKey.algorithm.hash.name", "'SHA-1'");
- shouldBe("exportedPublicKey.extractable", "true");
- shouldBe("exportedPublicKey.usages", "['encrypt','wrapKey']");
-
-}).then(finishJSTest, failAndFinishJSTest);
-
-</script>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698