I want to apply AES/GCM/NoPadding Encryption and Decryption in my Flutter Application
The Use-case : i will encrypt some String and send it to server and server will decrypt and process it and will send me updated encrypted data and again i will decrypt it to process it.
And i have tried exploring cryptography, cryptography_flutter, encrypt and pointycastle.
but not found any clear documentation where i can apply AES/GCM/NoPadding for encryption.
And i cannot apply AES/CBC/PKCS5PADDING or AES/CBC/PKCS7PADDING as the point stucks under APPSEC.
Can anyone please help how can i perform AES/GCM/NoPadding Encryption and Decryption in Flutter/Dart.
Thanks in advance.
2
Answers
This is a simple string encryption (and decryption) using PointyCastle in Dart/Flutter. As commented by @Topaco, you should consider using a secure key derivation like PBKDF2:
AES/GCM/NoPadding is a particular encryption mode for AES that not only encrypts data but also guarantees the message’s integrity and validity. It is frequently used for secure data transfer. Nevertheless, AES/GCM/NoPadding are not natively supported by the default dart: crypto library. The Pointycastle library can be used to perform encryption and decryption using AES/GCM/NoPadding. The cryptographic features offered by this library are created specifically for Dart programming.