Sample code for 30+ languages & platforms
PowerBuilder

Set the FTP TLS Version and Ciphers

See more FTP Examples

Demonstrates the TLS negotiation properties SslProtocol and SslAllowedCiphers, and reads back the negotiated TlsVersion and TlsCipherSuite after connecting.

Background: SslProtocol sets the allowed (or minimum) TLS version — default lets Chilkat negotiate the best available, while a value like TLS 1.2 or higher enforces a floor for policy compliance. SslAllowedCiphers narrows the offered cipher suites, which most applications should leave at the secure defaults. The read-only TlsVersion and TlsCipherSuite report what was actually agreed, useful for logging and audits.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Ftp

li_Success = 0

loo_Ftp = create oleobject
li_rc = loo_Ftp.ConnectToNewObject("Chilkat.Ftp2")
if li_rc < 0 then
    destroy loo_Ftp
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Ftp.Hostname = "ftp.example.com"
loo_Ftp.Username = "myFtpLogin"

loo_Ftp.AuthTls = 1

//  Normally you would not hard-code the password in source.  You should instead obtain it
//  from an interactive prompt, environment variable, or a secrets vault.
loo_Ftp.Password = "myPassword"

//  Require at least TLS 1.2.  Accepted values include "default", "TLS 1.3", "TLS 1.2",
//  "TLS 1.2 or higher", and so on.  "default" lets Chilkat negotiate the best available.
loo_Ftp.SslProtocol = "TLS 1.2 or higher"

//  Optionally restrict the cipher suites offered.  Leave empty to use Chilkat's secure defaults.
loo_Ftp.SslAllowedCiphers = "TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256"

li_Success = loo_Ftp.Connect()
if li_Success = 0 then
    Write-Debug loo_Ftp.LastErrorText
    destroy loo_Ftp
    return
end if

//  After connecting, read back what was actually negotiated.
Write-Debug "Negotiated TLS version: " + loo_Ftp.TlsVersion
Write-Debug "Negotiated cipher suite: " + loo_Ftp.TlsCipherSuite

li_Success = loo_Ftp.Disconnect()
if li_Success = 0 then
    Write-Debug loo_Ftp.LastErrorText
    destroy loo_Ftp
    return
end if



destroy loo_Ftp