Changing a key’s protection method

You can use the alter encryption key command to change the protection method for an encryption key:

alter encryption key [[database.database][owner].] keyname
	[with {passwd {'old_passwd' | system_encr_passwd 
		| login_passwd} | master key}] 
	modify encryption
	[with [{passwd {'old_passwd' | system_encr_passwd | login_passwd} 			| master key}] [[no] dual_control]] 

where:

Example 1: In this example, the key custodian alters the base key because the password was compromised or a user who knew the password left the company.

  1. Key custodian “razi” creates an encryption key:

    create encryption key key1 
         with passwd 'MotherOfSecrets'
    
  2. “razi” shares the password on the base key with “joe” and “bill”, who need to process the encrypted data (no key copies are involved).

  3. “joe” leaves the company.

  4. “razi” alters the password on the encryption key and then shares it with “bill”, and “pete”, who replaces is “joe.” The data does not need to be reencrypted because the underlying key has not changed, just the way the key is protected. The following statement decrypts key1 using the old password and reencrypts it with the new password:

    alter encryption key key1
        with passwd 'MotherOfSecrets'
        modify encryption
        with passwd 'FatherOfSecrets'
    

Example 2: Use the master key to encrypt an existing CEK “k2”:

alter encryption key k2
        with passwd 'goodbye'
        modify encryption
        with master key

Example 3: Re-encrypt an existing CEK “k3” that is currently encrypted by the master key, to use dual control:

alter encryption key k3
        modify encryption
        with master key
        dual_control

NoteYou can omit with master key in this example to achieve the same encryption.

Example 4: Re-encrypt an existing CEK “k4” that is currently encrypted by the master key and password “k4_password”, to remove dual control. The CEK and all its key copies are controlled by a single key derived from “k4_new_password”:

alter encryption key k4
        with passwd 'k4_password'
        modify encryption
        with passwd 'k4_new_password'
        no dual_control

Example 5: Encrypt an existing CEK “k5” that is currently encrypted by the master key, for dual control encrypted by the master key and password “k5_password”:

alter encryption key k5
        modify encryption
        with passwd 'k5_password'
        dual_control

Example 6: Encrypt a CEK for dual control by the master key and password “k6_password”:

create encryption key k6
        with passwd 'k6_password'
        dual_control

For user “ned”, encrypt his existing key copy of CEK “k6” that is currently encrypted with dual control by the master key and password “k6_password”, for dual control by the master key and password “k6_ned_password”:

alter encryption key k6
        with passwd 'k6_password'
        add encryption
        with passwd 'k6_ned_password'
        for user ned

NoteUser “ned” cannot change the dual control property of his key copy.

Example 7: Encrypt a CEK “k7” currently encrypted by the master and dual master key, to use the system encryption password:

alter encryption key k7
        modify encryption
        with passwd system_encr_passwd
        no dual control