PDA

Click to See Complete Forum and Search --> : [RESOLVED] [2.0][2005] Encrypting password in XML Config file


MadCatVB
Jul 7th, 2006, 03:02 AM
Hi,

I'm looking to store a password which is used when connecting to a default ftp site via my app in an XML config file. I need to be able to retrieve this each time the program in loaded.

I was wondering what the best way was to do this? I know that hashing encryption techniques are only one way and not suitable for the purpose. If using someting like a Symetric or Asymetric password i require a key which i presume would have to be hard coded into the application.

Is there a better way of doing this or will the latter method i suggested be the advised solution?

Many thanks in advance.

Grant

jmcilhinney
Jul 7th, 2006, 03:58 AM
After 135 posts you really should know to specify your version. If you're using 2.0 then encryption support for config files is built-in.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/PAGHT000006.asp

It's aimed at ASP.NET but it can be used for Windows Forms apps too. You just have to use the -pef switch when invoking aspnet_regiis. The bit about Web Farms is what you apply to your installations.

MadCatVB
Jul 7th, 2006, 04:20 AM
Slight oversight on my part. consider my topic changed to include versions etc :)

Thanks for the link. I'll look over it now.

Cheers,
Grant

MadCatVB
Jul 7th, 2006, 08:55 AM
Jmcilhinney,

Thanks for that link, its got me heading in the correct direction. I've now read that and found a new link:

http://msdn2.microsoft.com/en-us/library/89211k9b.aspx

This link suggests using the Configuration class objects to change setting with in a config file.
I forgot to mention in my first post that i am not using the app.config file to store these variables, but one that i have created my self 'DHFconfig.config'. What i can't seem to figure out from these links is if it is possible to encrypt information in a custom config file as apposed to the App.config or Machine.config file using the configuration code.

Any further assistance would be greatly appreciated.

Thanks,

Grant