Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I have a column in my database that I need to encrypt. The column can contain any arbitrary data.

What I am thinking is to generate a public and private key pair first. Store the public key in a configuration file and store the private key securely.

After that, for each row of data that I need to encrypt,

  1. Generate a cryptographically secure Key and IV
  2. Encrypt the data using the generated symmetric key
  3. Encrypt the symmetric key with the public key
  4. Store encrypted data, IV, encrypted symmetric key in the database

When I want decrypt it back,

  1. Decrypt symmetric key using private key
  2. Decrypt data using decrypted symmetric key and IV

Questions

  1. Is this asymmetric + symmetric key management needless?
  2. Is it good enough if I just encrypt and decrypt only by using asymmetric cryptography? If the length of data is small, is it ok ?
  3. Is storing the encrypted key in database a risk?
share|improve this question

closed as too broad by Adnan, Terry Chia, NULLZ, TildalWave, Xander Aug 24 '13 at 13:44

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
This is a too-specific question dressed as a legitimate one. Ironically, because your question can only be answered case-by-case, the answers would be too big for this site, so I voted to close as too broad. –  Adnan Aug 24 '13 at 6:37

1 Answer 1

In both steps, encryption and decryption, your application will be accessing the keys to access the data. More so, in the decryption case you'll have to find a way to securely access the supposedly securely-stored private key.

I see no point of using asymmetric cryptography. Use symmetric crypto (AES), store that key securely, and use that key to encrypt/decrypt your data.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.