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

CryptoJS.AES.decrypt returning value even when incorrect password entered #456

Open
terran6 opened this issue May 26, 2023 · 1 comment
Open

Comments

@terran6
Copy link

terran6 commented May 26, 2023

I have an expectation that the below decrypt function should return either an error or an empty string if an incorrect password is entered.

However, there are certain circumstances where this function will return a short string of a single character for certain combinations of user-inputted characters even though it may not be the correct password.

Could you explain why this function returns a value instead of an empty string or an error? Thank you!

    const decrypted = CryptoJS.AES.decrypt(encrypted, key, {
      iv: iv,
      padding: CryptoJS.pad.Pkcs7,
      mode: CryptoJS.mode.CBC,
    }).toString(CryptoJS.enc.Utf8);
@SatoshiMota
Copy link

I now have such a problem, I came up with a bunch of methods and nothing helps, I wonder what dodik thought of not processing the wrong password. Because of this + hatred for the library and I'll go take a normal one that can handle errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants