Creating an encrypted database

Create an encrypted database by specifying the ENCRYPT option when using the CREATE DATABASE command.

Before you begin

Procedure

  • To create an encrypted database with the default settings, specify the ENCRYPT keyword on the CREATE DATABASE command:
    db2 create db <encrypted_database_name> encrypt
  • To create an encrypted database with custom settings, specify the ENCRYPT keyword with additional encryption options on the CREATE DATABASE command:
    db2 create db <encrypted_database_name> encrypt
      cipher aes key length <length_of_data_encryption_key>
      master key label <master_key_label>
    Where:
    • CIPHER cipher-name specifies the encryption algorithm that is to be used for encrypting the database.
    • KEY LENGTH key-length specifies the length in bits of the data encryption key that is to be used for encrypting the database.
    • MASTER KEY LABEL label-name specifies a label for the master key that is used to encrypt the database. If you specify this option, the master key must already exist. If you exclude this option, a master key for the database is automatically generated and added to the keystore.

Results

The information in your database can be accessed only by using the appropriate stash file or password.