---
title: "seal(_:using:nonce:authenticating:)"
framework: cryptokit
role: symbol
role_heading: Type Method
path: "cryptokit/aes/gcm/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.

## Declaration

```swift
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 doc://com.apple.CryptoKit/documentation/CryptoKit/AES/GCM/Nonce/init().
- `authenticatedData`: Additional data to be authenticated.

## Return Value

Return Value The sealed message.

## See Also

### Securing the plaintext message

- [seal(_:using:nonce:)](cryptokit/aes/gcm/seal(_:using:nonce:).md)
