I am using Alamofire in my app and I have to use a public certificate pinning. So far I have implemented below code for the same.
My domain name is api.xx.xxx.com
private static var manager: SessionManager? {
let url = Configuration.baseUrl
IFLOG(url.getDomain()!)
let serverTrustPolicy = ServerTrustPolicy.pinCertificates(
certificates: ServerTrustPolicy.certificates(),
validateCertificateChain: true,
validateHost: true
)
let serverTrustPolicies: [String: ServerTrustPolicy] = [
url.getDomain()!: serverTrustPolicy
]
let config = URLSessionConfiguration.default
return SessionManager(configuration: config, serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies))
}
Here my question is how to get public key for the host and in which format (cer or der)save in Xcode and how this public key picked by Alamofire.
Thanks