---
title: "decapsulate(_:)"
framework: cryptokit
role: symbol
role_heading: Instance Method
path: "cryptokit/kemprivatekey/decapsulate(_:)"
---

# decapsulate(_:)

Recovers a shared secret from an encapsulated representation.

## Declaration

```swift
func decapsulate(_ encapsulated: Data) throws -> SymmetricKey
```

## Parameters

- `encapsulated`: The encapsulated shared secret that someone created using this key’s doc://com.apple.CryptoKit/documentation/CryptoKit/KEMPrivateKey/publicKey-swift.property.

## Return Value

Return Value The decapsulated shared secret.
