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

# CMSEncoderAddSupportingCerts(_:_:)

Adds certificates to a message.

```
func CMSEncoderAddSupportingCerts(_ cmsEncoder: CMSEncoder, _ certOrArray: CFTypeRef) -> OSStatus
```

## Parameters

`cmsEncoder`

The CMSEncoder reference returned by the `CMSEncoderCreate` function.

`certOrArray`

Either a single certificate, specified as a certificate object (type `SecCertificateRef`), or a set of certificates specified as a `CFArray` of certificate objects.

## 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 add such certificates to a message. It is not necessary to call this function for a normal signed message. When you create a signed message, Cryptographic Message Services automatically adds the signer certificates and any intermediate certificates needed to verify the signers.

You can use this function even if you don’t sign or encrypt the message, in order to transport one or more certificates. To do so, call `CMSEncoderCreate` to obtain a `CMSEncoderRef` reference, call `CMSEncoderAddSupportingCerts` one or more times, and then call `CMSEncoderCopyEncodedContent` to complete the message. No additional content need be specified.

If you do add content to the message in addition to the certificates, you must call this function before the first call to the `CMSEncoderUpdateContent` function.

## See Also

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

Feeds content bytes into the encoder.

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

Creates a CMSEncoder reference.

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

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

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

Finishes encoding the message and obtains the encoded result.

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

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



---

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)