---
title: "seal(_:using:nonce:)"
framework: cryptokit
role: symbol
role_heading: Type Method
path: "cryptokit/aes/gcm/seal(_:using:nonce:)"
---

# seal(_:using:nonce:)

Secures the given plaintext message with encryption and an authentication tag.

## Declaration

```swift
static func seal<Plaintext>(_ message: Plaintext, using key: SymmetricKey, nonce: AES.GCM.Nonce? = nil) throws -> AES.GCM.SealedBox where Plaintext : 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().

## Return Value

Return Value The sealed message.

## See Also

### Securing the plaintext message

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