Contents

seal(_:using:nonce:authenticating:)

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

Declaration

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

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 Init().

  • authenticatedData:

    Additional data to be authenticated.

Return Value

The sealed message.

See Also

Securing the plaintext message