Using RSA key with chilkat API in C -


i tried use rsa key .ssh directory using chilkat api in c failed.
have such experience?

here did far:

#include <stdio.h> #include "/home/germaneau/opt/chilkat/chilkat-9.5.0-x86-linux-gcc/include/c_ckssh.h" #include "/home/germaneau/opt/chilkat/chilkat-9.5.0-x86-linux-gcc/include/c_ckftp2.h" #include "/home/germaneau/opt/chilkat/chilkat-9.5.0-x86-linux-gcc/include/c_cksshkey.h"  void testftp2create(void)     {     hckftp2 ftp;     bool success;      ftp = ckftp2_create();      //  string unlocks component 1st 30-days.     success = ckftp2_unlockcomponent(ftp,"anything 30-day trial");     if (success != true) {         printf("%s\n",ckftp2_lasterrortext(ftp));     }      ckftp2_dispose(ftp);     }   void sshsample(void)     {     hckssh ssh;     bool success;     const char * hostname;     long port;     long channelnum;     const char * cmdoutput;     hckstring privkey;     hcksshkey key;      //  important: helpful send contents of     //  ssh.lasterrortext property when requesting support.      ssh = ckssh_create();     key = cksshkey_create();      //  string automatically begins fully-functional 30-day trial.      success = ckssh_unlockcomponent(ssh,"anything 30-day trial");     if (success != true) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  connect ssh server:      //  hostname may ip address or hostname:     hostname = "202.120.32.202";     port = 22;      success = ckssh_connect(ssh,hostname,port);     if (success != true) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  wait max of 5 seconds when reading responses..     ckssh_putidletimeoutms(ssh,5000);      // load rsa key     success = cksshkey_loadtext(key,"/home/germaneau/.ssh/id_rsa",privkey);     if (cksshkey_getisprivatekey(key)) printf("privatekey\n");     if (cksshkey_getisrsakey(key)) printf("rsakey\n");      //  authenticate using login/privkey:     success = ckssh_authenticatepk(ssh,"eric",key);     if (success != true) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  open session channel.  (it possible have multiple     //  session channels open simultaneously.)      channelnum = ckssh_opensessionchannel(ssh);     if (channelnum < 0) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  in example, we'll copy wine.html wine2.html     //  "cp" command has no output (i.e. nothing written     //  standard output) we'll include "echo finished"     //  can programmatically retrieve output , close     //  channel.  closing channel after sending     //  command not because w/ ssh servers     //  introduces race condition command may not     //  executed if server thinks client has disconnected.     success = ckssh_sendreqexec(ssh,channelnum,"echo started && hostname && echo finished");     if (success != true) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  read channel until receive finished string.     success = ckssh_channelreceiveuntilmatch(ssh,channelnum,"finished","ansi",true);     if (success != true) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  close channel:     success = ckssh_channelsendclose(ssh,channelnum);     if (success != true) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  let's pickup accumulated output of command:     //  (in case, string "finished")      cmdoutput = ckssh_getreceivedtext(ssh,channelnum,"ansi");     if (cmdoutput == 0 ) {         printf("%s\n",ckssh_lasterrortext(ssh));         return;     }      //  display remote shell's command output:     printf("%s\n",cmdoutput);      //  disconnect     ckssh_disconnect(ssh);      ckssh_dispose(ssh);      }   int main(int argc, char *argv[]) {         printf("ftp\n");     testftp2create();         printf("ok\n");         printf("ssh\n");             sshsample();         printf("ok\n");      return 0; } 

and here output get:

ftp ok ssh rsakey chilkatlog:   authenticatepk:     dlldate: mar  7 2014     chilkatversion: 9.5.0.17     unlockprefix: 30-day trial     architecture: little endian; 32-bit     language: linux c/c++     verboselogging: 0     sshversion: ssh-2.0-openssh_5.3     ssh key object did not contain loaded private key.     failed.   --authenticatepk --chilkatlog  ok 

i don't understand why message

  • the ssh key object did not contain loaded private key.

thanks help.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -