Need help regarding whether my RootCA have full access or not in Certificate Trust Setting.
- I wanted to check whether my rootCA is installed on user phone
Certificate Trust Setting
or not. which I'm able to do with piece of code.
let bundle = Bundle(for: type(of: self))
let rootCAName = "RootCA"
guard let filePath = bundle.path(forResource: rootCAName, ofType: "der"),
let data = try? Data(contentsOf: URL(fileURLWithPath: filePath)),
let certificate = SecCertificateCreateWithData(nil, data as CFData)
else {
return
}
// Check
var secTrust: SecTrust?
if SecTrustCreateWithCertificates(certificate, SecPolicyCreateBasicX509(), &secTrust) == errSecSuccess, let trust = secTrust {
SecTrustEvaluateAsyncWithError(trust, .global()) { trust, result, error in
print( "Cert => \(result ? "installed" : "not installed")")
}
}
- I wanted to know that user have given my
RootCA
full access or not inCertificate Trust Setting
. and I'm unable to find any api for that.
You can see in the image that one CA have full access and other not.
Anyone know any api or any source that can help me with this.