<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/Curve25519/KeyAgreement/PublicKey",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit10Curve25519O12KeyAgreementO06PublicD0V"
  },
  "title" : "Curve25519.KeyAgreement.PublicKey"
}
-->

# Curve25519.KeyAgreement.PublicKey

A Curve25519 public key used for key agreement.

```
struct PublicKey
```

## Topics

### Creating a public key

[`init<D>(rawRepresentation: D) throws`](/documentation/CryptoKit/Curve25519/KeyAgreement/PublicKey/init(rawRepresentation:))

Creates a Curve25519 public key for key agreement from a
collection of bytes.

### Representing the key

[`var rawRepresentation: Data`](/documentation/CryptoKit/Curve25519/KeyAgreement/PublicKey/rawRepresentation)

A representation of the Curve25519 public key as a collection of
bytes.

### Type Aliases

[`typealias HPKEEphemeralPrivateKey`](/documentation/CryptoKit/Curve25519/KeyAgreement/PublicKey/HPKEEphemeralPrivateKey)

The type of the ephemeral private key associated with this public key.

### Default Implementations

[HPKEDiffieHellmanPublicKey Implementations](/documentation/CryptoKit/Curve25519/KeyAgreement/PublicKey/HPKEDiffieHellmanPublicKey-Implementations)

[HPKEPublicKeySerialization Implementations](/documentation/CryptoKit/Curve25519/KeyAgreement/PublicKey/HPKEPublicKeySerialization-Implementations)

## Relationships

### Conforms To

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

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

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

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

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

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

---

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)