Open aahmadfarooq opened 6 years ago
Hello @aahmadfarooq
I am not sure if it helps but I had a similar issue with the same error and resolved it by enabling padding. Both the AES-CBC encryption and decryption have the padding flag in their constructor.
/**
* @param {Uint8Array} key
* @param {Uint8Array} [iv=null]
* @param {boolean} [padding=true]
* @param {Uint8Array} [heap]
* @param {Uint8Array} [asm]
*/
constructor(key, iv, padding, heap, asm) {
super(key, iv, padding, heap, asm);
}
Kind regards, Jérôme
Are you using padding? If not, you have process blocks of size N*16.
Hi, I have been trying to use "asmCrypto.AES_CBC.encrypt" function with the a 256 bit key and a varying length of data (since data cannot be limited and will be varying depending on request)
I was getting below error alot of time while invoking this: data length must be a multiple of the block size
And upon debug realized that the AES_Encrypt_finish function has a defined variable plen = 16 and raises the issue in code below:
else if ( len % 16 ) { throw new IllegalArgumentError("data length must be a multiple of the block size"); }