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

# seal(_:authenticating:)

Encrypts the given cleartext message and attaches additional authenticated data.

## Declaration

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

## Parameters

- `msg`: The cleartext message to encrypt.
- `aad`: Additional data that the Sender authenticates and adds to the message in cleartext.

## 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.
