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

Unified Diff: LayoutTests/crypto/hmac-legacy-empty-key.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/hmac-legacy-empty-key.html
diff --git a/LayoutTests/crypto/hmac-legacy-empty-key.html b/LayoutTests/crypto/hmac-legacy-empty-key.html
deleted file mode 100644
index 3f404af9f1f6e17793d7f42d268e80876cb46388..0000000000000000000000000000000000000000
--- a/LayoutTests/crypto/hmac-legacy-empty-key.html
+++ /dev/null
@@ -1,99 +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("Tests structured de-cloning of empty HMAC keys");
-
-jsTestIsAsync = true;
-
-// It used to be possible to import empty HMAC keys, so it is possible that
-// such keys were persisted to storage. This test verifies that such keys can
-// still be successfully de-serialized and used.
-//
-// The version number of the serialized format used is 7.
-
-function deserializeTestKeys()
-{
- function createKeyFromSerialized(serializedBytesHex)
- {
- return internals.deserializeBuffer(hexStringToUint8Array(serializedBytesHex).buffer);
- }
-
- debug("\nDeserializing empty HMAC SHA-1 key...");
- var sha1Key = createKeyFromSerialized("ff073f004b0200051900");
-
- key = sha1Key;
- shouldEvaluateAs("key.type", "secret");
- shouldEvaluateAs("key.extractable", true);
- shouldEvaluateAs("key.algorithm.name", "HMAC");
- shouldEvaluateAs("key.algorithm.length", 0);
- shouldEvaluateAs("key.algorithm.hash.name", "SHA-1");
- shouldBe("key.usages", '["sign", "verify"]');
-
- debug("\nDeserializing empty HMAC SHA-256 key...");
- var sha256Key = createKeyFromSerialized("ff073f004b0200061900");
-
- key = sha256Key;
- shouldEvaluateAs("key.type", "secret");
- shouldEvaluateAs("key.extractable", true);
- shouldEvaluateAs("key.algorithm.name", "HMAC");
- shouldEvaluateAs("key.algorithm.length", 0);
- shouldEvaluateAs("key.algorithm.hash.name", "SHA-256");
- shouldBe("key.usages", '["sign", "verify"]');
-
- return {
- sha1: sha1Key,
- sha256: sha256Key
- };
-}
-
-
-Promise.resolve(deserializeTestKeys()).then(function(result) {
- keys = result;
-
- debug("\ncalling verify() with a valid signature (SHA-1) ...");
- return crypto.subtle.verify("HMAC", keys.sha1, hexStringToUint8Array("fbdb1d1b18aa6c08324b7d64b71fb76370690e1d"), hexStringToUint8Array(""));
-}).then(function(result) {
- verifyResult = result;
- shouldEvaluateAs("verifyResult", true);
-
- debug("\ncalling verify() with an invalid signature (SHA-1) ...");
- return crypto.subtle.verify("HMAC", keys.sha1, hexStringToUint8Array("fbdb1d1b18aa6c08324b7d64b71fb76370690e1e"), hexStringToUint8Array(""));
-}).then(function(result) {
- verifyResult = result;
- shouldEvaluateAs("verifyResult", false);
-
- debug("\ncalling sign() (SHA-1) over empty input...");
- return crypto.subtle.sign("HMAC", keys.sha1, hexStringToUint8Array(""));
-}).then(function(result) {
- bytesShouldMatchHexString("signature", "fbdb1d1b18aa6c08324b7d64b71fb76370690e1d", result);
-
- debug("\ncalling verify() with a valid signature (SHA-256) ...");
- return crypto.subtle.verify("HMAC", keys.sha256, hexStringToUint8Array("b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad"), hexStringToUint8Array(""));
-}).then(function(result) {
- verifyResult = result;
- shouldEvaluateAs("verifyResult", true);
-
- debug("\ncalling verify() with an invalid signature (SHA-256) ...");
- return crypto.subtle.verify("HMAC", keys.sha256, hexStringToUint8Array("0000"), hexStringToUint8Array(""));
-}).then(function(result) {
- verifyResult = result;
- shouldEvaluateAs("verifyResult", false);
-
- debug("\ncalling sign() (SHA-256) over empty input...");
- return crypto.subtle.sign("HMAC", keys.sha256, hexStringToUint8Array(""));
-}).then(function(result) {
- bytesShouldMatchHexString("signature", "b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad", result);
-}).then(finishJSTest, failAndFinishJSTest);
-
-</script>
-
-</body>
-</html>
« no previous file with comments | « LayoutTests/crypto/hmac-import-jwk-expected.txt ('k') | LayoutTests/crypto/hmac-legacy-empty-key-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698