Encrypting passwords in WinForms app.config, .NET

.net, encryption

Solution

Encrypting Passwords in a .NET app.config File

Problem

I want to store a password in a config file but i would like it to be encrypted so that in the app it can be read, decrypted and used. What's the best way to encrypt a password like this? Edit: I want to encrypt only password, not whole config, or whole section.

Original source