fix cert parsing for ios 12

This commit is contained in:
Dango Mango 2023-10-05 14:29:41 +08:00
parent 0157c8ec7c
commit fb323b3033
2 changed files with 2 additions and 8 deletions

View File

@ -10,9 +10,6 @@ import Foundation
extension SecCertificate { extension SecCertificate {
var data: Data { var data: Data {
let serverCertificateCFData = SecCertificateCopyData(self) let serverCertificateCFData = SecCertificateCopyData(self)
let data = CFDataGetBytePtr(serverCertificateCFData) return serverCertificateCFData as Data
let size = CFDataGetLength(serverCertificateCFData)
let certificateData = NSData(bytes: data, length: size)
return Data(certificateData)
} }
} }

View File

@ -10,9 +10,6 @@ import Foundation
extension SecCertificate { extension SecCertificate {
var data: Data { var data: Data {
let serverCertificateCFData = SecCertificateCopyData(self) let serverCertificateCFData = SecCertificateCopyData(self)
let data = CFDataGetBytePtr(serverCertificateCFData) return serverCertificateCFData as Data
let size = CFDataGetLength(serverCertificateCFData)
let certificateData = NSData(bytes: data, length: size)
return Data(certificateData)
} }
} }