Test AES-CBC encrypt and decrypt functions.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


Importing a raw AES key from string literal...
PASS key.type is 'secret'
PASS key.extractable is true
PASS key.algorithm.name is 'AES-CBC'
PASS key.algorithm.length is 128
PASS key.usages is ['decrypt', 'encrypt']
Using the key to encrypt plaintext...
PASS bytesToHexString(new Uint8Array(encryptionResult)) is '7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a917678b273bed6b8e3c1743b7116e69e222295163ff1caa1681fac09120eca307586e1a78cb82807230e1321d3fae00d18cc2012'
Decrypting it back...
PASS new Uint8Array(decryptionResult) is plaintext
Testing initialization vector bindings...
PASS crypto.subtle.encrypt({name: 'AES-CBC', iv: null}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
PASS crypto.subtle.encrypt({name: 'AES-CBC'}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
PASS crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
PASS crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array([0])}, key, plaintext) threw exception Error: AES-CBC initialization data must be 16 bytes.
PASS successfullyParsed is true

TEST COMPLETE

