One Logo Pool Ball
CryptoKit · IOS API REFERENCE

AES.GCM.SealedBox

struct · iOS 13.0+ · SDK 27.1

struct SealedBox

A secure container for your data that you can access using a cipher. 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:)``. 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:)`` method, to open the box.

Members (6)

get · iOS 13.0+

ciphertext

TypeScript
get ciphertext(): ArrayBuffer
Swift declaration
var ciphertext: Data { get }

The encrypted data. The length of the ciphertext of a sealed box is the same as the length of the plaintext you encrypt.

get · iOS 13.0+

tag

TypeScript
get tag(): ArrayBuffer
Swift declaration
var tag: Data { get }

An authentication tag. The authentication tag has a length of 16 bytes.

init · iOS 13.0+

init

TypeScript
static initNonceCiphertextTag(nonce: AES_GCM_Nonce, ciphertext: ArrayBuffer, tag: ArrayBuffer): AES_GCM_SealedBox
Swift declaration
init<C, T>(nonce: AES.GCM.Nonce, ciphertext: C, tag: T) throws where C : DataProtocol, T : DataProtocol

Creates a sealed box from the given tag, nonce, and ciphertext. - Parameters: - nonce: The nonce. - ciphertext: The encrypted data. - tag: The authentication tag.

get · iOS 13.0+

nonce

TypeScript
get nonce(): AES_GCM_Nonce
Swift declaration
var nonce: AES.GCM.Nonce { get }

The nonce used to encrypt the data.

get · iOS 13.0+

combined

TypeScript
get combined(): (ArrayBuffer) | null
Swift declaration
var combined: Data? { get }

A combined element composed of the nonce, encrypted data, and authentication tag. The combined representation is only available when the ``AES/GCM/Nonce`` size is the default size of 12 bytes. The data layout of the combined representation is nonce, ciphertext, then tag.

init · iOS 13.0+

init

TypeScript
static initCombined(combined: ArrayBuffer): AES_GCM_SealedBox
Swift declaration
init<D>(combined: D) throws where D : DataProtocol

Creates a sealed box from the combined bytes of an authentication tag, nonce, and encrypted data. - Parameters: - combined: The combined bytes of the nonce, encrypted data, and authentication tag.

Skipped declarations

No declarations were skipped in this snapshot.

All CryptoKit types →