One Logo Pool Ball
CryptoKit · IOS API REFERENCE

ChaChaPoly.SealedBox

struct · iOS 13.0+ · SDK 27.1

@frozen struct SealedBox

A secure container for your data that you 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.

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: ChaChaPoly_Nonce, ciphertext: ArrayBuffer, tag: ArrayBuffer): ChaChaPoly_SealedBox
Swift declaration
init<C, T>(nonce: ChaChaPoly.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: An authentication tag.

get · iOS 13.0+

nonce

TypeScript
get nonce(): ChaChaPoly_Nonce
Swift declaration
var nonce: ChaChaPoly.Nonce { get }

The nonce used to encrypt the data.

get · iOS 13.0+

combined

TypeScript
get combined(): ArrayBuffer
Swift declaration
let combined: Data

A combined element composed of the tag, the nonce, and the ciphertext. The data layout of the combined representation is: nonce, ciphertext, then tag.

init · iOS 13.0+

init

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

Creates a sealed box from the given data. - Parameters: - combined: The combined bytes of the tag and ciphertext.

Skipped declarations

No declarations were skipped in this snapshot.

All CryptoKit types →