How To Encrypt Data Using AES With CBC Mode And PCS5Padding Status In Dart?
I need to encrypt some data with AES and CBC mode, PCS5Padding status in dart. I searched but I haven't found any package in pub.dev with PCS5Padding status. I tried the below code but encryption here with PCS7Padding not PCS5Padding using encrypt package.
List plainTranData = [JSON data];
final iv = IV.fromUtf8(vector value);
final key = Key.fromUtf8(key);
final encrypter = Encrypter(AES(key, mode: AESMode.cbc));
final encrypted = encrypter.encrypt(plainTranData.toString(), iv: iv);
print(encrypted.base16); // <-- encrypted data in Hex/base16
Answer
As Richard Heap notes in the comments, there's no practical difference between them. PKCS5 is really just a special case of PKCS7. In many cases, implementations that call themselves "PKCS5" actually implement PKCS7. (This shouldn't be taken to mean that the "5" and "7" here are version numbers. They're not. They refer to specific Public Key Cryptography Standards documents. Two somewhat unrelated documents include the same basic padding strategy. There is no document devoted just to this padding strategy.)
For more details on this, see What is the difference between PKCS#5 padding and PKCS#7 padding on crypto.se.
Related Questions
- → How do you create a 12 or 24 mnemonics code for multiple cryptocurrencies (ETH, BTC and so on..)
- → Flutter: input text field don't work properly in a simple example..... where am I wrong?
- → Can I customize the code formatting of Dart code in Atom?
- → Is it possible to develop iOS apps with Flutter on a Linux virtual machine?
- → Display SnackBar in Flutter
- → JSON ObjectMapper in Flutter
- → Material flutter app source code
- → TabBarSelection No such method error
- → How do I set the animation color of a LinearProgressIndicator?
- → Add different routes/screens to Flutter app
- → Is there a way to get the size of an existing widget?
- → How to share a file using flutter
- → Is there an easy way to find particular text built from RichText in a Flutter test?