Swift
Swift
Transition from Http.GetServerSslCert to Http.GetServerCert
See more HTTP Examples
Provides instructions for replacing deprecated GetServerSslCert method calls with GetServerCert.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
let http = CkoHttp()!
var domain: String? = "chilkatsoft.com"
var port: Int = 443
// ------------------------------------------------------------------------
// The GetServerSslCert method is deprecated:
var cert1: CkoCert? = http.getServerSslCert(domain: domain, port: port)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
print("\(cert1!.subjectDN!)")
cert1 = nil
// ------------------------------------------------------------------------
// Do the equivalent using GetServerCert.
// Your application creates a new, empty certificate object which is passed
// in the last argument and filled with the server certificate upon success.
let cert2 = CkoCert()!
success = http.getServerCert(domain: domain, port: port, cert: cert2)
if success == false {
print("\(http.lastErrorText!)")
return
}
print("\(cert2.subjectDN!)")
}