Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) FTPS with Client Cert from Windows Certificate StoreDemonstrates how to do mutual TLS authentication using a client certificate installed in the Windows certificate store.
; 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") Local $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() |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.