UltraLite Static C++ User's Guide
Adding Non Data Access Features to UltraLite Applications
Configuring and managing database storage
Encrypting UltraLite databases
UltraLite databases are created on the first connection attempt. To encrypt an UltraLite database, you supply an encryption key before that connection attempt. On the first attempt, the supplied key is used to encrypt the database. On subsequent attempts, the supplied key is checked against the encryption key, and connection fails unless the key matches.
To strongly encrypt an UltraLite database
Load the encryption module.
Call ULEnableStrongEncryption before opening the database.
You open a database by calling ULData::Open.
On the Palm Computing Platform, you open a database by calling ULData::PalmLaunch.
Specify the encryption key.
Define the UL_STORE_PARMS macro with the parameter name key.
#define UL_STORE_PARMS "key=a secret key"
As with most passwords, it is best to choose a key value that cannot be easily guessed. The key can be of arbitrary length, but generally the longer the key, the better because a shorter key is easier to guess than a longer one. As well, including a combination of numbers, letters, and special characters decreases the chances of someone guessing the key.
Do not include semicolons in your key. Do not put the key itself in quotes, or the quotes will be considered part of the key.
You must supply this key each time you want to start the database. Lost or forgotten keys result in completely inaccessible databases.
For more information on UL_STORE_PARMS, see UL_STORE_PARMS macro.
Handle attempts to open an encrypted database with the wrong key.
If an attempt is made to open an encrypted database and the wrong key is passed in, db_init returns ul_false and SQLCODE -840 is set.