-
Encrypts and authenticates data using AES-GCM.
Throws
CipherError errorsDeclaration
Swift
public static func seal<Plaintext: DataProtocol, AuthenticatedData: DataProtocol> (_ message: Plaintext, using key: SymmetricKey, nonce: Nonce? = nil, authenticating authenticatedData: AuthenticatedData) throws -> SealedBoxParameters
messageThe message to encrypt and authenticate
keyAn encryption key of 128, 192 or 256 bits
nonceAn Nonce for AES-GCM encryption. The nonce must be unique for every use of the key to seal data. It can be safely generated with AES.GCM.Nonce()
authenticatedDataData to authenticate as part of the seal
Return Value
A sealed box returning the authentication tag (seal) and the ciphertext
-
Encrypts and authenticates data using AES-GCM.
Throws
CipherError errorsDeclaration
Swift
public static func seal<Plaintext: DataProtocol> (_ message: Plaintext, using key: SymmetricKey, nonce: Nonce? = nil) throws -> SealedBoxParameters
messageThe message to encrypt and authenticate
keyAn encryption key of 128, 192 or 256 bits
nonceAn Nonce for AES-GCM encryption. The nonce must be unique for every use of the key to seal data. It can be safely generated with AES.GCM.Nonce()
Return Value
A sealed box returning the authentication tag (seal) and the ciphertext
-
Authenticates and decrypts data using AES-GCM.
Throws
CipherError errors. If the authentication of the sealedbox failed, incorrectTag is thrown.Declaration
Swift
public static func open<AuthenticatedData: DataProtocol> (_ sealedBox: SealedBox, using key: SymmetricKey, authenticating authenticatedData: AuthenticatedData) throws -> DataParameters
sealedBoxThe sealed box to authenticate and decrypt
keyAn encryption key of 128, 192 or 256 bits
nonceAn Nonce for AES-GCM encryption. The nonce must be unique for every use of the key to seal data. It can be safely generated with AES.GCM.Nonce().
authenticatedDataData that was authenticated as part of the seal
Return Value
The ciphertext if opening was successful
-
Authenticates and decrypts data using AES-GCM.
Throws
CipherError errors. If the authentication of the sealedbox failed, incorrectTag is thrown.Declaration
Swift
public static func open(_ sealedBox: SealedBox, using key: SymmetricKey) throws -> DataParameters
sealedBoxThe sealed box to authenticate and decrypt
keyAn encryption key of 128, 192 or 256 bits
nonceAn Nonce for AES-GCM encryption. The nonce must be unique for every use of the key to seal data. It can be safely generated with AES.GCM.Nonce().
Return Value
The ciphertext if opening was successful
-
Undocumented
See moreDeclaration
Swift
public struct SealedBox : AEADSealedBox
-
Undocumented
See moreDeclaration
Swift
public struct Nonce : ContiguousBytes, Sequence
View on GitHub
Install in Dash
GCM Enumeration Reference