We are using nodejs V12.22 Crypto library to decode "AES-256 with 128bit counter". Decrypted buffer nearly OK but has bad bytes "ef bf bd" output

Viewed 49

Using following code:

algarithm = 'aes-256-ctr';
key = Buffer.from

  const decrypter = cryptoObject.createDecipheriv(algorithm, key, iv);

  let decryptedMsg = decrypter.update(encryptedMsg, 'hex', 'utf8');

  console.log('First decrypt ');
  console.log(Buffer.from(decryptedMsg));
  console.log(`Decrypted type ${typeof decryptedMsg}`);

  decryptedMsg += decrypter.final('utf8');

The buffer object contains : 4a 00 00 00 15 ef bf bd ef bf bd 05 26 ef bf bd 15 63 50 00 01 00 23 ef bf bd -------------- ================= This is OK this is ?FFFD & wrong.

Why the is decrypt inserting ef bf bd?

All help appreciated. Thank you

0 Answers
Related