Monday, November 5, 2007

Encrypt web.config aps.net2.0

There are two types of encryption possible
i) DataProtectionConfigurationProvider - windows data protection api(DAPI)
ii) RSAProtectedConfigurationProvider - RSA protected configuration provider

it's a single step process using 'aspnet_regiis.exe' utility

ex:
goto vs command prompt

Decryption
type aspnet_regiis.exe {-pdf} section physical_dir
OR
type aspnet_regiis.exe {-pd} section -app virtual_dir

like
type aspnet_regiis.exe -pdf appSettings c:\website1
OR
type aspnet_regiis.exe -pd appSettings -app c:\Inetpub\wwwroot\website1

Source :

Encryption
type aspnet_regiis.exe {-pef/-pe} section physical_dir {-porv} provider
OR
type aspnet_regiis.exe {-pef/-pe} section virtual_dir {-porv} provider

like
type aspnet_regiis.exe -pe appSettings c:\website1 -porv "DataProtectionConfigurationProvider"
OR
type aspnet_regiis.exe -pef appSettings c:\Inetpub\wwwroot\website1 -porv "RSAProtectedConfigurationProvider"