Creating column encryption keys

A column encryption key must exist before a table owner can mark a column for encryption on a new or existing table. When you set up keys for the first time, consider:

Column encryption in Adaptive Server uses the Advanced Encryption Standard (AES) symmetric key encryption algorithm, with available key sizes of 128, 192, and 256 bits. Random-key generation and cryptographic functionality is provided by the FIPS 140-2 compliant modules.

To securely protect key values, Adaptive Server uses a 256-bit key-encrypting key (KEK), which may be a master key, or an internal key derived from either the system encryption password or a user-specified password. See Chapter 3, “Using Database-Level Master and Dual Master Keys.” Adaptive Server encrypts the new key (the column encryption key) and stores the result in sysencryptkeys.

Figure 2-1: Encrypting column encryption keys using KEK

Image shows a flow chart with the system encryption key giving user access to the IEEE key, which gives access to the key-encryption key, which in turn gives access to the symmetric encryption algorithm

By default, Adaptive Server creates 256-bit key-encryption keys. For compatibility with versions earlier than 15.7, it uses a 128-bit key if the KEK is derived from the system encryption password.

Syntax for create column encryption key

The syntax for create column encryption key is:

create encryption key [[database.][owner].]keyname 
	[as default] [for algorithm] 
	[with 
		{[key_length num_bits] 
		[{passwd 'passwd_phrase' | passwd system_encr_passwd | 
			master key}] 
		[init_vector {null | random}]
		[pad {null | random}]
		[[no] dual_control]
	}]

where:

create encryption key examples

These examples use various encryption attributes when creating a column encryption key, and many assume you have already created the master key or set the system encryption password (see “Key protection”).

create encryption key permissions

The sso_role and keycustodian_role implicitly have permission to create encryption keys. The system security officer or the key custodian uses this syntax to grant create encryption key permissions to others:

grant create encryption key 
	to user_name | role_name | group_name

For example:

grant create encryption key to key_admin_role

To revoke key creation permission, use:

revoke create encryption key 
	{to | from} user_name | role_name | group_name

Notegrant all does not grant create encryption key permission to the user. It must be explicitly granted by the system security officer.