Creates encryption keys. All the information related to keys and encryption is encapsulated by create encryption key, which allows you to specify the encryption algorithm and key size, the key’s default property, an optional user-specified password to encrypt the key, as well as the use of an initialization vector or padding during the encryption process.
The SAP ASE server uses Security Builder Crypto for key generation and encryption.
create encryption key [dual] master [for AES] with passwd char_literal
create encryption key syb_extpasswdkey [ with { static key | master key }] create encryption key syb_syscommkey [ with { static key | master key }]
create encryption key [[database.][owner].]keyname [as default] [for algorithm_name] [with [{{passwd {char_literal | system_encr_passwd} | master key}] [key_length num_bits] [init_vector {null | random}] [pad {null | random}] [[no] dual_control]}]
create encryption key keyname [for algorithm] for database encryption [with {[master key] [key_length 256] [init_vector random] [[no] dual_control]}
syb_extpasswdkey – all external passwords in sysattributes are reencrypted with the new key using strong encryption
syb_syscommkey – any subsequent execution of sp_hidetext uses the new key with strong encryption. sp_hidetext must be executed on an existing database object for the object to be encrypted with the new key
Specifying master key creates a master key in the master database, and indicates to SAP ASE to protect the database encryption key using that key. By default, SAP ASE uses this master key (if it exists) to protect database encryption keys.
The only valid length for a database encryption key is 256; you see an error message if you use any other size.
An initialization vector has some performance implications. Index creation, and optimized joins and searches, can be performed only on a column for which the encryption key does not specify an initialization vector.
The default is to use an initialization vector, that is, init_vector random. Use of an initialization vector implies using a cipher-block chaining (CBC) mode of encryption; setting init_vector null implies the electronic codebook (ECB) mode.
Database encryption enforces stronger security than column encryption; if you specify init_vector null for database encryption as you can for creating a column encryption key, SAP ASE returns an error.
create encryption key safe_key as default for AES with keylength 256
create encryption key salary_key for AES with init_vector null pad random
create encryption key mykey for AES with keylength 192 init_vector random
create encryption key key1 with passwd 'Worlds1Biggest6Secret'
You must enter user-specified passwords that protect keys before accessing a column encrypted by the key. See set.
create encryption key safe_key as default for AES with keylength 256
create encryption key k3 with passwd 'Whybother' dual_control create encryption key k1 with keylength 192
create encryption key testkey for database encryption with master key
create encryption key testkey for database encryption with dual_control
create encryption key testkey for database encryption with master key dual_control
create encryption key testkey for database encryption with master key no dual_control
create encryption key testkey for database encryption with no dual control
sp_configure 'enable encrypted columns', 1 create encryption key master with passwd "testpassword" set encryption passwd 'testpassword' for key master create encryption key dbkey for database encryption
The SAP ASE server does not save the user-specified password. It saves a string of validating bytes known as the “salt” in sysencryptkeys.eksalt, which allows the SAP ASE 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 the SAP ASE server before you can access any column encrypted by keyname.
#define EK_DBENCKEY 0x1000
For information about auditing, see Auditing Encrypted Columns in the Encrypted Columns Users Guide.
ANSI SQL – Compliance level: Transact-SQL extension.
The permission checks for create encryption key differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must have the following privilege or
privileges based on the encryption key type:
You must have the manage any encryption key privilege to create an encryption key for another user. |
Disabled | With granular permissions disabled, you must be a user with sso_role, keycustodian_role, or have create encryption key privilege to create an encryption key. You must have sso_role to create an encryption key for another user. |