---
title: "CMSEncoderSetHasDetachedContent(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/cmsencodersethasdetachedcontent(_:_:)"
---

# CMSEncoderSetHasDetachedContent(_:_:)

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

## Declaration

```swift
func CMSEncoderSetHasDetachedContent(_ cmsEncoder: CMSEncoder, _ detachedContent: Bool) -> OSStatus
```

## Parameters

- `cmsEncoder`: The CMSEncoder reference returned by the doc://com.apple.security/documentation/Security/CMSEncoderCreate(_:) function.
- `detachedContent`: TRUE if the message should exclude the data to be signed. Prior to calling this function, the encoder defaults to FALSE for this setting, indicating that the message contains the data to be signed.

## Return Value

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

## Discussion

Discussion A signed CMS message can optionally be sent separately from the signed data. Set detachedContent to TRUE to indicate that the signed data is to be kept separate from the message. Encrypted messages, including those that are also signed, cannot use detached content. If you do call this function, you must call it before the first call to the CMSEncoderUpdateContent(_:_:_:) function.

## See Also

### Related Documentation

- [CMSEncoderGetHasDetachedContent(_:_:)](security/cmsencodergethasdetachedcontent(_:_:).md)
- [CMSEncoderUpdateContent(_:_:_:)](security/cmsencoderupdatecontent(_:_:_:).md)
- [CMSEncoderCreate(_:)](security/cmsencodercreate(_:).md)
- [CMSDecoderSetDetachedContent(_:_:)](security/cmsdecodersetdetachedcontent(_:_:).md)
