Encrypting a new Db2 database
To set up encryption for a new Db2 database, perform the following setup and configuration steps.
About this task
Procedure
What to do next
- To check the encryption status of a particular database, use the ADMIN_GET_ENCRYPTION_INFO table
function, which returns the current encryption settings for a database. For
example:
SELECT * FROM TABLE (SYSPROC.ADMIN_GET_ENCRYPTION_INFO()); - Retrieve the current database encryption settings. For
example:
This query returns the following output:SELECT OBJECT_NAME, OBJECT_TYPE, ALGORITHM, ALGORITHM_MODE, KEY_LENGTH, MASTER_KEY_LABEL FROM TABLE(SYSPROC.ADMIN_GET_ENCRYPTION_INFO())OBJECT_NAME OBJECT_TYPE ALGORITHM ALGORITHM_MODE KEY_LENGTH MASTER_KEY_LABEL --------------------------------------------------------------------------------------------------------------- DARE DATABASE AES CBC 256 DB2_SYSGEN_db2inst1_DARE_2015-10-16-18.20.45 - Retrieve the instance keystore settings. For
example:
This query returns the following output:SELECT KEYSTORE_NAME, KEYSTORE_TYPE, KEYSTORE_HOST, KEYSTORE_IP, KEYSTORE_IP_TYPE FROM TABLE(SYSPROC.ADMIN_GET_ENCRYPTION_INFO())KEYSTORE_NAME KEYSTORE_TYPE KEYSTORE_HOST KEYSTORE_IP KEYSTORE_IP_TYPE --------------------------------------------- ----------------------------------------------------- /localhome/db2inst1/ccardkeystore.p12 PKCS12 dublr270vm.dub.usoh.ibm.com ........... IPV4 - Retrieve the last master key rotation operation information. For
example:
This query returns the following output:SELECT PREVIOUS_MASTER_KEY_LABEL, AUTH_ID, APPL_ID, ROTATION_TIME FROM TABLE(SYSPROC.ADMIN_GET_ENCRYPTION_INFO())PREVIOUS_MASTER_KEY_LABEL AUTH_ID ... ----------------------------------------------- ------------ ... DB2_SYSGEN_db2inst1_DARE_2015-10-16-18.20.45 DB2INST1 ...
Note: If your deployment is on sharded, you can choose to encrypt only the transaction, master,
and metadata schemas as they contain sensitive data. The configuration and statistics schemas can be
unencrypted. But this is only applicable if each of these schema are on different database
instances. This is because, within the same database instance, Db2 allows the users to encrypt only
at an instance level and not at the schema or table level.