About the Encryption Commands

From InterBase
Jump to: navigation, search

Go Up to Encrypting Data

InterBase provides two encryption commands: one to encrypt a database, and the other to encrypt database columns.

To encrypt a database, use the following syntax:

ALTER DATABASE ENCRYPT [[with] key-name]

For example, the statement:

ALTER DATABASE ENCRYPT with fin_key

uses the fin_key to encrypt all the database pages in the current database (i.e. in the database to which you are connected).

To encrypt a column in an existing table, use the following syntax:

ALTER TABLE table-name ALTER COLUMN column-name ENCRYPT [[with] key-name]

For example, the following statement:

ALTER TABLE sales ALTER COLUMN total_value ENCRYPT with expenses_key

uses the expenses_key to encrypt data in the total_value column.

To encrypt a column when creating a table, use the following syntax:

CREATE TABLE table-name column-name data-type ENCRYPT [[with] key-name]