How to get the certificate in a trusted root certificate list available in IOS

How to get the certificate content in the trusted root certificate list available in IOS, similar to the Mac platform using the SecTrustSettingsCopyCertificates function to obtain the certificate content and further convert the certificate into the X509 format through the function d2i_X509

Whether the root certificate manually installed is stored with the root certificate of the system, and whether the acquisition method is the same

Replies

There’s no way to programmatically get a list of all trusted root certificates on iOS. We publish this list for users (see KMT’s response) but that’s not a programmatic solution.

Why do you need this? There are workarounds in some circumstances (for example, testing if a specific root certificate is installed), so if you can explain your situation I may be able to help further.

convert the certificate into the X509 format through the function d2i_X509

Just FYI, you can do that trivially using

SecCertificateCopyData
.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I want to get manually installed certificates for SSL verification.

Is there any function that i can use like SecTrustSettingsCopyCertificates.

I want to get manually installed certificates for SSL verification.

That shouldn’t be necessary. Rather, you should do trust evaluation with a trust object (

SecTrust
) which will automatically take into account manually installed root certificates.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

How to get the trust object(SecTrust)?

I mean which function that i can use?

See our Creating a Trust Object document.

ps If you go to the developer web site and enter “SecTrust” into the search box, the first hit is the main SecTrust reference page and the first item on that page is a link to the above-mentioned document.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"