Contents

SecTrustGetCertificateAtIndex(_:_:)

Returns a specific certificate from the certificate chain used to evaluate trust.

Declaration

func SecTrustGetCertificateAtIndex(_ trust: SecTrust, _ ix: CFIndex) -> SecCertificate?

Parameters

  • trust:

    The trust management object for the certificate that has been evaluated. Use the Sectrustcreatewithcertificates(_:_:_:) function to create a trust management object and the Sectrustevaluatewitherror(_:_:) function to evaluate the certificate chain.

  • ix:

    The index number of the requested certificate. Index numbers start at 0 for the leaf certificate and end at the anchor (or the last certificate if no anchor was found). Use the Sectrustgetcertificatecount(_:) function to get the total number of certificates in the chain.

Return Value

A certificate object for the requested certificate.

Discussion

Call the SecTrustEvaluateWithError(_:_:) function before calling this function.