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

# CMSDecoderFinalizeMessage(_:)

Indicates that there is no more data to decode.

```
func CMSDecoderFinalizeMessage(_ cmsDecoder: CMSDecoder) -> OSStatus
```

## Parameters

`cmsDecoder`

The CMSDecoder reference returned by the `CMSDecoderCreate` function.

## Return Value

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes). Returns [`errSecUnknownFormat`](/documentation/Security/errSecUnknownFormat) upon detection of an improperly formatted CMS message.

## Discussion

When you call this function, the decoder finishes decoding the message. If the message was encrypted and this function returns a result code of `noErr`, the message was successfully decrypted. Call the [`CMSDecoderCopyContent(_:_:)`](/documentation/Security/CMSDecoderCopyContent(_:_:)) function to retrieve the message content. Call the [`CMSDecoderGetNumSigners(_:_:)`](/documentation/Security/CMSDecoderGetNumSigners(_:_:)) function to find out if the message was signed and, if so, how many signers there were.

## See Also

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

Obtains the number of signers of a message.

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

Creates a CMSDecoder reference.

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

Obtains the message content, if any.



---

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)