Sitecore

Encrypting Sitecore Database Connection Strings

Posted 2/02/2012 by TerryHumphris

To encrypt your connection strings in connectionstrings.config, first make a copy of your existing web.config and connectionstrings.config files.

Next, on the web server, create a batch file in the same directory as the web.config. The batch file should contain the following text although you may need to tweak the location of aspnet_regiis.exe to match the framework on your server.

echo Encrypting database connection string in Sitecore
echo .
echo The Sitecore Web.Config contains the following file reference
echo <connectionStrings configSource="App_Config\ConnectionStrings.config" />
echo aspnet_regiis.exe will find this file and automatically encrypt the
echo connectionStrings section within it.
copy web.config web.config.original
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef connectionStrings . -prov DataProtectionConfigurationProvider
pause

Note the changed connectionstrings.config file can only be used on the server that generated the file.

Share: