Creates a keyset using the specified algorithm type.
Syntax
binary NEW_KEYSET(string <key_type>, [string <description>])Parameters
| Parameter | Required | Description |
|---|---|---|
key_type | Yes | The algorithm type for the data key in the new keyset. Valid values: AES-GCM-256, AES-SIV-CMAC-128, AES-SIV-CMAC-256. |
description | No | A description of the data key in the new keyset. |
Return value
Returns a keyset of the BINARY type.
Example
The following example creates a keyset using the AES-GCM-256 algorithm and converts the result to a readable hex string:
SELECT HEX(NEW_KEYSET('AES-GCM-256', 'hello world'));Output:
+------------+
| _c0 |
+------------+
| 0A10577567735A514541554D42776E684C4212580A330A0B4145532D47434D2D323536122017F7A430B9D4B59B55454FD4B486216059F1B748CE0502D901EBEACEAB6569191801200210011A10577567735A514541554D42776E684C4220022A0B68656C6C6F20776F726C64 |
+------------+Related functions
| Function | Description |
|---|---|
| Use keysets | How to use keyset-related encryption and decryption functions. |
| ADD_KEY_TO_KEYSET | Adds a key to a keyset and sets it as the master key. |
| KEYSET_TO_JSON | Converts a BINARY keyset to a readable JSON string. |
| KEYSET_FROM_JSON | Converts a JSON keyset to the BINARY type. |
| ROTATE_KEYSET | Generates a new key and sets it as the master key. |
| NEW_WRAPPED_KEYSET | Creates a wrapped keyset using a Key Management Service (KMS) customer master key (CMK). |
| ROTATE_WRAPPED_KEYSET | Decrypts a wrapped keyset, rotates the key, and re-encrypts it. |
| USE_WRAPPED_KEYSET | Converts a wrapped keyset to a basic keyset for use in encryption or decryption functions. |
| ENHANCED_SYM_ENCRYPT | Encrypts data using a specified keyset. |
| ENHANCED_SYM_DECRYPT | Decrypts data using a specified keyset. |