Skip to content
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

Invalid argument(s): Error Input buffer too short #192

Closed
kttary opened this issue Feb 7, 2021 · 7 comments
Closed

Invalid argument(s): Error Input buffer too short #192

kttary opened this issue Feb 7, 2021 · 7 comments
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@kttary
Copy link

kttary commented Feb 7, 2021

I'm translating AES encryption from java to flutter using encrypt. Here is my flutter code:

final String initVectorClient = "1234567811111111";
final String keyClient = "4456445699999999";
final key = Key.fromUtf8(keyClient);
final iv = IV.fromUtf8(initVectorClient);
final encrypter = Encrypter(AES(key, mode: AESMode.cbc, padding: null));

String result = encrypter.encrypt("8EQEKSOQ", iv: iv).base64;

unfortunately the last line give me an error Invalid argument(s): Error Input buffer too short. I couldn't find my mistake. Pls help

@leocavalcante leocavalcante self-assigned this Feb 7, 2021
@leocavalcante leocavalcante added the duplicate This issue or pull request already exists label Feb 7, 2021
@leocavalcante
Copy link
Owner

Please, see #10

@kttary
Copy link
Author

kttary commented Feb 7, 2021

i tried to 8 character long as string input '8EQEKSOQ8EQEKSOQ' and it encrypted succesfully. However, given the same iv and key both in java and flutter gave me different result.

// Java Result::::: TS/xuuBrzKeqVrFLBb/dzqcNLLozx1uzEep6VS5C2Kw=
// Flutter Result:: TS/xuuBrzKeqVrFLBb/dzg==

any clue?

@kcibdev
Copy link

kcibdev commented Jan 23, 2022

i tried to 8 character long as string input '8EQEKSOQ8EQEKSOQ' and it encrypted succesfully. However, given the same iv and key both in java and flutter gave me different result.

// Java Result::::: TS/xuuBrzKeqVrFLBb/dzqcNLLozx1uzEep6VS5C2Kw=
// Flutter Result:: TS/xuuBrzKeqVrFLBb/dzg==

any clue?

Any update on your problem? did you finally solve it

@kttary
Copy link
Author

kttary commented Jan 24, 2022

luckily i have flexibility to use PKCS7 instead of zero padding

@kcibdev
Copy link

kcibdev commented Jan 24, 2022

luckily i have flexibility to use PKCS7 instead of zero padding

Please can you show how you did. Thank you

@kttary
Copy link
Author

kttary commented Jan 24, 2022

what have you done?

@kcibdev
Copy link

kcibdev commented Jan 24, 2022

what have you done?

Oh don't worry i finally found the solution
I used the same unique generated key for both IV and Key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants