All,
I was able to get the SecCertificate object of representing an X.509 certificate. My goal is to get the rest of the certificate information in a human readable format. This is what I have so far:
func urlSession(_ session: URLSession, task:URLSessionTask, didREceive
challenge: URLAuthenticationChallenge, completionHandler: @escaping
(URLSession.AuthChallengeDisposition, URLCredential?) -> Void {
let serverTrust:SecTrust = challenge.protectionSpace.serverTrust!
let certificate: SecCertificate = SecTrustGetCertificateAtIndex
(serverTrust, 0)!
let summary = SecCertificateCopySubjectSummary(certificate)
print("Cert summary: \(summary)")
}
As a print out I am getting just the Common Name of the certificate in the human readable format, however I am missing the rest of the certificate information. I would really appreciate if you can help me to resolve this problem.
Thanks,