<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/CMSEncoderCopySupportingCerts(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@CMSEncoderCopySupportingCerts"
  },
  "title" : "CMSEncoderCopySupportingCerts(_:_:)"
}
-->

# CMSEncoderCopySupportingCerts(_:_:)

Obtains the certificates added to a message with `CMSEncoderAddSupportingCerts`.

```
func CMSEncoderCopySupportingCerts(_ cmsEncoder: CMSEncoder, _ certsOut: UnsafeMutablePointer<CFArray?>) -> OSStatus
```

## Parameters

`cmsEncoder`

The CMSEncoder reference returned by the `CMSEncoderCreate` function.

`certsOut`

On return, points to a CFArray of `SecCertificateRef` objects. You must use the `CFRelease` function to free this reference when you are finished using it.

## Return Value

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes).

## Discussion

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 obtain any such certificates added with the `CMSEncoderAddSupportingCerts` function.  If `CMSEncoderAddSupportingCerts` has not been called, this function returns a `NULL` value for `certsOut`. Note that this function does not return the signing certificates, if any.

## See Also

[`CMSEncoderCreate(_:)`](/documentation/Security/CMSEncoderCreate(_:))

Creates a CMSEncoder reference.

[`CMSEncoderAddSupportingCerts(_:_:)`](/documentation/Security/CMSEncoderAddSupportingCerts(_:_:))

Adds certificates to a message.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)