AutoIt
AutoIt
FTPS with Client Cert from Windows Certificate Store
See more FTP Examples
Demonstrates how to do mutual TLS authentication using a client certificate installed in the Windows certificate store.Chilkat AutoIt Downloads
Local $bSuccess = False
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oFtp = ObjCreate("Chilkat.Ftp2")
$oFtp.Hostname = "ftp.example.com"
; If using implicit TLS, you probably want port 990..
$oFtp.Port = 990
; Set this to False for implicit TLS, otherwise set to True for explicit TLS (where port is typically 21).
$oFtp.AuthTls = False
; Set this to True for implicit TLS, otherwise set to False.
$oFtp.Ssl = True
$oCert = ObjCreate("Chilkat.Cert")
$bSuccess = $oCert.LoadByCommonName("The common name of your certificate")
If ($bSuccess = False) Then
ConsoleWrite($oCert.LastErrorText & @CRLF)
Exit
EndIf
; Use this certificate for our TLS mutually authenticated connection:
$bSuccess = $oFtp.SetSslClientCert($oCert)
If ($bSuccess = False) Then
ConsoleWrite($oCert.LastErrorText & @CRLF)
Exit
EndIf
; Establish the TLS connection with the FTP server.
$bSuccess = $oFtp.ConnectOnly()
If ($bSuccess = False) Then
ConsoleWrite($oFtp.LastErrorText & @CRLF)
Exit
EndIf
; If a login is required, then login with the FTP account login/password.
$oFtp.Username = "myLogin"
$oFtp.Password = "myPassword"
$bSuccess = $oFtp.LoginAfterConnectOnly()
If ($bSuccess = False) Then
ConsoleWrite($oFtp.LastErrorText & @CRLF)
Exit
EndIf
; Do whatever you're doing to do ...
; upload files, download files, etc...
; .....
; .....
$bSuccess = $oFtp.Disconnect()