---
title: "SecKeyWrapSymmetric(_:_:_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/seckeywrapsymmetric(_:_:_:_:)"
---

# SecKeyWrapSymmetric(_:_:_:_:)

Wraps a symmetric key with another key.

## Declaration

```swift
func SecKeyWrapSymmetric(_ keyToWrap: SecKey, _ wrappingKey: SecKey, _ parameters: CFDictionary, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> CFData?
```

## Parameters

- `keyToWrap`: The key to wrap.
- `wrappingKey`: The key to use when wrapping keyToWrap.
- `parameters`: A parameter list for the unwrapping process. This is usually either an empty dictionary or a dictionary containing a value for doc://com.apple.security/documentation/Security/kSecAttrSalt.
- `error`: A pointer to a doc://com.apple.documentation/documentation/CoreFoundation/CFError variable where an error object is stored upon failure. If not NULL, the caller is responsible for checking this variable and releasing the resulting object if it exists.

## Return Value

Return Value The wrapped key, or NULL on error. In Objective-C, call the CFRelease function to free the data’s memory when you are done with it.
