Skip to content

Instantly share code, notes, and snippets.

@mhagrelius
Created October 4, 2019 13:04
Show Gist options
  • Save mhagrelius/f24a99dee2b5cb6c0291e383fa9768bd to your computer and use it in GitHub Desktop.
Save mhagrelius/f24a99dee2b5cb6c0291e383fa9768bd to your computer and use it in GitHub Desktop.
Steps to encrypt web.config

For Single Box

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef connectionStrings "C:\Folder\Project"

To Share Across Environments

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pc "SiteRSAEncryptionKeys" -exp C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pa "SiteRSAEncryptionKeys" "COMPUTER\UserName"

Setup ConfigProtectedData section of web.config

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef connectionStrings "C:\Folder\Project" -prov "SiteRSAEncryptionProvider" C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -px "SiteRSAEncryptionKeys" C:\SiteRSAEncryptionKeys.xml -pri

ON THE SERVER

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pi "SiteRSAEncryptionKeys" C:\SiteRSAEncryptionKeys.xml C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pa "SiteRSAEncryptionKeys" "Site"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment