NSURLAuthenticationMethodClientCertificate & Keychain certificate

Hello everyone,

i would like to support the NSURLAuthenticationMethodClientCertificate method on a macOS app. I have a certificate, that is saved in keychain.

What i would like to achieve is, when I become the NSURLAuthenticationMethodClientCertificate method, to get information from URLAuthenticationChallenge and based on that search for the right certificate in the keychain service.

So far, I have the following idea: From URLAuthenticationChallenge, I can get the acceptable certificate issuing authorities:

let acceptableCertificateAuthorities = challenge.protectionSpace.distinguishedName

At the end, i have a keychain service that should query based on kSecMatchIssuers.

How do I become the information from acceptableCertificateAuthorities(which is [Data]?) to CFArray of ASN.1 DER Encoding based on which I can query the certificate in the keychain?

Thanks in advance.

NSURLAuthenticationMethodClientCertificate & Keychain certificate
 
 
Q