Encrypting and decrypting configuration files
Who is this article for?IT Administratorsresponsible for managing the application server.
Version 7.1.5.0 or above is required.
Web application configuration files store sensitive information. They may require decryption and reencryption to make updates to the settings.
This article introduces the process of encrypting and decrypting these files for version 7.1.5.0 onwards.
1. Decrypting appSettings
Once your web.config files are encrypted, the appSettings details will be replaced with a CipherValue indicator.
To decrypt the file:
- Create a Configs folder within the application directory.
- Copy the web.config file.
- Paste it into the Configs folder.
This enables encryption and decryption without disrupting the feature, preventing potential loss of work due to application pool resets. - Open the command prompt.
- Navigate to:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
You can do this by entering "cd", pasting in the above file path, and pressing Enter.
- Run the following command:
aspnet_regiis.exe -pdf "appSettings" "C:\inetpub\wwwroot\QPulseIdentityServer\Configs"
Once the command is ran, your config file will be decrypted, allowing access to all details within the appSettings tags.
For convenience, it's advisable to keep the command prompt open to facilitate subsequent file encryption.
2. Encrypting appSettings
After applying the changes, we recommend you reencrypt your files.
To encrypt files:
- Open the command prompt.
- Navigate to:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
- Run the following command:
aspnet_regiis.exe -pef "appSettings" "C:\inetpub\wwwroot\QPulseIdentityServer\Configs" -prov "DataProtectionConfigurationProvider"
Once the command is ran, your config file will be encrypted, and all appSettings information will be displayed as a Cipher Value again.
3. Decrypting connectionStrings
Offline Audit Server configuration file includes a database connection string.
To decrypt these strings:
- Create a Configs folder within the application directory.
- Copy the web.config file.
- Paste it into the Configs folder.
This enables encryption and decryption without causing downtime, preventing potential loss of work due to application pool resets. - Open the command prompt.
- Navigate to:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
You can do this by entering "cd", pasting in the above file path, and pressing Enter.
- Run the following command:
aspnet_regiis.exe -pdf "connectionStrings" "C:\inetpub\wwwroot\QPulse5OfflineAuditServer\Configs"
Once the command is ran, your config file will be decrypted, allowing you to view the details within the connectionStrings tags.
For convenience, it's advisable to keep the command prompt open to facilitate subsequent file encryption.
4. Encrypting connectionStrings
After applying the changes, we recommend you reencrypt your files.
To encrypt these strings:
- Open the command prompt.
- Navigate to:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
- Run the following command:
aspnet_regiis.exe -pef "connectionStrings" "C:\inetpub\wwwroot\QPulse5OfflineAuditServer\Configs" -prov "DataProtectionConfigurationProvider"
Once the command is ran, your config file will be encrypted, and all connectionStrings information will be displayed as a Cipher Value again.