security - Storing private keys in database -


I need to store a private key for multiple users, so that my server application can sign files on their behalf .

I want to safely store the private key, but I could not find the best practice around it. If I was collecting a password, then I havehes to create a salt + password hash which can not be easily returned to the password. However, with a private key I need to store it in such a way that I can get it later.

I was thinking that I would encrypt the private key and then store it in my database. I basically thought that each key would be encrypted with a different password (based on some user's qualities). However, those properties will probably be stored in the database, so if my database is leaked then the attacker has everything.

I can encrypt all private keys with a single password which is known only for my application. Then an attacker would have to steal my database, and I would have to apply to do any harm.

Is there any technique / best practice I am missing?

You can encrypt the private key with a symmetric key depending on the user password just an additional Store the salt and make the password "hash" to get a different key. Then use the key to encrypt the private key. Note that to create a secure password hash, password based key derived function (PBKDF) such as PBKDF2, Bitcript or Script is used to.

If a user is not online to generate a signature, you should actually protect the password that you can decrypt only you / our backoffice key. You can calculate the encryption / decryption key. For some user ID + you can use your secret key. You may also want to generate a separate RSA key pair for encryption decryption (using Hybrid Encryption).

Storing private keys on behalf of users is very dangerous. There are several ways to lose data or come up with a private key (eg, side-channel attacks). To make it professional, you should actually use an HSM in this process. If this is for any serious data, please consult a professional and a lawyer.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -