Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I keep getting unrecognizable characters when I decrypt an encryption from crypto-js #302

Open
abdimussa87 opened this issue Jun 7, 2023 · 1 comment

Comments

@abdimussa87
Copy link

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

@ifeanyi-earnipay
Copy link

ifeanyi-earnipay commented Mar 6, 2024

@abdimussa87 Did you get a solution for this? @leocavalcante

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants