title: .Net Encryption
body: <p>What I would like to know is the definite approach to encrypting connection strings in a config file. Here are my questions:</p>
  
  <ol>
  <li><p>Using machine-level encryption, can't anybody accessing my server write a little .Net program to read the contents of the connection strings?</p></li>
  <li><p>If I am deploying my application to users machines in an enterprise environment, and the application has connection strings in a config file, how can I make sure only my application can decrypt it? The scenario is especially interesting in a ClickOnce deployment scenario. I've read about people storing the config unencrypted at the publisher server and encrypting at the machine level when the app is downloaded, installed and executed for the first time. This sounds so wrong to me - connection strings zipping unprotected through the wire, and sitting unprotected for a brief amount of time between download and application execution.</p></li>
  <li><p>Can I have a public and private key, sign my app, encrypt the config file with a key, and when the user executes it, decryption would only be possible from the signed application?</p></li>
  <li><p>Since I am using ClickOnce, I could have my encrypted sensitive information in the code or embedded, because ClickOnce won't detect a change unless the version # changes. So, if I need to recompile if I change my connection string, the point of an app.config is muted. What other approaches can I take, out-side using an config file, to achieve protection of the connection strings at the server, client and in between?</p></li>
  </ol>