I need to store really sensitive data in a client-hosted database. Since there's no way I can protect this database (because I don't own it), my idea was to encrypt it by using the user's password, so only the user with his own password can access to his own information.

But I'm a bit worried for known plaintext attacks: If an attacker knows what DB I'm using, he will know patterns in the content which maybe they can use to get sensitive data and/or the user's password.

Then the idea I had is: Let's encrypt user's sensitive data with his password before it's stored in the DB and, as I also want to protect secondary information such as number of rows for each table, encrypt that DB with a Key = Hash(Salt + Same user password). This way, an attacker with a known plaintext attack can get the DB structure and/or the salted hash, but then it will need to figure out the user's password in order to access sensitive data.

But now I wonder... Am I reusing the same password twice? May it make it easier to find the original password by doing what I'm doing here? Is it really that useful for what I'm trying to achieve or should I just encrypt the DB once?

  • 1
    just use an encryption that isn't susceptible to preimage, like AES-GCM. – dandavis Jul 29 '18 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.