Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Unwrap a key with RSA-PKCS using CloudHSM CLI

Focus mode
Unwrap a key with RSA-PKCS using CloudHSM CLI - AWS CloudHSM

Use the key unwrap rsa-pkcs command in CloudHSM CLI to unwrap a payload key using the RSA private key and the RSA-PKCS unwrapping mechanism.

Unwrapped keys can be used in the same ways as the keys generated by AWS CloudHSM. To indicate that they were not generated locally, their local attribute is set to false.

To use the key unwrap rsa-pkcs command, you must have the RSA private key of the RSA public wrapping key in your AWS CloudHSM cluster, and its unwrap attribute must be set to true.

User type

The following types of users can run this command.

  • Crypto users (CUs)

Requirements

  • To run this command, you must be logged in as a CU.

Syntax

aws-cloudhsm > help key unwrap rsa-pkcs Usage: key unwrap rsa-pkcs [OPTIONS] --filter [<FILTER>...] --key-type-class <KEY_TYPE_CLASS> --label <LABEL> <--data-path <DATA_PATH>|--data <DATA>> Options: --cluster-id <CLUSTER_ID> Unique Id to choose which of the clusters in the config file to run the operation against. If not provided, will fall back to the value provided when interactive mode was started, or error --filter [<FILTER>...] Key reference (e.g. key-reference=0xabc) or space separated list of key attributes in the form of attr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE to select a key to unwrap with --data-path <DATA_PATH> Path to the binary file containing the wrapped key data --data <DATA> Base64 encoded wrapped key data --attributes [<UNWRAPPED_KEY_ATTRIBUTES>...] Space separated list of key attributes in the form of KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE for the unwrapped key --share-crypto-users [<SHARE_CRYPTO_USERS;...] Space separated list of Crypto User usernames to share the unwrapped key with --manage-key-quorum-value <MANAGE_KEY_QUORUM_VALUE; The quorum value for key management operations for the unwrapped key --use-key-quorum-value <USE_KEY_QUORUM_VALUE; The quorum value for key usage operations for the unwrapped key --key-type-class <KEY_TYPE_CLASS> Key type and class of wrapped key [possible values: aes, des3, ec-private, generic-secret, rsa-private] --label <LABEL> Label for the unwrapped key --session Creates a session key that exists only in the current session. The key cannot be recovered after the session ends --approval <APPROVAL> Filepath of signed quorum token file to approve operation -h, --help Print help

Examples

These examples show how to use the key unwrap rsa-oaep command using an AES key with the unwrap attribute value set to true.

Example: Unwrap a payload key from Base64 encoded wrapped key data
aws-cloudhsm > key unwrap rsa-pkcs --key-type-class aes --label aes-unwrapped --filter attr.label=rsa-private-key-example --data am0Nc7+YE8FWs+5HvU7sIBcXVb24QA0l65nbNAD+1bK+e18BpSfnaI3P+r8Dp+pLu1ofoUy/vtzRjZoCiDofcz4EqCFnGl4GdcJ1/3W/5WRvMatCa2d7cx02swaeZcjKsermPXYRO1lGlfq6NskwMeeTkV8R7Rx9artFrs1y0DdIgIKVaiFHwnBIUMnlQrR2zRmMkfwU1jxMYmOYyD031F5VbnjSrhfMwkww2la7uf/c3XdFJ2+0Bo94c6og/yfPcpOOobJlITCoXhtMRepSdO4OggYq/6nUDuHCtJ86pPGnNahyr7+sAaSI3a5ECQLUjwaIARUCyoRh7EFK3qPXcg== { "error_code": 0, "data": { "key": { "key-reference": "0x00000000001c08ef", "key-info": { "key-owners": [ { "username": "cu1", "key-coverage": "full" } ], "shared-users": [], "key-quorum-values": { "manage-key-quorum-value": 0, "use-key-quorum-value": 0 }, "cluster-coverage": "full" }, "attributes": { "key-type": "aes", "label": "aes-unwrapped", "id": "0x", "check-value": "0x8d9099", "class": "secret-key", "encrypt": false, "decrypt": false, "token": true, "always-sensitive": false, "derive": false, "destroyable": true, "extractable": true, "local": false, "modifiable": true, "never-extractable": false, "private": true, "sensitive": true, "sign": true, "trusted": false, "unwrap": false, "verify": true, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 16 } } } }
Example: Unwrap a payload key provided through a data path
aws-cloudhsm > key unwrap rsa-pkcs --key-type-class aes --label aes-unwrapped --filter attr.label=rsa-private-key-example --data-path payload-key.pem { "error_code": 0, "data": { "key": { "key-reference": "0x00000000001c08ef", "key-info": { "key-owners": [ { "username": "cu1", "key-coverage": "full" } ], "shared-users": [], "key-quorum-values": { "manage-key-quorum-value": 0, "use-key-quorum-value": 0 }, "cluster-coverage": "full" }, "attributes": { "key-type": "aes", "label": "aes-unwrapped", "id": "0x", "check-value": "0x8d9099", "class": "secret-key", "encrypt": false, "decrypt": false, "token": true, "always-sensitive": false, "derive": false, "destroyable": true, "extractable": true, "local": false, "modifiable": true, "never-extractable": false, "private": true, "sensitive": true, "sign": true, "trusted": false, "unwrap": false, "verify": true, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 16 } } } }

Arguments

<CLUSTER_ID>

The ID of the cluster to run this operation on.

Required: If multiple clusters have been configured.

<FILTER>

Key reference (for example, key-reference=0xabc) or space separated list of key attributes in the form of attr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE to select a key to unwrap with.

Required: Yes

<DATA_PATH>

Path to the binary file containing the wrapped key data.

Required: Yes (unless provided through Base64 encoded data)

<DATA>

Base64 encoded wrapped key data.

Required: Yes (unless provided through data path)

<ATTRIBUTES>

Space separated list of key attributes in the form of KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE for the wrapped key.

Required: No

<KEY_TYPE_CLASS>

Key type and class of wrapped key [possible values: aes, des3, ec-private, generic-secret, rsa-private].

Required: Yes

<LABEL>

Label for the unwrapped key.

Required: Yes

<SESSION>

Creates a session key that exists only in the current session. The key cannot be recovered after the session ends.

Required: No

<APPROVAL>

Specifies the file path to a signed quorum token file to approve operation. Only required if the key management service quorum value of the unwrapping key is greater than 1.

Related topics

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.