0

So I encrypted a value using crypto-js on my backend like this :

const encryptedValue = CryptoJS.AES.encrypt(
            JSON.stringify(data),
            process.env.ENCRYPTION_KEY
          );

Then I try to decrypt it using this in my flutter app:

class CustomEncryption {
  static final encryptionKey = Key.fromUtf8('quZ2z5Fe42vci3teZmMIxtPxtdPtTSMQ');
  static final iv = IV.fromLength(16);

  static String decrypt(String data) {
    final encrypter = Encrypter(AES(
      encryptionKey,
      mode: AESMode.cbc,
      padding: null,
    ));
    final decrypted = encrypter.decrypt64(data, iv: iv);

    return decrypted;
  }
}

But this is returned g��ԩ�����R\��{�+�ziN

Abdi mussa
  • 171
  • 11
  • 1
    Does this answer your question [Decrypt AES]("https://stackoverflow.com/questions/54864320/decrypt-aes-input-on-flutter-when-on-web-use-cryptojs-aes") – Sowat Kheang Jun 08 '23 at 06:30

0 Answers0