Using ssh tunnel with public and private keys (wodSSHTunnel)
Hello, i am no programmer and i am looking to create a simple tunnel from my PC to my server for simple port forward, and i have to use public and private keys, i have a project to generate the keys, the code i use is:
WODSSHKeyLib.Keys key = new WODSSHKeyLib.Keys();
key.Generate(WODSSHKeyLib.SSHKeyTypes.RSAkey, 1024);
key.PublicKeySave(WODSSHKeyLib.SSHKeyTypes.RSAkey, "public");
key.Save(WODSSHKeyLib.SSHKeyTypes.RSAkey, "private");
this creates 2 files, public and private in the bin directory, and then i have another project with this code:
WODSSHKeyLib.Keys key = new WODSSHKeyLib.Keys();
key.Load("private");
wodSSHTunnel1.Hostname = hostname;
wodSSHTunnel1.Login = "sshuser";
wodSSHTunnel1.Authentication = wodSSHTunnelCOMLib.AuthenticationsEnum.authPubkey;
wodSSHTunnel1.PrivateKey = key;
wodSSHTunnel1.Timeout = 120;
wodSSHTunnel1.Compression = 6;
wodSSHTunnel1.Connect();
on my server i have OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
and i logged in with my sshuser and created a file
vi ~/.ssh/authorized_keys2
and pasted the contents of "public" file created earlier.
but each time i try to use my second project i get
Invalid username or password reported by server, or bad private key.
I tried using putty with keys and it works, i used a tutorial i found online using puttygen.exe
Can you help me?
Complete thread:
- Using ssh tunnel with public and private keys - Alice Feema, 2014-04-06, 13:54
- Using ssh tunnel with public and private keys - wodSupport, 2014-04-06, 13:59
- Using ssh tunnel with public and private keys - Alice Feema, 2014-04-06, 14:27
- Using ssh tunnel with public and private keys - Alice Feema, 2014-04-06, 14:56
- Using ssh tunnel with public and private keys - wodSupport, 2014-04-06, 16:11
- Using ssh tunnel with public and private keys - wodSupport, 2014-04-06, 16:10
- Using ssh tunnel with public and private keys - Alice Feema, 2014-04-06, 14:56
- Using ssh tunnel with public and private keys - Alice Feema, 2014-04-06, 14:27
- Using ssh tunnel with public and private keys - Alice Feema, 2014-04-06, 14:06
- Using ssh tunnel with public and private keys - wodSupport, 2014-04-06, 14:14
- Using ssh tunnel with public and private keys - wodSupport, 2014-04-06, 13:59