Sample code for 30+ languages & platforms
Swift

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let http = CkoHttp()!
    let cert = CkoCert()!

    success = http.getServerCert(domain: "chilkatsoft.com", port: 443, cert: cert)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("\(cert.subjectDN!)")
    print("\(cert.validToStr!)")

    // Output:

    // CN=*.chilkatsoft.com
    // Wed, 10 Jun 2026 23:59:59 GMT

}