docs/api/exposed-crypt/org.jetbrains.exposed.v1.crypt/-encryptor/index.html
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.
return AesBytesEncryptor(
password.toString(),
salt,
KeyGenerators.secureRandom(AES_256_GCM_BLOCK_LENGTH),
AesBytesEncryptor.CipherAlgorithm.GCM
).run {
Encryptor(
{ base64Encoder.encodeToString(encrypt(it.toByteArray())) },
{ String(decrypt(base64Decoder.decode(it))) },
{ inputLen ->
base64EncodedLength(AES_256_GCM_BLOCK_LENGTH + inputLen + AES_256_GCM_TAG_LENGTH)
}
)
}
Content copied to clipboard
Members
Link copied to clipboard
constructor(encryptFn: (String) -> String, decryptFn: (String) -> String, maxColLengthFn: (Int) -> Int)
Link copied to clipboard
val decryptFn: (String) -> String
Decrypt ciphertext to a plaintext string.
Link copied to clipboard
val encryptFn: (String) -> String
Encrypt a plaintext string to ciphertext.
Link copied to clipboard
val maxColLengthFn: (Int) -> Int
Convert the expected input length into the maximum encoded length to be stored.
Link copied to clipboard
fun decrypt(str: String): String
Returns a decrypted value using decryptFn.
Link copied to clipboard
fun encrypt(str: String): String
Returns an encrypted value using encryptFn.
Link copied to clipboard
fun maxColLength(inputByteSize: Int): Int
Returns the maximum column length needed to store an encrypted value, using the specified inputByteSize, and determined by maxColLengthFn.
Generated by Dokka © 2026 Copyright