Obtains an array of all of the certificates in a message.


func CMSDecoderCopyAllCerts(_ cmsDecoder: CMSDecoder, _ certsOut: UnsafeMutablePointer<CFArray?>) -> OSStatus



The CMSDecoder reference returned by the CMSDecoderCreate function.


On return, points to an array of SecCertificateRef objects. Returns NULL if the message does not contain any certificates (the message was encrypted but not signed); this is not considered an error. You must use the CFRelease function to free this reference when you are finished using it.

Return Value


A CMS message can contain arbitrary sets of certificates other than or in addition to those indicating the identity of signers. You can use this function to retrieve such certificates from a message. If the message was signed, it contains signer certificates. You can use the CMSDecoderGetNumSigners(_:_:) and CMSDecoderCopySignerCert(_:_:_:) functions to retrieve the certificates for a specific signer.

You cannot call this function until after you have called the CMSDecoderFinalizeMessage(_:) function.