key generate-symmetric aes - AWS CloudHSM

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

key generate-symmetric aes

key generate-symmetric aes命令会在您的 AWS CloudHSM 集群中生成对称 AES 密钥。

用户类型

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

  • 加密用户(CU)

要求

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

语法

aws-cloudhsm > help key generate-symmetric aes Generate an AES key Usage: key generate-symmetric aes [OPTIONS] --label <LABEL> --key-length-bytes <KEY_LENGTH_BYTES> 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 --label <LABEL> Label for the key --session Creates a session key that exists only in the current session. The key cannot be recovered after the session ends --key-length-bytes <KEY_LENGTH_BYTES> Key length in bytes --attributes [<KEY_ATTRIBUTES>...] Space separated list of key attributes to set for the generated AES key in the form of KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE -h, --help Print help

示例

以下示例显示了如何使用 key generate-symmetric aes 命令创建 AES 密钥。

例 示例:创建 AES 密钥
aws-cloudhsm > key generate-symmetric aes \ --label example-aes \ --key-length-bytes 24 { "error_code": 0, "data": { "key": { "key-reference": "0x00000000002e06bf", "key-info": { "key-owners": [ { "username": "cu1", "key-coverage": "full" } ], "shared-users": [], "cluster-coverage": "session" }, "attributes": { "key-type": "aes", "label": "example-aes", "id": "", "check-value": "0x9b94bd", "class": "secret-key", "encrypt": false, "decrypt": false, "token": false, "always-sensitive": true, "derive": false, "destroyable": true, "extractable": true, "local": true, "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": 24 } } } }
例 示例:使用可选属性创建 AES 密钥对
aws-cloudhsm > key generate-symmetric aes \ --label example-aes \ --key-length-bytes 24 \ --attributes decrypt=true encrypt=true { "error_code": 0, "data": { "key": { "key-reference": "0x00000000002e06bf", "key-info": { "key-owners": [ { "username": "cu1", "key-coverage": "full" } ], "shared-users": [], "cluster-coverage": "session" }, "attributes": { "key-type": "aes", "label": "example-aes", "id": "", "check-value": "0x9b94bd", "class": "secret-key", "encrypt": true, "decrypt": true, "token": true, "always-sensitive": true, "derive": false, "destroyable": true, "extractable": true, "local": true, "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": 24 } } } }

参数

<CLUSTER_ID>

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

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

<KEY_ATTRIBUTES>

KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE(例如 token=true)的形式指定要为生成的 AES 密钥设置的按空格分隔的密钥属性列表。

有关支持的密钥属性的列表,请参阅 CloudHSM CLI 的密钥属性

必需:否

<KEY-LENGTH-BYTES>

指定以字节为单位的密钥长度。

有效值:

  • 16、24 和 32

必需:是

<LABEL>

为 AES 密钥指定用户定义的标签。客户端 SDK 5.11 及更高版本允许的最大大小label为 127 个字符。客户端 SDK 5.10 及更低版本的字符数限制为 126 个。

必需:是

<SESSION>

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

如果您只需要一个短暂的密钥,例如用于加密然后快速解密另一个密钥的包装密钥,请使用此参数。对于会话结束后可能需要解密的加密数据,切勿使用会话密钥。

默认情况下,生成的密钥是永久(令牌)密钥。传入 <SESSION> 会改变这一点,确保使用此参数生成的密钥是会话(临时)密钥。

必需:否

相关 主题