<!--
{
  "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/DiffieHellmanKeyAgreement",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit25DiffieHellmanKeyAgreementP"
  },
  "title" : "DiffieHellmanKeyAgreement"
}
-->

# DiffieHellmanKeyAgreement

A Diffie-Hellman Key Agreement Key

```
@preconcurrency protocol DiffieHellmanKeyAgreement : Sendable
```

## Topics

### Associated Types

[`associatedtype PublicKey : Sendable`](/documentation/CryptoKit/DiffieHellmanKeyAgreement/PublicKey-swift.associatedtype)

The public key share type to perform the DH Key Agreement

### Instance Properties

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

### Instance Methods

[`func sharedSecretFromKeyAgreement(with: Self.PublicKey) throws -> SharedSecret`](/documentation/CryptoKit/DiffieHellmanKeyAgreement/sharedSecretFromKeyAgreement(with:))

Performs a Diffie-Hellman Key Agreement.

## Relationships

### Conforming Types

[`PrivateKey`](/documentation/CryptoKit/SecureEnclave/P256/KeyAgreement/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/Curve25519/KeyAgreement/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/P256/KeyAgreement/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/P384/KeyAgreement/PrivateKey)

[`PrivateKey`](/documentation/CryptoKit/P521/KeyAgreement/PrivateKey)

### Inherits From

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

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

### Inherited By

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

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

---

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)