I am trying to think of a scheme that would allow a user to authenticate to a server, whithout sending the password to the server, and to also derive a symetric key on the client (that also never gets sent to the server), the sym key would be used to encrypt and decrypt data on the client,that gets saved encrypted on the server.
The question is: how robust is the following scheme ?
- authenticate without sending the password to the server
- derive a symetric key from the password, that never gets sent to the server
- store data on the server encrypted with
On the client:
symKey = scrypt(password, salt) authKey = scrypt(symKey, salt)
On the server:
// when the account is created, the server hashes authKey // again, and saves it with its salt authHash = scrypt(authKey, salt2) database.save([userId, authHash, salt2])
the user then encrypts data using symKey, that gets saved on the database:
userRowInDatabase[id, authHash, salt2, dataEncryptedWith(symKey)]
- hasing would be done with Scrypt
- Symetric encryption would be done with TweetNACL Secretbox (Based on XSalsa20 stream cipher and Poly1305 one-time authenticator)