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

Verify if the key is correct and check the hmac of the payload #45

Closed
jeffli678 opened this issue Feb 26, 2020 · 2 comments · Fixed by #46
Closed

Verify if the key is correct and check the hmac of the payload #45

jeffli678 opened this issue Feb 26, 2020 · 2 comments · Fixed by #46

Comments

@jeffli678
Copy link
Contributor

jeffli678 commented Feb 26, 2020

I found this repo after I made my own ad-hoc implementation. The code here is well-structured. However, it seems you do not check if the key supplied by the user is correct before decrypting the file. Also, the hmac of the encrypted payload is not verified.

I have implemented them according to the spec. When I have some time, I will submit a pull request with these two features added.

As for Agile, one can verify if the key is correct using "encryptedVerifierHashInput" and "encryptedVerifierHashValue". And verify the hmac of the payload using "encryptedHmacKey" and "encryptedHmacValue". I did not check other cryptos supported by this repo.

@nolze
Copy link
Owner

nolze commented Feb 27, 2020

Thanks! That would be nice.

FYI, key verification has been implemented for some encryption method, e.g.,

def verifykey(key, encryptedVerifier, encryptedVerifierHash):

I think key verification may be skipped by default but can be enforced in the strict mode or the like (or otherwise, enabled by default and skipped with the force option.)

@jeffli678
Copy link
Contributor Author

jeffli678 commented Feb 27, 2020

Thanks for letting me know! I did not notice it. I only searched the code of agile crypto and found nothing. It looks they are quite similar. (Update: the idea is similar, but of course the implementation differs)

My intuition is we check the password and verify the integrity by default. Meantime, we allow the decryption to proceed even if the check fails, which is also the default. I will think about it later.

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

Successfully merging a pull request may close this issue.

3 participants
@nolze @jeffli678 and others