Encrypting column data

You can store sensitive data in encrypted format.

About this task

Before you set the encryption password and encrypt data, you must be sure the encrypted data can fit in the column.

To encrypt a column:

Procedure

  1. Calculate the size of the encrypted column. If necessary, modify the column.
    For examples of two methods for calculating the size of an encrypted column, see ids_ce_004.html#ids_ce_004.
  2. Insert information about the encryption password into your code. Use the SET ENCRYPTION PASSWORD statement to specify either a password or a password and a hint. Use the ENCRYPT_AES() or the ENCRYPT_TDES() function to define encrypted data.
    For an example of how to insert a password into your code and use the ENCRYPT function, see Example showing how to encrypt a column.

Results

Use the DECRYPT_BINARY(), and DECRYPT_CHAR() functions to query encrypted data. For an example of querying encrypted data, see Example showing how to query encrypted data.

See the HCL OneDB™ Guide to SQL: Syntax for more information about:

  • The SET ENCRYPTION PASSWORD statement and the syntax to use to specify the password and the hint
  • The ENCRYPT and DECRYPT functions