decryptPushWithAes method
Implementation
String decryptPushWithAes(String key, String encrytedData) {
int paddingCount = 4 - (key.length % 4);
if (paddingCount == 4) {
paddingCount = 0;
}
final paddedKey = key.padRight(key.length + paddingCount, "=");
final decodedKey = Uint8List.fromList(base64Decode(paddedKey));
final decodedData = Uint8List.fromList(base64Decode(encrytedData));
final ebcCipher = ECBBlockCipher(AESEngine());
final PaddedBlockCipherImpl paddedCipher =
PaddedBlockCipherImpl(PKCS7Padding(), ebcCipher);
final cipher = paddedCipher
..init(
false,
PaddedBlockCipherParameters(KeyParameter(decodedKey), null),
);
final decrypted = cipher.process(decodedData);
return String.fromCharCodes(decrypted);
}