Key protection using user-specified passwords

You can limit the power of the SA or DBO to access private data when you specify passwords on keys through the create encryption key or alter encryption key statements. If keys have explicit passwords, before users can decrypt data, they need:

Users must also have knowledge of the password to run DML commands that encrypt data.

Use the create encryption key command to associate a password with a key:

create encryption key [db.[owner].]keyname  [as default]
[for algorithm_name] [with {[keylength num_bits]
[passwd 'password_phrase'] [init_vector {NULL | random}]
[pad {NULL | random}]}]

Where:

Adaptive Server does not save the user-specified password. It saves a string of validating bytes known as the “salt” in sysencryptkeys.eksalt, which allows Adaptive Server to recognize whether a password used on a subsequent encryption or decryption operation is legitimate for a key. You must supply the password to Adaptive Server before you can access any column encrypted by keyname.

This example shows how to use passwords on keys, and the key custodian’s function in setting up encryption. In this example the password on the key is shared among all users who have a business need to process encrypted data.

  1. Key custodian Razi creates an encryption key:

    create encryption key key1 with passwd 'Worlds1Biggest6Secret'
    
  2. Razi distributes the password to all users who need access to encrypted data.

  3. Each user enters the password before processing tables with encrypted columns:

    set encryption passwd 'Worlds1Biggest6Secret' for key razi.key1
    

    For more information about set encryption passwd, see “Accessing encrypted data”.

  4. If the key is compromised because an unauthorized user gained access to the password, Razi alters the key to change the password.