---
title: "CMSDecoderSetDetachedContent(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/cmsdecodersetdetachedcontent(_:_:)"
---

# CMSDecoderSetDetachedContent(_:_:)

Specifies the message’s detached content, if any.

## Declaration

```swift
func CMSDecoderSetDetachedContent(_ cmsDecoder: CMSDecoder, _ detachedContent: CFData) -> OSStatus
```

## Parameters

- `cmsDecoder`: The CMSDecoder reference returned by the CMSDecoderCreate function.
- `detachedContent`: A reference to the message’s detached content.

## Return Value

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

## Discussion

Discussion The data of a signed CMS message can optionally be sent separately from the message. If the message’s content is detached from the message, you must call this function to tell the decoder where to find the message content. Encrypted messages, including those that are also signed, cannot use detached content. You can call this function either before or after decoding the message (by calling the CMSDecoderUpdateMessage and CMSDecoderFinalizeMessage functions). If a signed message has detached content, however, you must call this function before you can use the CMSDecoderCopySignerStatus function to ascertain the signature status.

## See Also

### Related Documentation

- [CMSEncoderSetHasDetachedContent(_:_:)](security/cmsencodersethasdetachedcontent(_:_:).md)
- [CMSDecoderCreate(_:)](security/cmsdecodercreate(_:).md)
- [CMSDecoderCopySignerStatus(_:_:_:_:_:_:_:)](security/cmsdecodercopysignerstatus(_:_:_:_:_:_:_:).md)
