Hello!
I am a newby into Apple ecosystem/swift development so forgive me if it is a trivial question. But I cannot find a good tutorial/article on this topic.
I am trying to implement a mutual TLS for my iOS application. To generate key/certificate I use https://github.com/apple/swift-* libraries.
Next moving to mTLS logic. I use URLSessionDelegate for this purpose as it seems it is the only way to implement mTLS. The NSURLAuthenticationMethodServerTrust part seems fine. Now I am trying to implement the client side of the authentication.
let identity = ???
let urlCredential = URLCredential(
identity: identity,
certificates: nil,
persistence: .none)
completionHandler(.useCredential, urlCredential)
And here is my question. What is the correct/idiomatic way to create SecIdentityRef object out of a private key/certificate? Certificate can be serialized into DER form if needed.
I googled for a whole day and did not find a clear information on how to create the identity I need.
If anyone has some information on this topic, could you please help me?