This topic explains how to import encryption keys into HSM using the unWrapKey command.
Feature description
The unWrapKey command allows for the importation of an encrypted symmetric key or private key from a file into the HSM, utilizing the encrypted key exported by the wrapKey command.
Utilizing unWrapKey and wrapKey, key backup and migration tasks can be performed.
Ensure you start the key_mgmt_tool and log on to the HSM as a CU before executing this command.
Syntax
Enter the parameters as per the following syntax. For parameter details, see Parameters.
unWrapKey -f <key-file-name>
-w <wrapping-key-handle>
[-sess]
[-min_srv <minimum-number-of-HSMs>]
[-timeout <number-of-seconds>]
[-tag_size <tag size>]
[-iv_file <IV file>]
[-attest]
[-m <wrapping-mechanism>]
[-t <hash-type>]
[-nex]
[-noheader]
[-l <key-label>]
[-id <key-id>]
[-kt <key-type>]
[-kc <key-class]
[-i <unwrapping-IV>]
Parameters must be entered in the order specified by the syntax.
Example
The following example demonstrates importing an AES encrypted key file. The key is decrypted using an AES key with handle 6, and the output indicates that the handle of the imported key is 22.
Command: unWrapKey -f aes-encrypted.key -w 6 -m 4
Cfm2UnWrapKey5 returned: 0x00 : HSM Return: SUCCESS
Key Unwrapped. Key Handle: 22
Cluster Status:
Node id 0 status: 0x00000000 : HSM Return: SUCCESS
Parameters
Parameter name | Description | Required | Valid values |
-f | Defines the path and name of the encrypted key file. | Yes | No Special Requirements |
-w | Specifies the handle of the decryption key. | Yes | No Special Requirements |
-m | Indicates the decryption mechanism. | Yes |
|
tag_size | Specifies the block size. Note Applicable only for AES_GCM and CLOUDHSM_AES_GCM decryption mechanisms. | No | No Special Requirements |
iv_file | Defines the length of the AES initialization vector. Note Applicable only for AES_GCM decryption mechanism. | No | No Special Requirements |
-sess | Designates the key as the current session key. | No | No Special Requirements |
-attest | Conducts an integrity check on the firmware response. | No | No Special Requirements |
-min_srv |
| No | No Special Requirements |
-timeout |
| No | No Special Requirements |
-t | Specifies the hash algorithm value. |
| |
-nex | Marks the key as non-exportable. | No | No Special Requirements |
-noheader | Omits the header for specific key properties. | No | No Special Requirements |
-l | Assigns a label to the imported key. Note Only applicable when used with the -noheader parameter. | No | No Special Requirements |
-id | Specifies the ID for the imported key. Note Only applicable when used with the -noheader parameter. | No Special Requirements | |
-kc | Defines the category of the imported key. Note Only applicable when used with the -noheader parameter. | No |
|
-kt | Indicates the type of the imported key. Note Only applicable when used with the -noheader parameter. | No |
|
-i | Determines the initialization vector (IV) for the imported key. Note Only applicable when used with the -noheader parameter and for CLOUDHSM_AES_KEY_WRAP and NIST_AES_WRAP mechanisms. | No | No Special Requirements |