Are there any reference patterns for .Net server applications relating to storing and retrieving sensitive per user information such as 3rd party credentials?
My preliminary design thoughts are along the lines of:
- Generate a self signed X509 certificate with appropriately strong private key,
- Export the certificate and key and store them on a USB key which will be locked in a treasure chest and guarded by dragons,
- Design my server applications to request the private key on demand from the windows current user certificate store,
- When installing the server application on a new server retrieve the USB key and import the certificate and and mark the private key as non-exportable.
My requirements are:
- Reduce the risk as much as possible of user's sensitive information getting compromised if the storage medium is compromised. In my case the storage medium could be a relational database or Amazon's SimpleDB,
- Reduce the risk of user's sensitive information getting compromised if the .Net server's host operating system, in this case Window's Data Center Edition, is compromised.
Update 3. Forgot to mention being able to rekey on a periodic basis is a requirement so that the same prviate encryption key isn't used for 10 years.
Problems:
- If the host operating system is compromised an attacker could install a malicious application to perform the same decryption operations as my .Net server.
Update Thinking about an OS compromise some more I realise there's nothing that can be done if a skilled attacker gains access but the keys should be protected from a malcontent administrator, i.e. it's more than a matter of opening a file or registry key to extract the private key.
I'm sure this problem has been solved a thousand times already, more than happy for a link answer, but searching on "security encryption" type topics is low signal high noise.