exception:"Invalid data type, INTEGER(02) is expected."

Dec 7, 2012 at 9:45 AM
Edited Dec 7, 2012 at 9:52 AM

hi,everyone:

i'm having this error while creating SshClient and can not fix it

can anybody tell me how to fix it or why this occurs.

thanks.

Dec 8, 2012 at 2:39 PM

Without more informations, no.

Please post your code and tell us exactly what you are trying to do.

Dec 9, 2012 at 11:55 AM
Edited Dec 9, 2012 at 11:58 AM

hi,here's the code

string cerpath = System.Environment.CurrentDirectory + @"\certs\" + Configs.CertFileName;

SshClient sc = new SshClient(host, username, new PrivateKeyFile(cerpath, Configs.CertPassPhrase)); //exception occurs here

sc.Connect();

var scom = sc.RunCommand(command);

return scom.Result;

 

and here's the stack trace:

   at Renci.SshNet.Common.DerData.ReadBigInteger()

   at Renci.SshNet.Security.Key..ctor(Byte[] data) 

 at Renci.SshNet.Security.RsaKey..ctor(Byte[] data) 

 at Renci.SshNet.PrivateKeyFile.Open(Stream privateKey, String passPhrase) 

 at Renci.SshNet.PrivateKeyFile..ctor(String fileName, String passPhrase) 

 at SPVTGTester.Utility.SSHUtility.ExecuteCommand(String host, String username, String password, String command) in C:\work\SPVTGTester\SPVTGTester\Utility\SSHUtility.cs:line 33   at SPVTGTester.Actions.runvlp(ActionParam param) in C:\work\SPVTGTester\SPVTGTester\Actions.cs:line 175

Dec 9, 2012 at 4:32 PM

Looks like you are trying to load an (for this library) invalid privatekey.

What kind of key you are trying to load? How was this key created?

Have you tried other keys?

Dec 18, 2012 at 11:57 AM

@wanglvhang: I got the same error because I used the wrong passphrase.