-
Notifications
You must be signed in to change notification settings - Fork 143
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
Exception has occurred. ArgumentError (Invalid argument(s): Invalid or corrupted pad block) #331
Comments
Same issue i am facing |
@YashSavsani |
@miraj98hossain No, right! Which version are you using? |
no it won't decrypt because iv is different. |
|
@Prashant4900 don't use base64.decode() rather try using Encrypted encryptedData = Encrypted.fromBase64(encryptedText); |
Still facing the same problem |
@Prashant4900 can you paste the full code ?? |
encrypter file import 'dart:developer';
import 'package:encrypt/encrypt.dart' as ec;
// Keys for encryption/decryption
final key = ec.Key.fromUtf8('37911490979715163134003223491201');
// final secondKey = encrypt.Key.fromUtf8('54674138327930866480207815084989');
final iv = ec.IV.fromUtf8('37911490979715163134003223491201');
// final iv = encrypt.IV.fromLength(16);
// final iv = ec.IV.allZerosOfLength(16);
// final iv = ec.IV(Uint8List(16));
final encrypter = ec.Encrypter(ec.AES(key));
String encryptAES(String plaintext) {
log('object1');
final encrypted = encrypter.encrypt(plaintext, iv: iv);
log('object2');
return encrypted.base64;
}
String decryptAES(String ciphertext) {
log('object-1');
final decrypted =
encrypter.decrypt(ec.Encrypted.fromBase64(ciphertext), iv: iv);
log('object-2');
return decrypted;
}
external file if (iframeResponse.statusCode == 200) {
final scriptElement = html_parser
.parse(iframeResponse.body)
.querySelector('script[data-name="episode"]');
if (scriptElement != null) {
final scriptDataValue = scriptElement.attributes['data-value'];
final id = iframeUri.queryParameters['id']!;
// print(0);
final url =
'https://embtaku.pro/encrypt-ajax.php?id=${encryptAES(id)}&alias=$id&${decryptAES(scriptDataValue!)}';
// print('url: $url');
final res = await http.get(
Uri.parse(url),
headers: {
'User-Agent': USER_AGENT,
'X-Requested-With': 'XMLHttpRequest',
},
);
log('res.body: ${res.body}');
}
} |
@Prashant4900
|
I believe the issue arises from using the incorrect key value. I attempted to convert this JavaScript code to Dart, and I assumed I needed to use the same key they were using. However, when I used that key, it caused the problem. Additionally, if both algorithms are the same, shouldn't they work with the same key? |
I am trying to implement this package.
this is my EncryptService
using this class i am encrypt the passwords and storing into the database.
while login i am trying to decrypting the password but it is showing
ArgumentError (Invalid argument(s): Invalid or corrupted pad block)
The text was updated successfully, but these errors were encountered: