public key - WeOnlyDo Discussion board

public key (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Luca Colombo, Wednesday, September 19, 2007, 10:32 (6073 days ago)

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

by woddrazen, Wednesday, September 19, 2007, 10:39 (6073 days ago) @ Luca Colombo

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

by Bertrand DEMARCQ, Thursday, April 17, 2008, 16:09 (5862 days ago) @ woddrazen

Hi gentlemens,

Any ideas to do that in C# ?


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)

Sincerely,
Bertrand

Re: public key

by woddrazen, Thursday, April 17, 2008, 16:32 (5862 days ago) @ Bertrand DEMARCQ

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

by Bertrand DEMARCQ, Thursday, April 17, 2008, 16:43 (5862 days ago) @ woddrazen

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

by woddrazen, Thursday, April 17, 2008, 17:04 (5862 days ago) @ Bertrand DEMARCQ

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

by Bertrand DEMARCQ, Thursday, April 17, 2008, 17:48 (5862 days ago) @ woddrazen

That's work nice, many thanks Drazen !