Skip to main content

IMPORT KEY (bSQL) | Blockpoint Docs

Imports a key from raw byte data from a file or command argument. For examples, see Examples.

bSQL Syntax Conventions

Syntax

IMPORT KEY <key_bytes> AS "key_name" [ decryption_clause ]

key_bytes ::=
byte_array | "import_path"

decryption_clause ::=
{ DEC | DECRYPTION } = "dec_key_name" [HMAC = "hmac_name"]

Arguments

key_name
The name assigned to the imported key.

dec_key_name
The name of the decryption key.

hmac_name
The name of a secondary hmac decryption key.

Permissions

Any user can import a key, although the user must have access to the decryption and hmac keys if specified. Consequently, the current login takes ownership of the imported key.

Examples

Importing a key from a byte array.

The following example imports a 32 byte key using a raw byte and no decryption into the database with the name "base key".

IMPORT KEY 
[222 144 54 48 219 109 243 27 95 48 16 95 55 7 216 42 1 206 45 19 183 187 239 20 5 81 33 61 171 170 91 180 200]
AS "base key"

Importing a key from a file using decryption.

The following example imports a key using a file and using the decryption keys "admin key" and "hmac admin".

IMPORT KEY "keys/base_key" AS "base key" DECRYPT = "admin key" hmac = "hmac admin"

See Also