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

Generating a salt for key derivation #22

Closed
robert-cronin opened this issue May 7, 2020 · 4 comments
Closed

Generating a salt for key derivation #22

robert-cronin opened this issue May 7, 2020 · 4 comments
Assignees
Labels
development Standard development

Comments

@robert-cronin
Copy link
Contributor

Should we be generating a salt for our key derivation in Crypto?

We could do it by generating some random bytes:
const salt = crypto.randomBytes(128).toString('base64')
I am not sure how one would store this though, we should also consider having multiple salts as well and storing the number of attempts. Or do we leave it up to the user to provide the salts?

@robert-cronin
Copy link
Contributor Author

Here are some recommendations from NIST for GCM and GMAC. It is recommended to restrict the IV to a length of 96 bits (12 bytes) to support interoperability and some other factors.

Here is a good example of file encryption with AES-GCM and salt based key derivation in nodejs: https://gist.github.com/AndiDittrich/4629e7db04819244e843. I think this is a good example to follow. We are also missing the auth tag and cipher.final() from our implementation which are essential to adhering to the AES-GCM standard.

@robert-cronin
Copy link
Contributor Author

this was solved in #23

@CMCDragonkai
Copy link
Member

Just remember that the details for how we did the AES GCM should be documented so it can be more easily verified.

@robert-cronin
Copy link
Contributor Author

I have put some notes into the README along this line

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

No branches or pull requests

2 participants