Wednesday 15 May 2013

.net - IP*Works SSH PublicKey Auth with C# -



.net - IP*Works SSH PublicKey Auth with C# -

i'm trying ip*works ssh / sexec authmode certificate, improve publickey, work. works fine when i'm using simple user / password combination.

my code publickey:

private static void dosexec() { var sexec = new sexec { sshuser = "abc", sshhost = "someserver", sshport = 22, sshauthmode = sexecsshauthmodes.ampublickey, sshcert = new certificate(@"c:\work\key.pem"), sshencryptionalgorithms = "aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc" }; sexec.config("sshmacalgorithms=hmac-sha1"); sexec.config("sshacceptserverhostkeyfingerprint=c9:e4:53:46:19:e7:58:ec:a7:3d:29:cc:42:87:f5:a5"); sexec.onstdout += sexecononstdout; sexec.onconnected += sexeconconnected; sexec.onerror += sexeconerror; sexec.ondisconnected += sexecondisconnected; sexec.onstderr += sexeconstderr; seek { sexec.sshlogon(host, port); if (sexec.connected) { sexec.execute("ls"); if (sexec.exitstatus != 0) { console.writeline(sexec.errormessage); } sexec.doevents(); sexec.sshlogoff(); } } grab (exception ex) { console.writeline(ex.message); } console.readkey(); }

clientconfiguration of ip*works ssh lib same ssh configured on server side.

the connection working well. server tells there connection ssh via client. connection until client sending sshlogoff()-signal.

the problem: execute()-method doing.... nil !

any ideas went wrong?

thank much.

best regards, andreas

c# .net ssh

No comments:

Post a Comment