AesCBC

AES Encryption using CBC mode using PKCS5 Padding.

PKCS5 and PKCS7 are interchangeable in SunJCE Provider.

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): ByteArray

Decrypts encrypted data using key.

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

Decrypts encrypted data using key and optional iv.

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

Encrypts the provided data using the provided key.

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

Encrypts the provided data using the provided 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.