PublicKey auth in vbs - WeOnlyDo Discussion board

PublicKey auth in vbs (General questions)

by vadercent, Wednesday, January 24, 2007, 10:32 (6513 days ago)

Hi I'm doing some test with the trial version of wodSFTP in vbs.

After a successfull connection using login/password, I adapted your example like this to try PrivateKey/PublicKey authentication:

Option Explicit
Dim objFTP, lst, objFS, objKeys, key
Set objFTP = WScript.CreateObject( WeOnlyDo.wodSFTPCom.1 , wod_ )
Set objKeys = WScript.CreateObject( WeOnlyDo.Keys.1 )
key= PathToMyPrivateKey
objFTP.Hostname = MyHostName
objFTP.Login = MyUserName
objKeys.Load key
objFTP.PrivateKey = objKeys.PrivateKey(0)

objFTP.Blocking = 1
objFTP.Connect
objFTP.ListDir ( / )
lst = objFTP.ListItem
WScript.echo lst
objFTP.Disconnect

Sub wod_Connected(ErrorCode, ErrorText)
WScript.Echo Connected & ErrorText
End Sub

Sub wod_Disconnected()
WScript.Echo Disconnected
End Sub

When executing this, I always get:
wodSFTP.vbs(15, 1) WeOnlyDo.wodSFTPCom.1: Please set login, and password/privatekey first.

Could you please help me, because I don't see what I'm doing wrong?

Many thanks!

Tim.

Re: PublicKey auth in vbs

by woddrazen, Wednesday, January 24, 2007, 10:36 (6513 days ago) @ vadercent

Hi Tim,

Please try something like this:
[code]
Set sftp1 = CreateObject( WeOnlyDo.wodSFTPCom.1 )
Set key = CreateObject( WeOnlyDo.Keys.1 )

Key.Load c:RSAprivate.txt
Wscript.echo key.PublicKeyOpenSSH(1)

sftp1.HostName = your_hostnae
sftp1.Authentication = 2
sftp1.Login = your_login
sftp1.PrivateKey = key
sftp1.Blocking = 1
sftp1.Connect
Wscript.echo connected
[/code]

Let us know how it goes.


Regards,
Drazen