How can I protect a server credetials stored in App.config?

  • Thread starter Thread starter nopatch4humancruelty
  • Start date Start date
N

nopatch4humancruelty

Guest
Hi, I have implemented two components, Client and Server, where the former connects in SSH to the latter through Renci.SSH.

The Server credentials useful for connection through the SftpClient constructor


SftpClient client = new SftpClient(serverIP, serverPort, serverName, serverPassword);

client.Connect();

//...



are stored in the Client configuration file (App.Config), in order to not insert them statically in the code. Those credentials are in the AppSettings section of the App.Config:


<appSettings>

...

<add key="SERVER IP" value="xx.xx.xx.xx"/>
<add key="SERVER PORT" value="22"/>
<add key="SERVER USERNAME" value="Username"/>
<add key="SERVER PASSWORD" value="Password"/>

...

</appSettings>



and they are retrieved through the ConfigurationManager class. But those credetials are unencrypted and this is a problem.

The AppSettings section contains other app settings that can stay unenctypted!

How can I protect/encrypt those appsettings (SERVER IP, SERVER PORT, SERVER USERNAME, SERVER PASSWORD) in my App.Config file?

Continue reading...
 
Back
Top