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

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

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

```
static func deriveKey<Salt, Info>(inputKeyMaterial: SymmetricKey, salt: Salt, info: Info, outputByteCount: Int) -> SymmetricKey where Salt : DataProtocol, Info : DataProtocol
```

## 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.

`outputByteCount`

The length in bytes of the resulting symmetric key.

## Return Value

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)