AesGCM

class AesGCM : AesAEAD

AES Encryption using GCM mode.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
open override var defaultKeySize: Int?

Default key size to use for KeyGenerator.

Link copied to clipboard
open override val ivLength: Int

IV/nonce length.

Link copied to clipboard

Functions

Link copied to clipboard

Concatenate the encryption details from a Map data.

Link copied to clipboard
fun decrypt(@NotNull encrypted: Map<String, ByteArray>): ByteArray

Decrypts encrypted data in a Map format.

fun decrypt(@NotNull encrypted: ByteArray, @NotNull key: ByteArray, @NotNull tag: ByteArray = byteArrayOf()): ByteArray

Decrypts encrypted data using key and tag if provided.

Link copied to clipboard
fun decryptBare(@NotNull encrypted: ByteArray, @NotNull iv: ByteArray, @NotNull key: ByteArray, @NotNull tag: ByteArray = byteArrayOf()): ByteArray

Decrypts encrypted data with optional tag verification using key nad iv.

Link copied to clipboard
fun encrypt(@NotNull data: ByteArray, @NotNull tag: ByteArray = byteArrayOf(), @NotNull key: ByteArray = generateKey()): Map<String, ByteArray>

Encrypts the provided data along with optional tag and key.

Link copied to clipboard
fun encryptBare(@NotNull data: ByteArray, @NotNull iv: ByteArray, @NotNull key: ByteArray, @NotNull tag: ByteArray = byteArrayOf()): Map<String, ByteArray>

Encrypts the provided data along with tag (if provided) using key.

Link copied to clipboard

Extracts the iv, data from a ByteArray data.

Link copied to clipboard

Generate IV based on ivLength.

Link copied to clipboard
fun generateKey(@Nullable size: Int? = defaultKeySize): ByteArray

Generate secret key based on optional key size.