Encrypt one key in the appsettings section of the App.Config file

Can I encrypt a single value or encrypt entire partitions?

those. Given that app.config is below, how can I encrypt only the password. I read articles about encrypting connection string sections and entire app.config sections.

<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Interval" value="40000" />
<add key="User" value="User1" />
<add key="Password" value="boombox" />    ...

If you have any suggestions, they will be very grateful

+3
source share
2 answers

Before saving / after loading the settings file, you need to encrypt / decrypt. See the System.Security.Cryptography namespace . I used the DES provider to read / write the password to the settings file.

+3
source

app.config DPAPI.

+1

Source: https://habr.com/ru/post/1767506/


All Articles