<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/AES/GCM/seal(_:using:nonce:authenticating:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit3AESO3GCMO4seal_5using5nonce14authenticatingAE9SealedBoxVx_AA12SymmetricKeyVAE5NonceVSgq_tK10Foundation12DataProtocolRzAqRR_r0_lFZ"
  },
  "title" : "seal(_:using:nonce:authenticating:)"
}
-->

# seal(_:using:nonce:authenticating:)

Secures the given plaintext message with encryption and an
authentication tag that covers both the encrypted data and
additional data.

```
static func seal<Plaintext, AuthenticatedData>(_ message: Plaintext, using key: SymmetricKey, nonce: AES.GCM.Nonce? = nil, authenticating authenticatedData: AuthenticatedData) throws -> AES.GCM.SealedBox where Plaintext : DataProtocol, AuthenticatedData : DataProtocol
```

## Parameters

`message`

The plaintext data to seal.

`key`

A cryptographic key used to seal the message.

`nonce`

The nonce the sealing process requires. If you don’t provide a nonce, the method generates a random one by invoking [`init()`](/documentation/CryptoKit/AES/GCM/Nonce/init()).

`authenticatedData`

Additional data to be authenticated.

## Return Value

The sealed message.

---

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)