Cipher used to create the keys (General questions)
Hi,
I have been trying to use wodSSH to create a key pair and then use the key to connect to the server. I have used the following code to create the new key:
[code]
Dim myNewKey As KeyManager = New KeyManager
myNewKey.Generate(SSHKeyTypes.RSAKey, rsaBit)
myNewKey.Save(SaveLocation, rsaPassPhrase)
[/code]
I have then gone onto place the public key on the system I would like to connect too.
I have then used wodSSH to connect to the test system; however, it either stays within the connecting state and never connects or if blocking is enabled it errors with not authenticated.
I have then tried to use putty to confirm I can connect using that and it states that the key cannot be used and it defaulted to password authentication; hence what was happening above.
I then tried to use puttygen to load the private key and it states that it 'Couldnt load private key (ciphers other than DES-EDE3-CBD not supported'.
I am assuming that this is the issue. How can I change the cipher when creating the key pair or are there any other ideas?
Thanks, Mike
Re: Cipher used to create the keys
Hi Mike,
Did you place the public key generated with KeyManager to proper place on the server?
The public key created should be copied to the server in order for PublicKey authentication to work properly. (on linux the keys are usually in /home/user/.ssh )
How did you load the key into wodSSH? Did you check the following article in our kb? I assume you are using wodSSH.Net so I'll provide you with a link to the article:
http://www.weonlydo.com/index.asp?kb=1&View=entry&EntryID=56
Can you please check it out and try?
As for the cipher, type of keys can only be RSA or DSA. However, problem is that you will most probably have to use PuttyGen in order to import the key (OpenSSH format) into it, and export the key in .ppk format.
Hope I helped.
Regards,
Damba
Regards,
Damba
Re: Cipher used to create the keys
Hi,
This is my code and i have already viewed the examples.
[code]
Dim myOldKey As KeyManager = New KeyManager
myOldKey.Load(LoadLocation, pwdPassPhrase)
Using sshConnection As New WeOnlyDo.Client.SSH
sshConnection.Protocol = SSHAuto
sshConnection.Hostname = strSystem
sshConnection.Authentication = PublicKey
sshConnection.Login = frmMainForm.txtUserName.Text
sshConnection.PrivateKey = myOldKey.PrivateKey(SSHKeyTypes.RSAKey)
sshConnection.Blocking = True
sshConnection.Timeout = 60
sshConnection.Connect()
UpdatePublicKey = sshConnection.Execute( uname -a
)
sshConnection.Disconnect()
[/code]
If I create an RSA key in putty it uses the DES-EDE3-CBC and the wodSSH uses DES-EDE3-CFB and they are both RSA keys which are being created. This is the cipher I am referring to.
I have already tried to import the key into key into putty, this cant be done as it states the cipher is not supported.
The problem seems to be around the keys and not the code. Can anyone advise on this?
Thanks, Mike
Re: Cipher used to create the keys
Mike,
I've duplicated the issue with puttygen, and will contact our programmers on this problem.
However, I've also tried connecting to server with KeyManager created keys, and it worked like a charm.
This is the code I used to connect to my server which had the public key implemented:
[code] //km.Generate(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey);
//km.Save(@ C:file.txt , damir );
//System.IO.File.WriteAllText(@ C:public.txt , km.PublicKeyOpenSSH(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey));
km.Load(@ C:file.txt , damir );
ssh1.Hostname = linux.weonlydo.com ;
ssh1.Login = weonlydo ;
ssh1.Blocking = true;
ssh1.Authentication = WeOnlyDo.Client.SSH.Authentications.PublicKey;
ssh1.PrivateKey = km.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey);
ssh1.Connect();[/code]
Perhaps that would work on your side too?
Regards,
Damba
Re: Cipher used to create the keys
I have simply used the key used from Puttygen and I can connect and perform commands. This seems to be something to do with cipher used by the wodSSH ActiveX.
Re: Cipher used to create the keys
Mike,
I'm now a little confused. Are you using wodSSH.Net or wodSSH ActiveX?
In the sample code you sent us I can see that you are using wodSSH.Net, and now you mentioned wodSSH ActiveX. Can you please check this?
As I've stated, everything worked when I tried connecting to our Linux server using wodSSH.Net and key generated with KeyManager.
Regards,
Damba