---
title: "CMSEncoderAddSupportingCerts(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/cmsencoderaddsupportingcerts(_:_:)"
---

# CMSEncoderAddSupportingCerts(_:_:)

Adds certificates to a message.

## Declaration

```swift
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

Return Value A result code. See Security Framework Result Codes.

## Discussion

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

### Related Documentation

- [CMSEncoderUpdateContent(_:_:_:)](security/cmsencoderupdatecontent(_:_:_:).md)
- [CMSEncoderCreate(_:)](security/cmsencodercreate(_:).md)
- [CMSDecoderCopyAllCerts(_:_:)](security/cmsdecodercopyallcerts(_:_:).md)
- [CMSEncoderCopyEncodedContent(_:_:)](security/cmsencodercopyencodedcontent(_:_:).md)
- [CMSEncoderCopySupportingCerts(_:_:)](security/cmsencodercopysupportingcerts(_:_:).md)
