Blade3
Blade3

Reputation: 4380

Encrypting App.config file when app is installed in Program Files

I have an app that will not run if the connection string in app.config is encrypted AND the app is installed in Program Files. The connection string section is encrypted as a post build event so it is deployed already encrypted. I know there are limits on what an app can do when installed in Program Files, but I don't understand why this is one of the limitations.

Upvotes: 0

Views: 615

Answers (1)

David W
David W

Reputation: 10184

I suspect it has more to do with the permissions implied by the identity associated with the process executing the application, eg permissions to key store, or the app.config file itself.

Per the observation from @JulienLebosquain, if you have configured encryption as a post-build event, machine-specific keys will have been used to perform the encryption, thus making it unrecoverable on any other machine. To accomplish post-install encryption on an app.config file, you would have to consider constructing a Setup project and adding an Installer class to your application that defines a post-install event that performs encryption based on host machine keys.

Upvotes: 3

Related Questions