---
title: "seal(_:)"
framework: cryptokit
role: symbol
role_heading: Instance Method
path: "cryptokit/hpke/sender/seal(_:)"
---

# seal(_:)

Encrypts the given cleartext message.

## Declaration

```swift
mutating func seal<M>(_ msg: M) throws -> Data where M : DataProtocol
```

## Parameters

- `msg`: The cleartext message to encrypt.

## Return Value

Return Value The ciphertext for the recipient to decrypt.

## Discussion

Discussion You can call this method multiple times to encrypt a series of messages. When using this method, you need to supply ciphertext messages to the decryption code on the receiving side in the same order as you encrypt them. note: The system throws errors from HPKE.Errors when it encounters them.
