AuthenticatedEncryptor

Encrypts plaintext with optional associated data for authenticated encryption (AEAD). When associated data is provided, it is authenticated but not encrypted. When associated data is null, only the plaintext is authenticated and encrypted.

For the decryption counterpart, see AuthenticatedDecryptor.

Inheritors

Functions

Link copied to clipboard
open suspend override fun encrypt(plaintext: ByteArray): ByteArray

Encrypts the given plaintext without associated data and returns the resulting ciphertext as a ByteArray.

open suspend override fun encrypt(plaintext: ByteString): ByteString

Encrypts the given plaintext without associated data and returns the resulting ciphertext as a ByteString.

open suspend fun encrypt(plaintext: ByteArray, associatedData: ByteArray?): ByteArray

Encrypts the given plaintext with optional associatedData and returns the resulting ciphertext as a ByteArray.

open suspend fun encrypt(plaintext: ByteString, associatedData: ByteString?): ByteString

Encrypts the given plaintext with optional associatedData and returns the resulting ciphertext as a ByteString.

Link copied to clipboard
open override fun encryptBlocking(plaintext: ByteArray): ByteArray

Encrypts the given plaintext without associated data and returns the resulting ciphertext as a ByteArray.

open override fun encryptBlocking(plaintext: ByteString): ByteString

Encrypts the given plaintext without associated data and returns the resulting ciphertext as a ByteString.

abstract fun encryptBlocking(plaintext: ByteArray, associatedData: ByteArray?): ByteArray

Encrypts the given plaintext with optional associatedData and returns the resulting ciphertext as a ByteArray.

open fun encryptBlocking(plaintext: ByteString, associatedData: ByteString?): ByteString

Encrypts the given plaintext with optional associatedData and returns the resulting ciphertext as a ByteString.

Link copied to clipboard
open override fun encryptingSink(ciphertext: RawSink): RawSink

Returns a RawSink that encrypts data as it is written, sending the resulting ciphertext to ciphertext, without associated data.

abstract fun encryptingSink(ciphertext: RawSink, associatedData: ByteArray?): RawSink
open fun encryptingSink(ciphertext: RawSink, associatedData: ByteString?): RawSink

Returns a RawSink that encrypts data as it is written, sending the resulting ciphertext to ciphertext, with optional associatedData.

Link copied to clipboard
open override fun encryptingSource(plaintext: RawSource): RawSource

Returns a RawSource that encrypts data as it is read from the given plaintext source without associated data.

abstract fun encryptingSource(plaintext: RawSource, associatedData: ByteArray?): RawSource
open fun encryptingSource(plaintext: RawSource, associatedData: ByteString?): RawSource

Returns a RawSource that encrypts data as it is read from the given plaintext source with optional associatedData.