---
title: "sharedSecretFromKeyAgreement(with:)"
framework: cryptokit
role: symbol
role_heading: Instance Method
path: "cryptokit/diffiehellmankeyagreement/sharedsecretfromkeyagreement(with:)"
---

# sharedSecretFromKeyAgreement(with:)

Performs a Diffie-Hellman Key Agreement.

## Declaration

```swift
func sharedSecretFromKeyAgreement(with publicKeyShare: Self.PublicKey) throws -> SharedSecret
```

## Parameters

- `publicKeyShare`: The public key share.

## Return Value

Return Value The resulting key agreement result.
