SSH2 and key files (General questions)
I am new to SSH and have basically no knowledge of it. I have created the code to connect to a server and execute a command a retrieve the response. This works fine and I am able to display the output on my aspx page. I am now trying to use public/private key pair with SSH2, but am completely lost on how it all works. I am successfully generating a DSA key. now for the questions:
1. Does the key I generate first need to be loaded on the server I will connect? I believe I read this somewhere.
2. I have f-secure client installed and am able to connect with it. I tried loading the key file from it but get an error that it cannot be loaded. I am not sure what file to use from f-secure. I have 2 key files with my id, one has no extension(private key), the other has .pub extension(public key), but there are also public keys from the server. which key file is the one i would load?
3. Do I need to generate the file everytime I connect or can I just keep reusing the one previously generated?
here is my code so far, any help would be much appreciated or just a link to good reference material on SSH2.
Currently the code fails when trying to load the file
'Creates DSA Key for SSH
Public Function SSHMakeKey() As WeOnlyDo.Security.Cryptography.KeyManager
Dim km As WeOnlyDo.Security.Cryptography.KeyManager = New WeOnlyDo.Security.Cryptography.KeyManager
km.Generate(SSHKeyTypes.DSAKey, 2048)
km.Save(SSHKeyTypes.DSAKey, d:\temp.dsa , password )
km.Load(km.PublicKeyOpenSSH(WeOnlyDo.Security.Cryptography.SSHKeyTypes.DSAKey), password )
Return km
End Function