<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/MLKEM768/PublicKey",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Apple CryptoKit",
      "CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit8MLKEM768O9PublicKeyV"
  },
  "title" : "MLKEM768.PublicKey"
}
-->

# MLKEM768.PublicKey

A public key you use to encapsulate shared secrets with the Module-Lattice key encapsulation mechanism.

```
struct PublicKey
```

## Topics

### Creating a public key

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

Initializes a public key from a raw representation.

### Accessing a key’s raw representation

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

A serialized representation of the public key.

### Encapsulating a shared secret

[`func encapsulate() throws -> KEM.EncapsulationResult`](/documentation/CryptoKit/MLKEM768/PublicKey/encapsulate())

Generates and encapsulates a shared secret.

## Relationships

### Conforms To

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

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

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

---

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)