Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encrypt a string in C# Settings.settings

I have a password which I save on the Settings.settings file

Settingsfile

and since it is a password, I need to encrypt it.

What are my possibilities, and how can I accomplish such a task? Is it possible to encrypt a string, and how do you decrypt it?

like image 847
gbbb Avatar asked Oct 20 '25 03:10

gbbb


1 Answers

You could encrypt the password, but your code will need to have the decryption key built in. So it's not very secure. Anyone disassembling your code would have one extra step to take before they'd have the password.

You're likely better off using an AD service account, or some other security mechanism designed for this purpose. Security is hard; don't roll your own unless you absolutely have to!

like image 96
Greg Dietsche Avatar answered Oct 21 '25 17:10

Greg Dietsche



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!