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

Why does not Crypt check hmac? #13379

Closed
yejune opened this issue May 16, 2018 · 3 comments
Closed

Why does not Crypt check hmac? #13379

yejune opened this issue May 16, 2018 · 3 comments
Labels
bug A bug report status: low Low
Milestone

Comments

@yejune
Copy link

yejune commented May 16, 2018

Why does not Crypt check hmac?

When decrypting an encrypted character, entering a different key will return an incorrect decryption character.

 $text = 'This is a secret text';

 $key       = 'le password';
 $encrypted = $crypt->encrypt($text, $key);

 $key       = 'le password2';
 echo $crypt->decrypt($encrypted, $key);

result:

���0�Pz�@��/x���'�t��

If hmac is checked and is not valid, an empty string must be returned.

@sergeyklay
Copy link
Contributor

 $text = '';

 $key       = 'le password';
 $encrypted = $crypt->encrypt($text, $key);

 $key       = 'le password2';
 echo $crypt->decrypt($encrypted, $key);

Is it correct behavior if decrypt will return an empty string here?

@yejune
Copy link
Author

yejune commented May 16, 2018

Sorry.

If it is not valid, it throws an exception.

@sergeyklay
Copy link
Contributor

Fixed in the 3.4.0 version. Feel free to open a new issue if the problem appears again. Thank you for contributing.

@niden niden added bug A bug report status: low Low and removed Bug - Low labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
None yet
Development

No branches or pull requests

3 participants