Unable to load private key

This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
Post Reply
cwmathew
Posts: 5
Joined: Fri Sep 19, 2008 4:28 pm

Unable to load private key

Post by cwmathew » Mon Sep 22, 2008 2:44 pm

We recently purchased two licenses for the pro version which supports scripting. Was the PrivateKey property left out of the “Application” layer?

The following works fine, has it uses the library which I don’t need as I only have two servers…

[codebox]
Dim loEarlyConnection As sfFTPLib.SFTPConnection = New sfFTPLib.SFTPConnection
Dim loEarlyKeyManager As sfFTPLib.KeyManager = New sfFTPLib.KeyManager


loEarlyConnection.Host = "123.45.679.11"
loEarlyConnection.Username = "UserName"
loEarlyConnection.Port = 22
loEarlyConnection.LogFile = "c:\TestFTPLog.log"
loEarlyConnection.PrivateKey = loEarlyKeyManager.LoadFile("c:\Keys\PrivateKey.ppk", "")[/codebox]

Using the Application does not...

[codebox]
Dim loFTPApplication As Object = CreateObject("SmartFTP.Application")
Dim loConnection As Object = loFTPApplication.CreateObject("sfFTPLib.SFTPConnection")
Dim loKeyManager As Object = loFTPApplication.CreateObject("sfFTPLib.KeyManager")


loConnection.Host = "123.45.679.11"
loConnection.Username = "UserName"
loConnection.Port = 22
loConnection.LogFile = "c:\TestFTPLog.log"
loConnection.PrivateKey = loKeyManager.LoadFile("c:\Keys\PrivateKey.ppk", "")[/codebox]



Thanks
Last edited by cwmathew on Mon Sep 22, 2008 2:56 pm, edited 1 time in total.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to load private key

Post by mb » Mon Sep 22, 2008 3:26 pm

What error do you get? Do you get an exception when assinging the PrivateKey?

Can you connect to the server? If yes can you post the log from the TestFTPLog.log.

Regards,
Mat

cwmathew
Posts: 5
Joined: Fri Sep 19, 2008 4:28 pm

Re: Unable to load private key

Post by cwmathew » Mon Sep 22, 2008 3:40 pm

What error do you get? Do you get an exception when assinging the PrivateKey?

Can you connect to the server? If yes can you post the log from the TestFTPLog.log.

Regards,
Mat


The error I am receiving is…
VB.NET - {"Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))"}

In VB Script I receive Object doesn’t support this property or method.

And no I am unable to connect as this server requires authentication by use of a key. Thus the log file is empty.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to load private key

Post by mb » Mon Sep 22, 2008 3:59 pm

The LoadFile method or the PrivateKey method?

cwmathew
Posts: 5
Joined: Fri Sep 19, 2008 4:28 pm

Re: Unable to load private key

Post by cwmathew » Mon Sep 22, 2008 4:04 pm

The LoadFile method or the PrivateKey method?

The PrivateKey method.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to load private key

Post by mb » Mon Sep 22, 2008 4:10 pm

Install the latest version of SmartFTP:
https://www.smartftp.com/download

Then register the sfFTPLib.dll:
regsvr32.exe sfFTPLib.dll

I think the proxy was not registered.

Regards,
Mat

cwmathew
Posts: 5
Joined: Fri Sep 19, 2008 4:28 pm

Re: Unable to load private key

Post by cwmathew » Mon Sep 22, 2008 5:14 pm


mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to load private key

Post by mb » Mon Sep 22, 2008 8:13 pm

I created the following .wsf script and it didn't throw any errors:

Code: Select all

<?xml version="1.0"?>

<package>

<job>

<reference object="SmartFTP.Application" />

<reference object="sfFTPLib.SFTPConnection" />



<script language="VBScript">



<![CDATA[



Option Explicit



Dim objSmartFTP

'Set objSmartFTP = WScript.CreateObject("SmartFTP.Application")

Set objSmartFTP = GetObject(,"SmartFTP.Application")



Dim objFTP

Set objFTP = objSmartFTP.CreateObject("sfFTPLib.SFTPConnection")

Dim objKeyManager

Set objKeyManager = objSmartFTP.CreateObject("sfFTPLib.KeyManager")



Dim objKey

Set objKey = objKeyManager.LoadFile("C:\PrivateKey", "")



objFTP.PrivateKey = objKey



WScript.Echo("Done")



]]>

</script>

</job>

</package>

cwmathew
Posts: 5
Joined: Fri Sep 19, 2008 4:28 pm

Re: Unable to load private key

Post by cwmathew » Mon Sep 22, 2008 8:57 pm


mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Unable to load private key

Post by mb » Mon Sep 22, 2008 9:06 pm

Both ways should be working.
Last edited by mb on Mon Sep 22, 2008 9:06 pm, edited 1 time in total.

Post Reply