setKey

abstract fun setKey(key: ByteArray, size: Int = key.size, database: String = SQLITE_MAIN_DB_NAME)(source)

Sets the key used to access an encrypted database.

This connection must have been opened through a cipher virtual file system for encryption to actually take effect, see ksqlite.kapi.cipher.CipherVirtualFileSystemManager. Setting a key on a connection opened through a plain virtual file system fails with a generic error rather than a clear one.

Throws

if an error happened while setting the key.