How can I create secIdentity from utilizing the DigiCert World Root G2
from https://study.microsoft.com/en-us/azure/safety/fundamentals/azure-ca-details?tabs=root-and-subordinate-cas-list
Because it is not going to have key.
I would like to make use of in mqtt SSL authentication as talked about https://github.com/emqx/CocoaMQTT/blob/4abf2d10315dff60661a32f1db5dcc45a9df9f09/Instance/Instance/ViewController.swift#L183 but it surely have .p12
with password
I used to be making an attempt one thing like this however its not working.
func loadCACertificate() -> CFArray?{
let certFilePath = Bundle.principal.path(forResource: "DigiCertGlobalRootG2", ofType: "crt")!
let certData = strive! Information(contentsOf: URL(fileURLWithPath: certFilePath))
let certDataNS = NSData(contentsOf: URL(fileURLWithPath: certFilePath))
print("Certificates knowledge: (String(describing: certDataNS))")
let rootCertificate = (SecCertificateCreateWithData(nil, certData as CFData) ?? "" as! SecCertificate) as SecCertificate
print("Root certificates: (rootCertificate)")
return rootCertificate
}