简体   繁体   中英

Encrypting passwords in web.config appSettings without ASPNET_REGIIS

<appSettings>
<add key="uname" value="user001" />
<add key="pword" value="pass001" />
</appSettings>

I'm trying to encrypt the password (pword) in the web.config file. One method is by using ASPNET_REGIIS. Is there any other way so that, instead of directly typing the password on web.config file, I can encrypt it in the server side code? ie, by writing some encryption and decryption methods. Or using DESCryptoServiceProvider class?

You certainly can encrypt it server side using some form of symmetric encryption.

See here a good example of using string encryption/decryption using AES: https://stackoverflow.com/a/10177020/783836

Note that you would to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM