blob: 121e98d96c4dcf0f8d4a81f78ee89526c9649e4f [file] [log] [blame]
Test importing a key with malformed parameters
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS crypto.subtle.importKey() rejected promise with TypeError: Not enough arguments.
PASS crypto.subtle.importKey(1) rejected promise with TypeError: Not enough arguments.
PASS crypto.subtle.importKey(1, 2) rejected promise with TypeError: Not enough arguments.
PASS crypto.subtle.importKey(1, 2, 3) rejected promise with TypeError: Not enough arguments.
PASS crypto.subtle.importKey(1, 2, 3, 4) rejected promise with TypeError: Not enough arguments.
PASS crypto.subtle.importKey(1, rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Argument 1 ('format') to SubtleCrypto.importKey must be one of: "raw", "spki", "pkcs8", "jwk".
PASS crypto.subtle.importKey(true, rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Argument 1 ('format') to SubtleCrypto.importKey must be one of: "raw", "spki", "pkcs8", "jwk".
PASS crypto.subtle.importKey(null, rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Argument 1 ('format') to SubtleCrypto.importKey must be one of: "raw", "spki", "pkcs8", "jwk".
PASS crypto.subtle.importKey(undefined, rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Argument 1 ('format') to SubtleCrypto.importKey must be one of: "raw", "spki", "pkcs8", "jwk".
PASS crypto.subtle.importKey(Symbol(), rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Cannot convert a symbol to a string.
PASS crypto.subtle.importKey({ }, rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Argument 1 ('format') to SubtleCrypto.importKey must be one of: "raw", "spki", "pkcs8", "jwk".
PASS crypto.subtle.importKey("foo", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Argument 1 ('format') to SubtleCrypto.importKey must be one of: "raw", "spki", "pkcs8", "jwk".
PASS crypto.subtle.importKey("raw", jwkKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("raw", 1, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("raw", true, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("raw", null, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Member JsonWebKey.kty is required and must be an instance of DOMString.
PASS crypto.subtle.importKey("raw", undefined, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Member JsonWebKey.kty is required and must be an instance of DOMString.
PASS crypto.subtle.importKey("raw", Symbol(), "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("raw", { }, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Member JsonWebKey.kty is required and must be an instance of DOMString.
PASS crypto.subtle.importKey("raw", "foo", "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("jwk", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("jwk", 1, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("jwk", true, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("jwk", Symbol(), "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("jwk", { }, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Member JsonWebKey.kty is required and must be an instance of DOMString.
PASS crypto.subtle.importKey("jwk", "foo", "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS crypto.subtle.importKey("jwk", undefined, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Member JsonWebKey.kty is required and must be an instance of DOMString.
PASS crypto.subtle.importKey("jwk", null, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Member JsonWebKey.kty is required and must be an instance of DOMString.
PASS crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, [ ]) rejected promise with SyntaxError: A required parameter was missing or out-of-range.
PASS crypto.subtle.importKey("jwk", jwkPrivateKey, "rsaes-pkcs1-v1_5", extractable, [ ]) rejected promise with SyntaxError: A required parameter was missing or out-of-range.
PASS crypto.subtle.importKey("jwk", {kty: undefined}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Member JsonWebKey.kty is required and must be an instance of DOMString.
PASS crypto.subtle.importKey("jwk", {kty: "oct", key_ops: ["foo"]}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
PASS successfullyParsed is true
TEST COMPLETE