public key (wodSFTP / wodSFTP.NET / wodSFTPdll)
I'm using your sftp activex, and all works well with the 'Use password authentication'.
But now i should use the 'Use public key authentication' and i've just some questions:
1) How can i generate the keys pair to use ?
2) how can i test if it works well ?
Thank you
Re: public key
Hi Luca,
Here is example how to generate and save PrivateKey and PublicKey using wodKeys component:
[code]
Dim key As Keys
Set key = New Keys
key.Generate RSAkey ' you can generate and save with wodKeys RSAkey or DSAkey
key.Save RSAkey, c:RSAprivate.txt , weonlydo ' weonlydo is password
key.PublicKeySave RSAkey, c:RSApublic.txt
Debug.Print key.PublicKeyOpenSSH(RSAkey)
[/code]
wodKeys component is part of wodSFTP ActiveX component.
PublicKey is part of PrivateKey. If you wish to connect to server with your PrivateKey, server need to have your PublicKey.
Here is example how to connect to server with PrivateKey:
[code]
Set sftp1 = New wodSFTPCom
Set key = New Keys
key.Load c:RSAprivate.txt , weonlydo
sftp1.HostName = your_hostname
sftp1.Authentication = authPubkey
sftp1.Login = your_login
sftp1.PrivateKey = key
sftp1.Connect
[/code]
PublicKey is part of PrivateKey. If you wish to connect to server with PrivateKey, server need to have your PublicKey.
You can generate and save PrivateKey and PublicKey with wodKeys component.
WodKeys component is part of wodSFTP ActiveX component.
If you wish you can test public key authentication with our testing server. To done that please send email to techsupport@weonlydo.com
Let us know how it goes.
Regards,
Drazen
Re: public key
Hi gentlemens,
Any ideas to do that in C# ?
Dim key As Keys
Set key = New Keyskey.Generate RSAkey ' you can generate and save with wodKeys RSAkey or DSAkey
key.Save RSAkey, c:RSAprivate.txt , weonlydo ' weonlydo is password
key.PublicKeySave RSAkey, c:RSApublic.txt
Debug.Print key.PublicKeyOpenSSH(RSAkey)
Sincerely,
Bertrand
Re: public key
Hi Bertrand,
Here is example how to generate and save private and public key in C# using wodKeys:
[code]WODSSHKeyLib.Keys key;
key = new WODSSHKeyLib.Keys();
key.Generate(WODSSHKeyLib.SSHKeyTypes.RSAkey,1024);
key.Save(WODSSHKeyLib.SSHKeyTypes.RSAkey, c:\private.txt , weonlydo );
key.PublicKeySave(WODSSHKeyLib.SSHKeyTypes.RSAkey, c:\public.txt );
Console.Write(key.get_PublicKeyOpenSSH(WODSSHKeyLib.SSHKeyTypes.RSAkey)); [/code]
Let us know how it goes.
Regards,
Drazen
Re: public key
Hi dear Drazen,
I get the error Error 1 The type or namespace name 'WODSSHKeyLib' could not be found (are you missing a using directive or an assembly reference?) when I using this sample code.
How can I add a specific reference to code ?
Thanks,
Bertrand
Hi Bertrand,
Here is example how to generate and save private and public key in C# using wodKeys:
[code]WODSSHKeyLib.Keys key;
key = new WODSSHKeyLib.Keys();key.Generate(WODSSHKeyLib.SSHKeyTypes.RSAkey,1024);
key.Save(WODSSHKeyLib.SSHKeyTypes.RSAkey, c:\private.txt , weonlydo );
key.PublicKeySave(WODSSHKeyLib.SSHKeyTypes.RSAkey, c:\public.txt );
Console.Write(key.get_PublicKeyOpenSSH(WODSSHKeyLib.SSHKeyTypes.RSAkey)); [/code]
Let us know how it goes.
Regards,
Drazen
Re: public key
Bertrand,
Please go to Project menu and then go to Add reference. In Add reference please select COM tab.
In COM tab search and select Weonlydo! SSH Key Management component reference and click OK.
That should add wodKeys in your C# project.
Drazen
Re: public key
That's work nice, many thanks Drazen !