---
title: "exportSecret(context:outputByteCount:)"
framework: cryptokit
role: symbol
role_heading: Instance Method
path: "cryptokit/hpke/recipient/exportsecret(context:outputbytecount:)"
---

# exportSecret(context:outputByteCount:)

Exports a secret given domain-separation context and the desired output length.

## Declaration

```swift
func exportSecret<Context>(context: Context, outputByteCount: Int) throws -> SymmetricKey where Context : DataProtocol
```

## Parameters

- `context`: Application-specific information providing context on the use of this key.
- `outputByteCount`: The desired length of the exported secret.

## Return Value

Return Value The exported secret.
