---
title: "hpkeRepresentation(kem:)"
framework: cryptokit
role: symbol
role_heading: Instance Method
path: "cryptokit/p384/keyagreement/publickey/hpkerepresentation(kem:)"
---

# hpkeRepresentation(kem:)

Creates a serialized representation of the public key.

## Declaration

```swift
func hpkeRepresentation(kem: HPKE.KEM) throws -> Data
```

## Return Value

Return Value The serialized representation of the public key.

## Discussion

Discussion kem: The Key Encapsulation Mechanism to use with the public key. note: HPKE.Errors.inconsistentCiphersuiteAndKey if the key encapsulation mechanism requested is incompatible with this public key.
