Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Encryption between platforms #327

Description

@blob84

If I encrypt from windows, browser or native, app doesn't decrypt on android.
If I encrypt from linux, app does decrypt succesfully on android.
Do you know how to create functions, encrypt and decrypt, platform independent?

Here the code:

String encryptAES(String originalText, Key secretKey) {
  final encrypter = Encrypter(AES(secretKey, mode: AESMode.cbc));
  final encrypted = encrypter.encrypt(originalText, iv: IV.fromLength(16));
  return encrypted.base64;
}

String decryptAES(String encryptedText, Key secretKey) {
  final encrypter = Encrypter(AES(secretKey, mode: AESMode.cbc));
  final encrypted = Encrypted.fromBase64(encryptedText);
  final decrypted = encrypter.decrypt(encrypted, iv: IV.fromLength(16));
  return decrypted;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions