Suppose my .Net application which is installed in the client encrypts a data. I want to use a different key generated randomly for each client so each client doesn't know the key of the other.
Someone told me that storing it plain in a file is not good enough, and it's better to use a certificate to encrypt this key before storing it.
But I don't see the difference. If a hacker hacks to the client's computer and can copy the plain text key from the file, he can also get the private keys and certificates from the certificates store and use them to decrypt and get the original key.

  • To satisfy customers. Customers frown upon keys stored in plaintext as opposed to keys stored 'encrypted' on disk
    – sudhacker
    Commented Jul 15, 2013 at 18:14

2 Answers 2


This is a discussion which has been mentioned tons of times before on this website. You are correct in your statement saying that this merely obfuscates (so security by obscurity) the encryption key. Some people like to do it to make it a lot harder on attackers to get access to their keys. In the end you can only slow them down.

So what's the difference? Not a lot except you might gain a bit of time.

  • Thanks, I actually did some searches here and in the internet before posting but didn't find information about it.
    – ronenfe
    Commented Jul 15, 2013 at 13:06

Basically, what the client stores, the client stores. Layers of encryption will not prevent a local attacker from extracting the key. However, some weak attackers may be deterred to some point. Basically, you prefer it when locally stored secrets are protected by what the best that the OS may offer; in Windows contexts, this means DPAPI or even smart cards. With DPAPI, a successful attacker will need system-level access to the machine; with smart cards, the attacker will also need to subvert the machine inconspicuously and grab secrets while the normal user applies his card. That's not 100% protection and motivated attackers will get through these layers, but it is better than nothing.

The tricky point, however, is that such infrastructures have been designed for use with asymmetric keys and certificates. So you do not want to use a certificate for the sake of asymmetric encryption; you want to use a certificate because, in practice, that's what it takes to benefit from the best local protection functionalities.

(But don't believe that "best" means "good".)

You must log in to answer this question.

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