From Xojo Documentation
Encrypts the database using password as the encryption key. If you are already connected to an encrypted database and call Encrypt with an empty string, the database is decrypted.
|You cannot encrypt a database from within a transaction. You must encrypt it outside of any transactions.|
Encrypt can be used both to encrypt a non-encrypted database, to change the password for an existing encrypted database and to decrypt a database.
Encrypt does not yield to threads, so it will freeze the application for large databases.
Always back up the database before encrypting it.
2017r3 and prior: AES-128 encryption is always used.
2018r1 and later defaults to AES-128, but AES-256 can also be used by including the prefix "aes256:" before the rest of the encryption key.
If you have a database that was previously encrypted as AES-128 and would like to switch to AES-256, first remove the encryption using Decrypt and then encrypt it again with Encrypt.
This example encrypts a database using the passed password.
db.DatabaseFile = GetFolderItem("db.sqlite")
If db.Connect Then
// handle error here