Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - C and C++ Programming » Developing Applications Using Embedded SQL

Authenticating users Next Page

Encrypting data


You can encrypt or obfuscate your UltraLite database using the UltraLite embedded SQL.

See Encrypting data.

Encryption

When an UltraLite database is created (using Sybase Central for example), an optional encryption key may be specified. The encryption key is used to encrypt the database. Once the database is encrypted, all subsequent connection attempts must supply the encryption key. The supplied key is checked against the original encryption key and the connection fails unless the key matches.

Choose an encryption key value that cannot be easily guessed. The key can be of arbitrary length, but generally a longer key is better, because a shorter key is easier to guess. 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.

To connect to an encrypted UltraLite database
  1. Specify the encryption key in the connection string used in the EXEC SQL CONNECT statement.

    The encryption key is specified with the key= connection string parameter.

    You must supply this key each time you want to connect to the database. Lost or forgotten keys result in completely inaccessible databases.

  2. 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 supplied, db_init returns ul_false and SQLCODE -840 is set.

  3. Changing the encryption key

    You can change the encryption key for a database. The application must already be connected to the database using the existing key before the change can be made.

    To change the encryption key on an UltraLite database
Obfuscation
To obfuscate an UltraLite database