<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/HPKE/Sender/seal(_:authenticating:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4HPKEO6SenderV4seal_14authenticating10Foundation4DataVx_q_tKAH0H8ProtocolRzAhKR_r0_lF"
  },
  "title" : "seal(_:authenticating:)"
}
-->

# seal(_:authenticating:)

Encrypts the given cleartext message and attaches additional authenticated data.

```
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

The ciphertext for the recipient to decrypt.

## 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 ``doc://com.apple.CryptoKit/documentation/CryptoKit/HPKE/Errors`` when it encounters them.

---

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)