---
title: "gss_wrap(_:_:_:_:_:_:_:)"
framework: GSS
role: symbol
role_heading: Function
platforms: [iOS 5.0+, iPadOS 5.0+, Mac Catalyst 13.1+, macOS 10.7+, visionOS 1.0+]
path: "gss/gss_wrap(_:_:_:_:_:_:_:)"
---

# gss_wrap(_:_:_:_:_:_:_:)

Returns a secure message created by calculating and attaching a MIC to the input message, and then optionally encrypting it.

## Declaration

```swift
func gss_wrap(_ minor_status: UnsafeMutablePointer<OM_uint32>, _ context_handle: gss_ctx_id_t, _ conf_req_flag: Int32, _ qop_req: gss_qop_t, _ input_message_buffer: gss_buffer_t, _ conf_state: UnsafeMutablePointer<Int32>?, _ output_message_buffer: gss_buffer_t) -> OM_uint32
```

## Parameters

- `minor_status`: A pointer to the secondary status result that provides additional information in case of failure.
- `context_handle`: The context used to send the message.
- `conf_req_flag`: A flag you set to zero to request that only that the message integrity check be applied, or to anything non-zero to request both integrity checking and confidentiality (encryption) of the message.
- `qop_req`: The quality of protection requested for the encryption. See Quality of Protection Constants in doc://com.apple.gss/documentation/GSS/object-identifiers for valid values.
- `input_message_buffer`: A buffer containing the message to protect.
- `conf_state`: A pointer the function uses to indicate what protection is actually applied to the message. A value of zero indicates only integrity checking. A non-zero value indicates both integrity checking and confidentiality. Pass NULL to ignore this output.
- `output_message_buffer`: A buffer the function fills with the fully wrapped message, ready for transport to the peer. Release the buffer using a call to doc://com.apple.gss/documentation/GSS/gss_release_buffer(_:_:) when you are done with it.

## Return Value

Return Value A status code set to GSS_S_COMPLETE on success. See Function Status for a complete enumeration of status outputs.

## See Also

### Message Wrapping and Verification

- [gss_get_mic(_:_:_:_:_:)](gss/gss_get_mic(_:_:_:_:_:).md)
- [gss_verify_mic(_:_:_:_:_:)](gss/gss_verify_mic(_:_:_:_:_:).md)
- [gss_unwrap(_:_:_:_:_:_:)](gss/gss_unwrap(_:_:_:_:_:_:).md)
- [gss_sign(_:_:_:_:_:)](gss/gss_sign(_:_:_:_:_:).md)
- [gss_verify(_:_:_:_:_:)](gss/gss_verify(_:_:_:_:_:).md)
- [gss_seal(_:_:_:_:_:_:_:)](gss/gss_seal(_:_:_:_:_:_:_:).md)
- [gss_unseal(_:_:_:_:_:_:)](gss/gss_unseal(_:_:_:_:_:_:).md)
