I am wondering how to encrypt configuration settings, especially connection string in ASP.Net Core app.
The configuration files are in json.
With encryption, your options are to build a custom configuration provider that loads the encrypted data and decrypts accordingly. You can check this SO answer here covering the same topic. That SO answer refers to this guide of the asp.net docs on how to create a custom provider configuration.
If encryption is not strictly necessary there is a dedicated page on asp.net documentation for safe storage of app secrets during development which you can read here. Please note that these do NOT use encryption and involve using environment variables and/or using the Secret Manager tool.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With