One Logo Pool Ball
CryptoKit · IOS API REFERENCE

AES.GCM

enum · iOS 13.0+ · SDK 27.1

enum GCM

The Advanced Encryption Standard (AES) Galois Counter Mode (GCM) cipher suite.

Members (4)

static · iOS 13.0+

open

TypeScript
static openUsing(sealedBox: AES_GCM_SealedBox, key: SymmetricKey): ArrayBuffer
Swift declaration
static func open(_ sealedBox: AES.GCM.SealedBox, using key: SymmetricKey) throws -> Data

Decrypts the message and verifies its authenticity. - Parameters: - sealedBox: The sealed box to open. - key: The cryptographic key that was used to seal the message. - Returns: The original plaintext message that was sealed in the box, as long as the correct key is used and authentication succeeds. The call throws an error if decryption or authentication fail.

static · iOS 13.0+

open

TypeScript
static openUsingAuthenticating(sealedBox: AES_GCM_SealedBox, key: SymmetricKey, authenticatedData: ArrayBuffer): ArrayBuffer
Swift declaration
static func open<AuthenticatedData>(_ sealedBox: AES.GCM.SealedBox, using key: SymmetricKey, authenticating authenticatedData: AuthenticatedData) throws -> Data where AuthenticatedData : DataProtocol

Decrypts the message and verifies the authenticity of both the encrypted message and additional data. - Parameters: - sealedBox: The sealed box to open. - key: The cryptographic key that was used to seal the message. - authenticatedData: Additional data that was authenticated. - Returns: The original plaintext message that was sealed in the box, as long as the correct key is used and authentication succeeds. The call throws an error if decryption or authentication fail.

static · iOS 13.0+

seal

TypeScript
static sealUsingNonceAuthenticating(message: ArrayBuffer, key: SymmetricKey, nonce: (AES_GCM_Nonce) | null, authenticatedData: ArrayBuffer): AES_GCM_SealedBox
Swift declaration
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

Secures the given plaintext message with encryption and an authentication tag that covers both the encrypted data and additional data. - 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 ``AES/GCM/Nonce/init()``. - authenticatedData: Additional data to be authenticated. - Returns: The sealed message.

static · iOS 13.0+

seal

TypeScript
static sealUsingNonce(message: ArrayBuffer, key: SymmetricKey, nonce?: (AES_GCM_Nonce) | null): AES_GCM_SealedBox
Swift declaration
static func seal<Plaintext>(_ message: Plaintext, using key: SymmetricKey, nonce: AES.GCM.Nonce? = nil) throws -> AES.GCM.SealedBox where Plaintext : DataProtocol

Secures the given plaintext message with encryption and an authentication tag. - 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 ``AES/GCM/Nonce/init()``. - Returns: The sealed message.

Skipped declarations

2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

AES.GCM.seal(inPlace:using:nonce:authenticating:tag:)

The iOS SDK compiler rejected this binding: instance method 'arg' requires that 'MutableRawSpan' conform to 'Escapable'

AES.GCM.open(inPlace:using:nonce:authenticating:tag:)

The iOS SDK compiler rejected this binding: instance method 'arg' requires that 'MutableRawSpan' conform to 'Escapable'

All CryptoKit types →