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
(Tcl) FTPS with Mutual TLS Authentication (TLS Client Certificate)Demonstrates how to do mutual TLS authentication (using a client certificate from a .pfx/.p12).
load ./chilkat.dll # This example requires the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. set ftp [new_CkFtp2] CkFtp2_put_Hostname $ftp "ftp.example.com" CkFtp2_put_Port $ftp 21 # If using implicit TLS, you probably want port 990.. CkFtp2_put_Port $ftp 990 # Set this to 0 for implicit TLS, otherwise set to 1 for explicit TLS (where port is typically 21). CkFtp2_put_AuthTls $ftp 0 # Set this to 1 for implicit TLS, otherwise set to 0. CkFtp2_put_Ssl $ftp 1 set cert [new_CkCert] set success [CkCert_LoadPfxFile $cert "qa_data/pfx/example.pfx" "pfx_password"] if {$success == 0} then { puts [CkCert_lastErrorText $cert] delete_CkFtp2 $ftp delete_CkCert $cert exit } # Use this certificate for our TLS mutually authenticated connection: set success [CkFtp2_SetSslClientCert $ftp $cert] if {$success == 0} then { puts [CkCert_lastErrorText $cert] delete_CkFtp2 $ftp delete_CkCert $cert exit } # Establish the TLS connection with the FTP server. set success [CkFtp2_ConnectOnly $ftp] if {$success == 0} then { puts [CkFtp2_lastErrorText $ftp] delete_CkFtp2 $ftp delete_CkCert $cert exit } # If a login is required, then login with the FTP account login/password. CkFtp2_put_Username $ftp "myLogin" CkFtp2_put_Password $ftp "myPassword" set success [CkFtp2_LoginAfterConnectOnly $ftp] if {$success == 0} then { puts [CkFtp2_lastErrorText $ftp] delete_CkFtp2 $ftp delete_CkCert $cert exit } # Do whatever you're doing to do ... # upload files, download files, etc... # ..... # ..... set success [CkFtp2_Disconnect $ftp] delete_CkFtp2 $ftp delete_CkCert $cert |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.