Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg
Created December 1, 2017 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infamousjoeg/b13c4b7d12d40179653b74f9ae53c89f to your computer and use it in GitHub Desktop.
Save infamousjoeg/b13c4b7d12d40179653b74f9ae53c89f to your computer and use it in GitHub Desktop.
Encrypt and Decrypt a web.config file with multiple machine keys for unique-encryption across clusters

Encrypt Command

C:\WINDOWS\Microsoft.NET\Framework\<.Net Version Folder>\aspnet_regiis.exe -pef "<Secton to encrypt in Web.Config>" "<Path to Web.Config>" -prov "DataProtectionConfigurationProvider"

Decrypt Command

C:\WINDOWS\Microsoft.NET\Framework\<.Net Version Folder>\aspnet_regiis.exe -pdf "<Secton to decrypt in Web.Config>" "<Path to Web.Config>"

Note: Only certain sections can be encrypted.

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