<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/AES/KeyWrap/wrap(_:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit3AESO7KeyWrapO4wrap_5using10Foundation4DataVAA09SymmetricD0V_ALtKFZ"
  },
  "title" : "wrap(_:using:)"
}
-->

# wrap(_:using:)

Wraps a key using the AES wrap algorithm.

```
static func wrap(_ keyToWrap: SymmetricKey, using kek: SymmetricKey) throws -> Data
```

## Parameters

`keyToWrap`

The key to wrap.

`kek`

The key encryption key.

## Return Value

The wrapped key.

## Discussion

Wrap is an implementation of the AES key wrap algorithm as specified
in IETF RFC 3394.

---

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)