blob: f0295e3484ab832c617fdae91cbf070bfbffea29 [file] [log] [blame]
CONSOLE MESSAGE: AES-CBC and AES-CTR do not provide authentication by default, and implementing it manually can result in minor, but serious mistakes. We recommended using authenticated encryption like AES-GCM to protect against chosen-ciphertext attacks.
Test encrypting using AES-CBC/AES-CFB with malformed parameters
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS crypto.subtle.encrypt("aes-cbc", key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of (ArrayBufferView or ArrayBuffer).
PASS crypto.subtle.encrypt({name: "aes-cbc"}, key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of (ArrayBufferView or ArrayBuffer).
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: true}, key, plainText) rejected promise with TypeError: Type error.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: 1}, key, plainText) rejected promise with TypeError: Type error.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: null}, key, plainText) rejected promise with TypeError: Type error.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: undefined}, key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of (ArrayBufferView or ArrayBuffer).
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: Symbol()}, key, plainText) rejected promise with TypeError: Type error.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: { }}, key, plainText) rejected promise with TypeError: Type error.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: "foo"}, key, plainText) rejected promise with TypeError: Type error.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, plainText) rejected promise with OperationError: The operation failed for an operation-specific reason.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, plainText) rejected promise with OperationError: The operation failed for an operation-specific reason.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText) rejected promise with OperationError: The operation failed for an operation-specific reason.
PASS crypto.subtle.encrypt("aes-cfb-8", key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of (ArrayBufferView or ArrayBuffer).
PASS crypto.subtle.encrypt({name: "aes-cfb-8"}, key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of (ArrayBufferView or ArrayBuffer).
PASS crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("")}, key, plainText) rejected promise with OperationError: The operation failed for an operation-specific reason.
PASS crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("j")}, key, plainText) rejected promise with OperationError: The operation failed for an operation-specific reason.
PASS crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText) rejected promise with OperationError: The operation failed for an operation-specific reason.
PASS successfullyParsed is true
TEST COMPLETE