Package-level declarations

Types

Link copied to clipboard
object Algorithms

Symmetric-key block ciphers for performing encryption and decryption.

Link copied to clipboard
class Argon2Hasher(saltLength: Int = DEFAULT_SALT_LENGTH, hashLength: Int = DEFAULT_HASH_LENGTH, parallelism: Int = DEFAULT_PARALLELISM, memory: Int = DEFAULT_MEMORY, iterations: Int = DEFAULT_ITERATIONS) : PasswordEncoderHasher

Hasher that uses the Argon2id algorithm, the first choice recommended by OWASP, salting each value individually.

Link copied to clipboard
class BCryptHasher(strength: Int = DEFAULT_STRENGTH) : PasswordEncoderHasher

Hasher that uses the bcrypt algorithm, salting each value individually.

Link copied to clipboard

Binary column for storing encrypted binary strings of a specific length, using the provided encryptor.

Link copied to clipboard

Character column for storing encrypted strings, using the provided encryptor, with the specified maximum colLength.

Link copied to clipboard
class Encryptor(val encryptFn: (String) -> String, val decryptFn: (String) -> String, val maxColLengthFn: (Int) -> Int)

Base cipher class responsible for the encryption and decryption of data.

Link copied to clipboard
class Hashed(hasher: Hasher, val encodedValue: String)

A hashed column holds these rather than strings, which is what keeps a plaintext value from being stored in one by accident, or compared against one in SQL. Assigning a Hashed read from the database back to a column stores it unchanged, without hashing it a second time.

Link copied to clipboard
interface Hasher

Base class responsible for the one-way hashing of data.

Link copied to clipboard

Transformer that stores the Hashed.encodedValue of a hashed value in a character column, using the provided hasher to verify the values read back out of it.

Link copied to clipboard

Transformer that behaves like HashingTransformer but passes null through untouched, for use with nullable character columns.

Link copied to clipboard
open class PasswordEncoderHasher(passwordEncoder: PasswordEncoder) : Hasher

Hasher that delegates to a Spring Security passwordEncoder.

Link copied to clipboard
class Pbkdf2Hasher(secret: CharSequence = "", saltLength: Int = DEFAULT_SALT_LENGTH, iterations: Int = DEFAULT_ITERATIONS, algorithm: Pbkdf2PasswordEncoder.SecretKeyFactoryAlgorithm = SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256) : PasswordEncoderHasher

Hasher that uses the PBKDF2 algorithm, salting each value individually.

Link copied to clipboard
class SCryptHasher(cpuCost: Int = DEFAULT_CPU_COST, memoryCost: Int = DEFAULT_MEMORY_COST, parallelization: Int = DEFAULT_PARALLELIZATION, keyLength: Int = DEFAULT_KEY_LENGTH, saltLength: Int = DEFAULT_SALT_LENGTH) : PasswordEncoderHasher

Hasher that uses the scrypt algorithm, salting each value individually.

Functions

Link copied to clipboard
fun Table.encryptedBinary(name: String, cipherByteLength: Int, encryptor: Encryptor): Column<ByteArray>

Creates a binary column, with the specified name, for storing encrypted binary strings.

Link copied to clipboard
fun Table.encryptedVarchar(name: String, cipherTextLength: Int, encryptor: Encryptor): Column<String>

Creates a character column, with the specified name, for storing encrypted strings.

Link copied to clipboard
@JvmName(name = "hashNullable")
fun Column<Hashed?>.hash(plainText: String): Hashed

Hashes plainText with the Hasher this nullable column was declared with, ready to be stored in it.

fun Column<Hashed>.hash(plainText: String): Hashed

Hashes plainText with the Hasher this column was declared with, ready to be stored in it.

Link copied to clipboard
@JvmName(name = "hashedNullable")
fun Column<String?>.hashed(hasher: Hasher = BCryptHasher()): Column<Hashed?>

Transforms this nullable character column into one that stores one-way hashed values, using the provided hasher, and leaving null values untouched.

fun Column<String>.hashed(hasher: Hasher = BCryptHasher()): Column<Hashed>

Transforms this character column into one that stores one-way hashed values, using the provided hasher.