Encrypt and Decrypt connectionStrings section in Web.config using ASPNET_REGIIS utility
Encrypting and decrypting connectionStrings section progrmatically is explained in this article from my blog.
Using aspnet_regiis.exe utility from Microsoft .NET framework it is quite easy and straight forward to encrypt and decrypt connectionStrings section in Web.config to protect sensitive data.
1. Open Visual studio command prompt window from Programs
2. Navigate to the folder where the application stored with in File system
3. Utilising aspnet_regiis.exe utility use below shown command to encrypt connectionStrings section.
c:/>aspnet_regiis -pef connectionStrings .
In the above command P stands for protection, E stands Encryption and F file system. . [DOT] for current location
Note: Make sure to navigate inside the website/web application project in file system.
That is it. ConnectionStrings section gets encrypted using RSA pubic key encryption to encrypt and decrypt data.
Note that in order to decrypt the same section use >aspnet_regiis –def connectionStrings .
References
http://msdn.microsoft.com/en-us/library/k6h9cz8h%28v=VS.90%29.aspx