exSymKey

Updated at:

Use the exSymKey command in the key_mgmt_tool to export a plaintext copy of a symmetric key from the Hardware Security Module (HSM) and save it to a file.

Access control: Only the key's owner — the Crypto User (CU) who created it — can export the key. CU users with shared key access can use the key for encryption but cannot export it.

Use case: Combine exSymKey with imSymKey to back up or migrate symmetric keys between HSMs.

Encrypted export: To export a key in encrypted form without decrypting it locally, use wrapKey instead.

How it works: The HSM does not allow keys to be directly imported in plaintext. exSymKey first uses wrapKey to export an encrypted key file and then performs AES decryption.

Prerequisites

Before you begin, ensure that you have:

Syntax

exSymKey -k <key-to-export>
         -w <wrapping-key>
         -out <key-file>
         [-m 4]
         [-wk <unwrapping-key-file>]
Important

Enter parameters in the order shown in the syntax.

Parameters

ParameterDescriptionRequiredValid values
-kHandle of the symmetric key to export. To find key handles, use findKey.YesKey handle integer
-wHandle of the key used to encrypt the exported key. To find key handles, use findKey.YesKey handle integer
-outPath and filename for the exported key file.YesAny valid file path
-mEncryption mechanism used during export.No4 (NIST_AES_WRAP)
-wkPath to the AES key file used for decryption.NoDefaults to the key specified by -w

Example

The following command exports the symmetric key with handle 9, using the key with handle 6 as the wrapping key, and writes the plaintext key to /tmp/aes.key.

Command:  exSymKey -k 9 -w 6 -out /tmp/aes.key

          Cfm3ExportWrapKeyWithMech returned: 0x00 : HSM Return: SUCCESS

          Cfm3ExportUnwrapKeyWithMech returned: 0x00 : HSM Return: SUCCESS


Exported Symmetric Key written to file "/tmp/aes.key"

What's next

  • imSymKey — Import a symmetric key into the HSM

  • wrapKey — Export a key in encrypted (wrapped) form

  • findKey — Find key handles in the HSM