The key custodian may need to make a copy of the key temporarily available to an administrator or an operator who must load data into encrypted columns or databases. Because this operator does not otherwise have permission to access encrypted data, he or she should not have permanent access to a key.
The key custodian uses create encryption key to create a key with a user-defined password. This key is known as the base key.
The key custodian uses alter encryption key to assign a copy of the base key to an individual user with an individual password.
alter encryption key [database.[ owner ].]key with passwd 'base_key_password' add encryption with passwd 'key_copy_password' for user_name ''
base_key_password – is the password used to encrypt the base key, and may be known only by the key custodian. The password can be upto 255 bytes in length. SAP ASE uses the first password to decrypt the base column-encryption key.
key_copy_password – the password used to encrypt the key copy. The password cannot be longer than 255 bytes. SAP ASE makes a copy of the decrypted base key, encrypts it with a key encryption key derived from the key_copy_password, and saves the encrypted base key copy as a new row in sysencryptkeys.
user_name – identifies the user for whom the key copy is made. For a given key, sysencryptkeys includes a row for each user who has a copy of the key, identified by their user ID (uid).
The key custodian adds as many key copies as there are users who require access through a private password.
Users can alter their copy of the encryption key to encrypt it with a different password.
create encryption key key1 with passwd 'WorldsBiggestSecret'
grant select on key key1 to dbo
create table employee (empname char(50), emp_salary money encrypt with razi.key1, emp_address varchar(200)) grant select on employee to bill grant decrypt on employee(emp_salary) to bill
alter encryption key key1 with passwd 'WorldsBiggestSecret' add encryption with passwd 'justforBill' for user 'bill'
set encryption passwd 'justforBill' for key razi.key1 select empname, emp_salary from dbo.employee
When SAP ASE accesses the key for the user, it looks up that user’s key copy. If no copy exists for a given user, SAP ASE assumes the user intends to access the base key.