title: Securely storing (encrypting) data in an ASP.Net application
body: <p>I have an asp.net application, accessed by people over the internet using web browsers.  It runs on a web server and it talks to a backend database.</p>
  
  <p>Some of the users would like to use the application to store some private data.  The requirements of this are:</p>
  
  <p>1) Only the user who stored the data should be able to see it.</p>
  
  <p>2) The developers/dbas should not be able to see the data.</p>
  
  <p>3) If the web server and database server were compromised a hacker must not be able to decrypt the data.</p>
  
  <p>So, it's obvious I'm going to have to encrypt this data.  If I encrypt it there will be a key somewhere and probably a salt/IV.  The question is where do I store the data which is used to perform the decryption?  If I store it in the database or the web server then a developer, dba or hacker can access it and decrypt the data.</p>
  
  <p>I think my ideal solution to this would be for the private key to be on the clients machine, that way they are entirely responsible for it.  But I'm not sure of how to go about this with an asp.net web application.</p>
  
  <p>I believe I can create a certificate which also stores a private key (PFX).  The client companies could use group policy to deploy the certificate to their domain.  But it is possible that the ASP.Net application can request the web browser to send the private key to it so that it can perform the decryption?  Decrypting on the client would be best but other than creating something in javascript I don't see how this is possible.</p>
  
  <p>Any advice welcome.</p>