The KEYSET_FROM_JSON function converts a JSON-formatted keyset string to the BINARY type.
Syntax
BINARY KEYSET_FROM_JSON(STRING <json_keyset>)Parameters
json_keyset: Required. STRING. A JSON-formatted keyset string.
Return value
A keyset of the BINARY type is returned.
Examples
SELECT HEX(KEYSET_FROM_JSON('{
"key": [{
"description": "hello world",
"key_id": "r8MqZAEA8PDd3QSL",
"key_meta_data": {
"key_material_origin": "Origin_ALIYUN_MAXCOMPUTE",
"key_material_type": "SYMMETRIC",
"type": "AES-GCM-256",
"value": "Jqj7ESbfT1td0DwYDmkZVl13FsuykYFe+1u/MPi++a8="},
"output_prefix_type": "PREFIX_ALIYUN_MAXCOMPUTE",
"status": "ENABLED"}],
"primary_key_id": "r8MqZAEA8PDd3QSL"}')) ;The query returns the following:
+------------+
| _c0 |
+------------+
| 0A1072384D715A414541385044643351534C12580A330A0B4145532D47434D2D323536122026A8FB1126DF4F5B5DD03C180E6919565D7716CBB291815EFB5BBF30F8BEF9AF1801200210011A1072384D715A414541385044643351534C20022A0B68656C6C6F20776F726C64 |
+------------+Related documentation
Topic | Description |
Describes how to use keyset encryption functions. | |
Creates a keyset based on a specified algorithm type. | |
Adds a new key to a keyset and sets it as the master key. | |
Converts a BINARY keyset to a readable JSON format to view its details. | |
Generates a new key and sets it as the master key. | |
Creates a new wrapped keyset by using a role, specified by the | |
Decrypts an existing wrapped keyset, rotates the key, and then re-encrypts the keyset with the new key. | |
Converts a wrapped keyset into a basic keyset for use as a parameter in encryption or decryption functions. You can also use this function to obtain and save information about the wrapped keyset for easier maintenance. | |
Encrypts data using a specified keyset. | |
Decrypts data using a specified keyset. |