Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encrypt connection string and other configuration settings in ASP.Net Core [duplicate]

Tags:

asp.net-core

I am wondering how to encrypt configuration settings, especially connection string in ASP.Net Core app.

The configuration files are in json.

like image 845
Xiaowei.Jia Avatar asked Sep 07 '16 09:09

Xiaowei.Jia


1 Answers

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.

like image 165
Rui Martins Avatar answered Nov 15 '22 08:11

Rui Martins