-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add aead_encrypt and aead_decrypt convenience functions #155
Add aead_encrypt and aead_decrypt convenience functions #155
Conversation
75fdf00
to
ca9a8e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two remarks:
- While I am not aware of any particular specification and there are cases with a different order, I would say the "usual" order is
nonce || ciphertext || tag
. So should we also maybe use that order here? - I absolutely agree, we should add such a util function. Especially since
associated_data
andtag
is hardly ever needed explicitly. However, I see this a bit differently for the nonce. There are common scenarios where the nonce is not chosen randomly, e.g. all-zero for ephemeral keys or derived from a hash. Good arguments can be made, why the nonce should still be explicit (like e.g. in crypto_secretbox_easy and libsodium is usually a great example for API design).
However, nonce selection is security critical. So, when this better fits the use-case your are having in mind, let's leave it like this and hide the nonce.
I kind of assumed that was the usual order as it has been chosen this way for the stronghold integration in the wallet. We obviously can't change it now. I would understand if choosing an arbitrary order was a no-go for an inclusion in crypto.rs
I am not fully certain what your conclusion is. Do you want me to make the nonce a parameter? |
If that order is already in use let's stick with it 👍 |
Done, let me know if this is fine. |
Change checklist
Add an
x
to the boxes that are relevant to your changes, and delete any items that are not.