<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/KEMPrivateKey",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit13KEMPrivateKeyP"
  },
  "title" : "KEMPrivateKey"
}
-->

# KEMPrivateKey

The private key for a key encapsulation mechanism.

```
@preconcurrency protocol KEMPrivateKey : Sendable
```

## Topics

### Associated Types

[`associatedtype PublicKey : KEMPublicKey`](/documentation/CryptoKit/KEMPrivateKey/PublicKey-swift.associatedtype)

### Instance Properties

[`var publicKey: Self.PublicKey`](/documentation/CryptoKit/KEMPrivateKey/publicKey-swift.property)

The associated public key.

### Instance Methods

[`func decapsulate(Data) throws -> SymmetricKey`](/documentation/CryptoKit/KEMPrivateKey/decapsulate(_:))

Recovers a shared secret from an encapsulated representation.

### Type Methods

[`static func generate() throws -> Self`](/documentation/CryptoKit/KEMPrivateKey/generate())

Generates a new random private key.

## Relationships

### Inherits From

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

### Conforming Types

[`PrivateKey`](/documentation/CryptoKit/SecureEnclave/MLKEM1024/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/MLKEM1024/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/SecureEnclave/MLKEM768/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/MLKEM768/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/XWingMLKEM768X25519/PrivateKey)

### Inherited By

[`HPKEKEMPrivateKey`](/documentation/CryptoKit/HPKEKEMPrivateKey)

[`HPKEKEMPrivateKeyGeneration`](/documentation/CryptoKit/HPKEKEMPrivateKeyGeneration)

---

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)