全部,
我能够获得表示 X.509 证书的 SecCertificate 对象。我的目标是以人类可读的格式获取其余的证书信息。这是我目前所拥有的:
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)")
}
作为打印输出,我只获得了人类可读格式的证书通用名称,但是我遗漏了证书的其余信息。 如果您能帮我解决这个问题,我将不胜感激。
谢谢,
最佳答案
我也是,我得到了同样的东西,证书通用名称。 您可以使用 SecCertificateCopyEmailAddresses 等其他复制功能获取有关证书的更多信息,请参阅此链接:certificate email . 在macOs中还可以找到证书复制长描述功能。
关于ios - SecCertificateCopySubjectSummary : How to get Certificate Information in human readable form?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45486588/