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

# CMSDecoderCopyContent(_:_:)

Obtains the message content, if any.

```
func CMSDecoderCopyContent(_ cmsDecoder: CMSDecoder, _ contentOut: UnsafeMutablePointer<CFData?>) -> OSStatus
```

## Parameters

`cmsDecoder`

The CMSDecoder reference returned by the `CMSDecoderCreate` function.

`contentOut`

On return, points to the message’s content. Returns `NULL` if the content is detached. 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

If the message has detached content, you are responsible for retrieving the content. In that case, you use the [`CMSDecoderSetDetachedContent(_:_:)`](/documentation/Security/CMSDecoderSetDetachedContent(_:_:)) function to tell the decoder the location of the content.

You cannot call this function until after you have called the `CMSDecoderFinalizeMessage` function.

## See Also

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

Specifies whether the signed data is to be separate from the message.

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

Specifies the message’s detached content, if any.

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

Creates a CMSDecoder reference.

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

Indicates that there is no more data to decode.



---

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)