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

Comments

Projects
None yet
2 participants
@yejune

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

This comment has been minimized.

Member

sergeyklay commented May 16, 2018

 $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

This comment has been minimized.

yejune commented May 16, 2018

Sorry.

If it is not valid, it throws an exception.

@yejune yejune referenced this issue May 17, 2018

Closed

Using HMAC to prevent forgery in Crypt #13381

3 of 3 tasks complete

@sergeyklay sergeyklay added this to the 3.4.x milestone May 18, 2018

@sergeyklay

This comment has been minimized.

Member

sergeyklay commented May 28, 2018

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

@sergeyklay sergeyklay closed this May 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment