Package-level declarations

Functions

Link copied to clipboard
suspend fun aesCbcDecrypt(key: ByteArray, iv: ByteArray, data: ByteArray): ByteArray

AES-CBC decrypt with PKCS#7 padding handling determined by cipher.

Link copied to clipboard

Alias to match existing call sites expecting explicit no-padding naming.

Link copied to clipboard
suspend fun aesCbcEncryptNoPadding(key: ByteArray, iv: ByteArray, plaintextNoPad: ByteArray): ByteArray

AES-CBC encrypt without internal padding. Provide PKCS#7 padded plaintext.

Link copied to clipboard
suspend fun aesCmac(key: ByteArray, data: ByteArray): ByteArray

Compute AES-CMAC (RFC 4493) over data with a raw AES key.

Link copied to clipboard

Compare two byte arrays without an early exit, so the position of the first differing byte is not observable through timing. Lengths are still compared directly.

Link copied to clipboard
suspend fun hmacSha256(key: ByteArray, data: ByteArray): ByteArray

Compute HMAC-SHA256 over data with key.

Link copied to clipboard
fun pkcs7Pad(data: ByteArray, blockSize: Int = 16): ByteArray

Apply PKCS#7 padding to data for blockSize bytes (default 16).

Link copied to clipboard
fun pkcs7Unpad(data: ByteArray, blockSize: Int = 16): ByteArray

Remove PKCS#7 padding from data.

Link copied to clipboard

Generate count cryptographically strong random bytes.

Link copied to clipboard
fun randomInt(from: Int, until: Int): Int

Generate a cryptographically strong random Int in [from, until).

Link copied to clipboard
suspend fun rsaOaepDecrypt(privateKeyDer: ByteArray, data: ByteArray): ByteArray

Decrypt with RSA-OAEP (SHA-1) using a PKCS#1 DER private key.

Link copied to clipboard
suspend fun rsaOaepEncrypt(publicKeyDer: ByteArray, data: ByteArray): ByteArray

Encrypt with RSA-OAEP (SHA-1) using a PKCS#1 DER public key.

Link copied to clipboard
suspend fun rsaPssSignSha1(privateKeyDer: ByteArray, data: ByteArray): ByteArray

Sign data with RSA-PSS (SHA-1) using a PKCS#1 DER private key.

Link copied to clipboard
suspend fun rsaPssVerifySha1(publicKeyDer: ByteArray, data: ByteArray, signature: ByteArray): Boolean

Verify an RSA-PSS (SHA-1) signature using a PKCS#1 DER public key.