Re: How to generate Public & Private Key and impl - WeOnlyDo Discussion board

Re: How to generate Public & Private Key and impl (General questions)

by wodSupport, Thursday, October 14, 2004, 19:59 (7346 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?


Complete thread: