I am trying to access a server that uses private keys and a passwords and the private key is password protected. "AuthenticatePwPk" returns the following error:
Here is the abbreviated code (removed error checking statements). I am using (cut/paste from examples):
 The return value of
 the execution of
Can anyone tell me what is happening here? Thanks.
asked Dec 01 '12 at 11:34
put_Password does not return a value. In C++ terms, it is a "void" function. Also, because the internal implementation is trivial (it simply sets the internal property string value), it can never fail and no LastErrorText is saved for it. Therefore (1) trying to get a return value from it is meaningless and (2) the LastErrorText you are showing is from the previous method call ("loadText") which you can clearly see within the LastErrorText because the 2nd line (after the "ChilkatLog:" shows the name of the method.
The following error indicates a problem with your application code:
XTypeError in method 'CkSFtp_AuthenticatePwPk', argument 4 of type 'CkSshKey &'
This is easy to spot. The error complains of argument 4 (the ssh key object). You must pass it an ssh key object. Therefore, you should pass "$key", not "$privKey".
The $key->loadText method returns a boolean, not an SSH key object. I'm not sure why you would think it returns a key object -- it's not documented that way. This line makes no sense:
$privKey = $key->loadText("file_name.priv");It should be:
$success = $key->loadText("file_name.priv");
answered Dec 03 '12 at 09:06
Thank you for point #1.
As to point #2 ... that is not how it works ... at least on my system. Also, if you review the example at the following URL http://www.example-code.com/perl/sftp_pubkeyAuthenication.asp, you will see the following command line: "
Here is the code, updated per your suggestion:
Here is the output. As you can see, unlike you wrote "
answered Dec 15 '12 at 11:21