SecureKeyDerivation

class SecureKeyDerivation(config: KeyDerivationConfig = KeyDerivationConfig.default())

Secure key derivation using PBKDF2.

This class provides password-based key derivation with configurable parameters for compliance with various security standards.

Usage:

val derivation = SecureKeyDerivation(KeyDerivationConfig.default())
val (key, salt) = derivation.deriveKey("password")

// Later, to derive the same key:
val sameKey = derivation.deriveKeyWithSalt("password", salt)

Constructors

Link copied to clipboard
constructor(config: KeyDerivationConfig = KeyDerivationConfig.default())

Functions

Link copied to clipboard
fun deriveDeterministic(inputMaterial: ByteArray, context: String, salt: ByteArray): ByteArray

Derive a deterministic key from input material using HKDF (RFC 5869) with HMAC-SHA256.

Link copied to clipboard

Derive a cryptographic key from a password.

Derive a key from a string password (convenience method).

Link copied to clipboard

Derive a cryptographic key from a password using an existing salt.

Derive a key from a string password with existing salt.