How to generate Public & Private Key and implimen - WeOnlyDo Discussion board

How to generate Public & Private Key and implimen (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Sreekumar, Thursday, October 14, 2004, 06:27 (7133 days ago)

Hello,
I need to upload some files from SSH client which is SSH.NET client provided by WeOnlyDo (Currently having evaluation version, will be purchasing if trial implimention is sucessfull ) To SSH Server of our client which is of another vendor (F-Secure). The authentication is done using Public Key / Private Key. The application will be a windows service component in c#.

1.How to create Public/Private Key using SSH.NET.
2.Samples provided by you does not mention Public/Private Key
implimention, Please help me in this regard

Thanks in advance

Sreekumar

Re: How to generate Public & Private Key and impl

by wodSupport, Thursday, October 14, 2004, 19:59 (7132 days ago) @ Sreekumar

Hi. Correct way would be like this:

1. Create your private key and save it somewhere
[code]WeOnlyDo.Security.Cryptography.KeyManager km = new WeOnlyDo.Security.Cryptography.KeyManager();
km.Generate(WeOnlyDo.Security.Cryptography.SSHKeyTypes.DSAKey);
km.Save (WeOnlyDo.Security.Cryptography.SSHKeyTypes.DSAKey, C:\myprivkey , mypass );
[/code]

2. Get it's public key in SSH (F-Secure) format. Write it to \Documents and Settings\<username>\.ssh2\mypubkey, and then in file \Documents and Settings\<username>\.ssh2\authorization add one line:
key mypubkey

and then in that mypubkey file paste contents of
[code]Console.Write(km.PublicKeySSH(WeOnlyDo.Security.Cryptography.SSHKeyTypes.DSAKey));[/code]

3. Use this key to connect. Set Authorization property to authPubkey, and use this code:
[code]WeOnlyDo.Security.Cryptography.KeyManager km = new WeOnlyDo.Security.Cryptography.KeyManager();
km.Load( c:\myprivkey , mypass );
sftp1.PrivateKey = km.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.DSAKey);[/code]

Can you try this and let me know how it goes?