Generic Type Method

seal(_:using:nonce:)

Secures the given plaintext message with encryption and an authentication tag.

Declaration

static func seal<Plaintext>(_ message: Plaintext, using key: SymmetricKey, nonce: ChaChaPoly.Nonce? = nil) throws -> ChaChaPoly.SealedBox where Plaintext : DataProtocol

Parameters

message

The plaintext data to seal.

key

A cryptographic key used to seal the message.

nonce

A nonce used during the sealing process.

Return Value

The sealed message.

See Also

Securing the Plaintext Message

static func seal<Plaintext, AuthenticatedData>(Plaintext, using: SymmetricKey, nonce: ChaChaPoly.Nonce?, authenticating: AuthenticatedData) -> ChaChaPoly.SealedBox

Secures the given plaintext message with encryption and an authentication tag that covers both the encrypted data and additional data.