I am using user client TLS certificates (from smartcards) to authenticate on a web program. The users store data on the server and I would like to encrypt the stored data to protect the information if the database is compromised. I would like to not store the data in plaintext.

What are recommended methods to encrypting or protecting the data at rest? I don't believe that I can use the smartcard private key to decrypt the data as it is stuck on the client side and inaccessible to the server. The users' sole method of authentication is by smart card so I cannot use a normal 'user password' as a encryption key. I am using Go as the web server, but a solution in any language is good.

UPDATE: The type of compromise I am thinking of is an attacker getting a full database dump. I would like to encrypt the data in a Redis database at the level of the “value” of the key/value storage. An example would be encrypting certain sensitive datas using the user’s password (if I was using passwords) so that only the user supplied password will successfully decrypt the data.

I am not looking for an OS or database wide encryption as the database is hosted by a third party. The user accesses the web app over HTTPS and the web app program communicates with the database. I know that IE has the S/MIME plugin that allows use of client smart card to decrypt email in Outlook online but that is basically a client side program.

Any suggestions?

User platforms targeted are Windows, OS X, Linux

User browsers targeted are IE, Chrome

  • The attack vector you have in mind is unclear. If you fear that the whole server itself gets compromised all encryption and decryption should be done on the client side using client side code only. If you only fear that the attacker might get access to the database encryption could be done in the server accessing the database etc. And while you could try to implement the most secure solution it will often be the one with the highest implementation and maintenance costs and the lowest usability. Thus, clearly define what kind of attacks you expect to get useful help in how to address the risk. Commented Oct 28, 2017 at 8:03
  • @Steffen, I have updated my question to be more specific on the type of compromise.
    – ansonl
    Commented Oct 28, 2017 at 11:09

1 Answer 1


An easy way is to enable BitLocker, FileVault, and equivalent in Linux. If someone steals your machine or disk, the data is encrypted. It is done at the OS level, so you do not need to make any changes to your applications.

This is very effective esp. with legacy databases, file stores, and applications.

If you are concerned about DB compromised remotely on a machine that is already unlocked and running, then the same can happen with your application. So you will need to threat model and figure out why the attacker who can compromise your DB cannot compromise your application and use it to get the data in the decrypted form.

  • Hi @Omer, thanks for the answer, I might not have been specific enough in my question so I have updated it. I am only trying to ensure the confidentiality of data if a database dump is performed and not concerned with the attack that enables the dump. (If anything, it is as if the database were readable by anyone public. I would like to store the data contents so that someone with read access but not the users smart card can understand the data.)
    – ansonl
    Commented Oct 28, 2017 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .