An optional private key file to pass instead of or in addition to a password. Path should be fully qualified.
Private Key should be in OpenSSH format
The private key file should be in OpenSSH format that starts with a
-----BEGIN RSA PRIVATE KEY-----
prefix. If your file is a PutTyGen key file, you can use PutTyGen to convert it to OpenSSH format.
Most SFTP servers that use Private Key Files expect both a password and keyfile for two-factor authentication, but some servers only require one or the other. Check with your server documentation what's required.
o.cPrivateKeyFile
Example
FUNCTION UploadFileWithPrivateKey()
loFtp = CREATEOBJECT("wwSftp")
loFtp.cFtpServer ="127.0.0.1"
loFtp.nFtpPort = 23
loFtp.cUsername = "tester"
loFtp.cPassword = "password"
*** Private Key File and optional Private Key Password
loFtp.cPrivateKeyFile = "c:\utl\server-private-key-rsa_OPENSSL.ppk"
loFtp.cPrivateKeyFilePassword = "my-super-secure-password"
DELETE FILE "SENDFILETEST.ZZZ"
IF NOT FILE("SENDFILETEST.ZZZ")
lcBlob = ""
FOR i = 1 TO 255
lcBlob = lcBlob + CHR(i)
ENDFOR
lcBigBlob = REPLICATE(lcBlob,256)
FOR i = 1 TO 101
STRTOFILE(lcBigBlob,"SENDFILETEST.ZZZ",1)
ENDFOR
ENDIF
lcSourceFile = FULLPATH(".\SENDFILETEST.ZZZ") && "C:\installs\Distribution CD\Demos\wconnect.exe"
lcTargetFile = "SendFileTest_Fox_Simple.zzz"
loFtp.FtpConnect()
lnResult = loFtp.FtpSendFileEx(lcSourceFile,lcTargetFile)
loFtp.FtpClose()
this.AssertTrue(lnResult == 0,loFtp.cErrorMsg)
ENDFUNC
* UploadFileWithPrivateKeyFile
See also:
Class wwSFTP (deprecated) | wwSFTP::cPrivateKeyFilePassword© West Wind Technologies, 2024 • Updated: 08/02/17
Comment or report problem with topic