CLOUDHSM-AES-GCM使用 CloudHSM CLI 解开密钥 - AWS CloudHSM

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

CLOUDHSM-AES-GCM使用 CloudHSM CLI 解开密钥

使用 CloudHSM CLI 中的key unwrap cloudhsm-aes-gcm命令使用 AES 包装密钥和解包机制将有效负载密钥解包 AWS CloudHSM 到集群中。CLOUDHSM-AES-GCM

未封装的密钥的使用方式与生成的 AWS CloudHSM密钥相同。为了表明它们不是本地生成的,其 local 属性设置为 false

要使用该key unwrap cloudhsm-aes-gcm命令,您的 AWS CloudHSM 集群中必须有 AES 封装密钥,并且其unwrap属性必须设置为true

用户类型

以下类型的用户均可运行此命令。

  • 加密用户 (CUs)

要求

  • 要运行此命令,必须以 CU 身份登录。

语法

aws-cloudhsm > help key unwrap cloudhsm-aes-gcm Usage: key unwrap cloudhsm-aes-gcm [OPTIONS] --filter [<FILTER>...] --tag-length-bits <TAG_LENGTH_BITS> --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 --aad <AAD> Aes GCM Additional Authenticated Data (AAD) value, in hex --tag-length-bits <TAG_LENGTH_BITS> Aes GCM tag length in bits --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

示例

这些示例展示了如何通过将 unwrap 属性值设置为 true 的 AES 密钥来使用 key unwrap cloudhsm-aes-gcm 命令。

例 示例:从 Base64 编码的包装密钥数据中解包有效载荷密钥
aws-cloudhsm > key unwrap cloudhsm-aes-gcm --key-type-class aes --label aes-unwrapped --filter attr.label=aes-example --tag-length-bits 64 --aad 0x10 --data 6Rn8nkjEriDYlnP3P8nPkYQ8hplOEJ899zsrF+aTB0i/fIlZ { "error_code": 0, "data": { "key": { "key-reference": "0x00000000001408e8", "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 } } } }
例 示例:解包通过数据路径提供的有效载荷密钥
aws-cloudhsm > key unwrap cloudhsm-aes-gcm --key-type-class aes --label aes-unwrapped --filter attr.label=aes-example --tag-length-bits 64 --aad 0x10 --data-path payload-key.pem { "error_code": 0, "data": { "key": { "key-reference": "0x00000000001408e8", "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 } } } }

参数

<CLUSTER_ID>

要运行此操作的集群的 ID。

必需:如果已配置多个集群。

<FILTER>

密钥引用(例如 key-reference=0xabc)或空格分隔的密钥属性列表,采用 attr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE 形式,可选择要用于解包的密钥。

必需:是

<DATA_PATH>

包含包装的密钥数据的二进制文件的路径。

必需:是(除非通过 Base64 编码的数据提供)

<DATA>

Base64 编码的包装密钥数据。

必需:是(除非通过数据路径提供)

<ATTRIBUTES>

包装密钥的空格分隔的密钥属性列表,采用 KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE 形式。

必需:否

<AAD>

Aes GCM 额外验证数据(AAD)值(十六进制)。

必需:否

<TAG_LENGTH_BITS>

Aes GCM 标签长度(以位为单位)。

必需:是

<KEY_TYPE_CLASS>

包装密钥的密钥类型和类[可能的值:aesdes3ec-privategeneric-secretrsa-private]。

必需:是

<LABEL>

解包密钥的标签。

必需:是

<SESSION>

创建仅在当前会话中存在的会话密钥。会话结束后,密钥无法恢复。

必需:否

<APPROVAL>

指定要批准操作的已签名仲裁令牌文件的文件路径。仅当解包密钥的密钥管理服务法定值大于 1 时才需要。

相关 主题