Unable to load private key

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

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

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.

The LoadFile method or the PrivateKey method?

The LoadFile method or the PrivateKey method?

The PrivateKey method.

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

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

<?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>

Both ways should be working.