Hey everyone,
I am trying to successfully authenticate in a a system using a certificate stored in the phone (Xcode simulator in this case). I am using Alamofire to do this. Actually, following their documentation, I set the trust certificates of the server url to the session
I have seen that probably the best way is to authenticate using the URLCredentials, but I am not able to obtain this from the certificates of the system.
Trying to use my own certificate, I've done something like this:
As you can see I find .p12 extension certificate directly from the resources (although I am getting Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value), but my final objetive it's to get my app showing that a client certificate is required, allowing this to use the certificate installed on his device when connecting to the website.
Thanks in advance.
I am trying to successfully authenticate in a a system using a certificate stored in the phone (Xcode simulator in this case). I am using Alamofire to do this. Actually, following their documentation, I set the trust certificates of the server url to the session
Code Block let manager = ServerTrustManager(evaluators: [location: PinnedCertificatesTrustEvaluator()]) let session = Session(serverTrustManager: manager)
I have seen that probably the best way is to authenticate using the URLCredentials, but I am not able to obtain this from the certificates of the system.
Trying to use my own certificate, I've done something like this:
Code Block let filePath = Bundle.main.path(forResource: "alvaro", ofType: "p12")! let data = try! Data(contentsOf: URL(fileURLWithPath: filePath)) let certificate = SecCertificateCreateWithData(nil, data as CFData)!
As you can see I find .p12 extension certificate directly from the resources (although I am getting Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value), but my final objetive it's to get my app showing that a client certificate is required, allowing this to use the certificate installed on his device when connecting to the website.
Thanks in advance.