---
title: "CMSEncoderCopyEncodedContent(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/cmsencodercopyencodedcontent(_:_:)"
---

# CMSEncoderCopyEncodedContent(_:_:)

Finishes encoding the message and obtains the encoded result.

## Declaration

```swift
func CMSEncoderCopyEncodedContent(_ cmsEncoder: CMSEncoder, _ encodedContentOut: UnsafeMutablePointer<CFData?>) -> OSStatus
```

## Parameters

- `cmsEncoder`: The CMSEncoder reference returned by the CMSEncoderCreate function.
- `encodedContentOut`: On return, points to the encoded message. You must use the CFRelease function to free this reference when you are finished using it.

## Return Value

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

## Discussion

Discussion This is the last function in the sequence of encoding functions you call when creating a signed or encrypted message. In many cases, you can call the CMSEncode function alone instead of using the sequence of encoding functions.
