views:

97

answers:

2

In a CodingHorror blog post a commenter made the observation that it is more difficult to obscure sensitive configuration information (e.g. SQL Server connection strings) in a program than it used to be, because the obscuring algorithm can be disassembled quite easily with Reflector.

Another commenter suggested that encrypted appSettings could be used as an alternative.

How secure is encrypted appSettings? Is it a bank vault, a locked door, or an open window, and why? Is it ever safe to store "sensitive information" in an executable?

A: 

The real question is who are you trying to shield the user and password from? On a desktop app the user is likely to have access to the database with his/her own account, no pwd needed (trusted). On a web app, the config file sits on a (hopefully) protected place. So far I didn't find many reasons to encrypt the config file.

Otávio Décio
I assume there is an application for this, otherwise why would there be Encrypted AppSettings in the first place?
Robert Harvey
+1  A: 

Encryption algoriths are secure: the main issue with using encryption for security is the secure management of keys.

Hiding keys in the application executable was never secure, but it's probably true to say that they would be easier to find in a managed executable using a tool like Reflector than in a traditional unmanaged executable.

Encrypting a configuration file can be useful on a server. For example, if you encrypt web.config using DPAPI with the machine key, only users who can log in to the server or have write access to the server disk will be able to decrypt it:

Anyone with read access to the server disk over the network, or access to a backup copy of the application directory won't be able to decrypt it.

Joe