<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/HKDF/deriveKey(inputKeyMaterial:salt:info:output:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4HKDFV9deriveKey05inputE8Material4salt4info6outputyAA09SymmetricE0V_s7RawSpanVSgAMs06OutputlM0VztFZ"
  },
  "title" : "deriveKey(inputKeyMaterial:salt:info:output:)"
}
-->

# deriveKey(inputKeyMaterial:salt:info:output:)

Derives a symmetric encryption key from a main key or passcode using
HKDF key derivation with information and salt you specify.

```
static func deriveKey(inputKeyMaterial: SymmetricKey, salt: RawSpan? = nil, info: RawSpan? = nil, output outputKey: inout OutputRawSpan)
```

## Parameters

`inputKeyMaterial`

The main key or passcode the derivation function
uses to derive a key.

`salt`

The salt to use for key derivation.

`info`

The shared information to use for key derivation.

`outputKey`

An output span that will be populated with the derived
symmetric key.

---

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)