<!--
{
  "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/ChaChaPoly/SealedBox",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Apple CryptoKit",
      "CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit03ChaC4PolyO9SealedBoxV"
  },
  "title" : "ChaChaPoly.SealedBox"
}
-->

# ChaChaPoly.SealedBox

A secure container for your data that you access using a cipher.

```
@frozen struct SealedBox
```

## Overview

Use a sealed box as a container for data that you want to transmit
securely. Seal data into a box with one of the cipher algorithms, like
[`seal(_:using:nonce:)`](/documentation/CryptoKit/ChaChaPoly/seal(_:using:nonce:)).

The box holds an encrypted version of the original data, an
authentication tag, and the nonce during encryption. The encryption
makes the data unintelligible to anyone without the key, while the
authentication tag makes it possible for the intended receiver to be
sure the data remains intact.

The receiver uses another instance of the same cipher, like the
[`open(_:using:)`](/documentation/CryptoKit/ChaChaPoly/open(_:using:)) method, to open the box.

## Topics

### Creating the sealed box

[`init<D>(combined: D) throws`](/documentation/CryptoKit/ChaChaPoly/SealedBox/init(combined:))

Creates a sealed box from the given data.

[`init<C, T>(nonce: ChaChaPoly.Nonce, ciphertext: C, tag: T) throws`](/documentation/CryptoKit/ChaChaPoly/SealedBox/init(nonce:ciphertext:tag:))

Creates a sealed box from the given tag, nonce, and ciphertext.

### Retrieving the combined contents

[`let combined: Data`](/documentation/CryptoKit/ChaChaPoly/SealedBox/combined)

A combined element composed of the tag, the nonce, and the
ciphertext.

### Inspecting the component elements

[`var nonce: ChaChaPoly.Nonce`](/documentation/CryptoKit/ChaChaPoly/SealedBox/nonce)

The nonce used to encrypt the data.

[`var ciphertext: Data`](/documentation/CryptoKit/ChaChaPoly/SealedBox/ciphertext)

The encrypted data.

[`var tag: Data`](/documentation/CryptoKit/ChaChaPoly/SealedBox/tag)

An authentication tag.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)