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

# CMSEncoderUpdateContent(_:_:_:)

Feeds content bytes into the encoder.

```
func CMSEncoderUpdateContent(_ cmsEncoder: CMSEncoder, _ content: UnsafeRawPointer, _ contentLen: Int) -> OSStatus
```

## Parameters

`cmsEncoder`

The CMSEncoder reference returned by the `CMSEncoderCreate` function.

`content`

The content that you want to add to the message. The content must conform to the type set with the [`CMSEncoderSetEncapsulatedContentType`](/documentation/Security/CMSEncoderSetEncapsulatedContentType) function (or type `id-data` if that function has not been called).

`contentLen`

The length of the content being added, in bytes.

## Return Value

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

## Discussion

You use this function to add the content that is to be signed or encrypted. If the message is only a container for certificates added with the [`CMSEncoderAddSupportingCerts(_:_:)`](/documentation/Security/CMSEncoderAddSupportingCerts(_:_:)) function and has no other content, do not call this function. This function can be called multiple times.

After you are finished adding content, call the `CMSEncoderCopyEncodedContent` function to complete the message creation process.

None of the setter functions ([`CMSEncoderSetHasDetachedContent(_:_:)`](/documentation/Security/CMSEncoderSetHasDetachedContent(_:_:)), [`CMSEncoderSetEncapsulatedContentType`](/documentation/Security/CMSEncoderSetEncapsulatedContentType), or [`CMSEncoderSetCertificateChainMode(_:_:)`](/documentation/Security/CMSEncoderSetCertificateChainMode(_:_:))) can be called after this function has been called.

---

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)