Creating encryption keys

An 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.

NoteA Security and Directory Services license is required to enable this parameter. If the parameter is not enabled, OpenSSL security provider performs login password encryption.

To securely protect key values, Adaptive Server uses a 128-bit key-encrypting key, which is derived from either the system encryption password or a user-specified password. Adaptive Server encrypts the new key (the column encryption key) and stores the result in sysencryptkeys.

Figure 2-1: Encrypting user keys

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

Syntax for create encryption key

The syntax for create encryption key is:

create encryption key [[database.][owner].]keyname 
  [as default] [for algorithm] 
  [with 
    {[key_length num_bits] 
    [password 'password_phrase'] 
    [init_vector {null | random}]
    [pad {null | random}]
  }]

where:

create encryption key examples

Example 1

This example specifies a 256-bit key called “safe_key” as the database default key:

create encryption key safe_key as default for AES with         keylength 256

Only the system security officer or a user with the keycustodian_role can create a default key.

Example 2

This creates a 128-bit key called “salary_key” for encrypting columns using random padding:

create encryption key salary_key for AES with          init_vector null pad random

This creates a 192-bit key named “mykey” for encrypting columns using an initialization vector:

create encryption key mykey for AES with keylength 192          init_vector random

This example creates a key protected by a user-specified password:

create encryption key key1
     with passwd 'Worlds1Biggest6Secret'

If a key is protected by a user-specified password, that password must be entered before accessing a column encrypted by the key. See Chapter 5, “Protecting Data Privacy from the Administrator,” for information about using keys with explicit passwords.

create encryption key permissions

The sso_role and keycustodian_role implicitly have permission to create encryption keys. The system security officer 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

Use this syntax to revoke key creation permission:

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.