views:

40

answers:

3

In advance, thank you for all of your advice...

So I am building a C# app that will save SSH connection settings for users. It kind of resembles Putty allowing a user to enter multiple SSH connections. The user will be able to recall these settings for each connection when launched.

I have been Googling today to determine the best way to store this information. It appears XML is the way to go. I am wondering if anyone has an alternate suggestion. I also am wondering how to encrypt the password each user enters into each of their connections.

Is there a better way to do this or am I on track?

Note: SQL is not an option as this software would be run on home user computers connecting into a corporate network.

+1  A: 

For saving the information to a file; XML could work depending on how portable you want to make it, but it adds a lot of fluff/processing to get data into and out of it. For programs of this nature I've used ini files (Google C# Ini writing/parsing for easy examples) and the registry as well. The registry is good for writing things you don't necessarily want the user to muck about with unless they really feel the need to dig into the registry. For this particular use case I would store connection settings in the ini. For password encryption, you could use any of the standard methods for encrypting/decrypting passwords (Google again C# password encryption/decryption). I would add another step to most examples you will find, and that would to be to add some known salt to the password to obscure it a little more.

manyxcxi
A: 

I played with INI files for a bit after receiving your comments. It may have been the class I had grabbed off of codeproject.com, but I found it inadequate. After researching a bit more on the web, I also determined that it is considered 'out dated' by a lot of programmers.

I switched back over to XML as the goal and ended up running onto this page: http://www.codeproject.com/KB/XML/XML_Configuration_File.aspx. Using the class that this guy developed, I was able to get something up and running very quickly.

I did like the idea of an INI as I would like my users to be able to export their settings easily. Not to mention, I am saving the settings file in an appropriate location so us desktop support guys can backup important folders and not miss my config if they are not looking for it. I however found the XML file much easier to create and maintain. Hope this helps someone preferring XML.

ThaKidd
I would say that a successful option is always going to be the one you find that does the job most adequately- especially when you have to factor in ease of development. There's certainly nothing wrong with using XML over INI or vice versa (in most cases).
manyxcxi
+1  A: 

I would use XML but the way I would do it is by creating a class that holds the configuration data and then serialize the class to and from XML. This way you can easily switch to another way of storing the configuration (like in the database) by just changing the serialization.

For XML serialization I recommend OXM which is a POCO approach to serialize .net objects.

Delucia
I will look into that...thank you.
ThaKidd