Re: How to generate Public & Private Key and impl (General questions)
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:
- How to generate Public & Private Key and implimen - Sreekumar, 2004-10-14, 06:27
- Re: How to generate Public & Private Key and impl - wodSupport, 2004-10-14, 19:59