This repository was archived by the owner on Oct 5, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
It is not a best security practice to utilise a key for both encryption and HMAC. Although there is no significant breach in the default CTR mode, a user unwittingly changing $_mode to CBC falls into a known exploit [1]/
The system proposed involves using PBKDF to break them the key into two - to "derive" as it's designed to. Although the salts are hardcoded in this patch, we are not using this to hash passwords, and this approach is within practices used by other projects [2].
Along the way I have increased the unit testing of the Crypto class.
The work order of 1000 on the HMAC only slows down the integrity check, as any key derivation should be done on the key itself.
Finally, I note that my build is failing a Travis-ci test on the Authy class[3]. I did not touch this class and will open an issue for it. I can't see where I caused this, although I'm happy to eat my words if wrong.
[1] http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx
[2] https://github.com/jamesyonan/jacs/blob/master/README.md
[3] https://travis-ci.org/technion/phpSec/jobs/24867427