產生對稱 AES 金錀 - AWS CloudHSM

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

產生對稱 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>

執行此作業的叢集識別碼。

必要:如果已設定多個叢集。

<KEY_ATTRIBUTES>

指定一個空格分隔的金鑰屬性清單,對產生的 AES 金鑰進行設定,格式為 KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE (例如,token=true)。

如需支援的金鑰屬性清單,請參閱 CloudHSM CLI 的金鑰屬性

必要:否

<KEY-LENGTH-BYTES>

指金鑰長度 (以位元組為單位)。

有效值:

  • 16、24 和 32

必要:是

<LABEL>

指定使用者定義的 AES 金鑰標籤。用戶端 SDK 5.11 及之後允許的大小上限為 127 個字元。label用戶端 SDK 5.10 及之前版本的限制為 126 個字元。

必要:是

<SESSION>

建立只在目前工作階段中存在的金鑰。工作階段結束後,金鑰無法復原。

當您僅短暫需要金鑰 (例如,加密後快速解密另一個金鑰的包裝金鑰) 時,請使用此參數。請勿使用工作階段金鑰來加密工作階段結束後可能需要解密的資料。

根據預設,產生的金鑰是持久性 (權杖) 金鑰。在 <SESSION> 傳遞會變更此情況,確保使用此參數生成的金鑰是工作階段 (臨時) 金鑰。

必要:否

相關主題