本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 Cloud 產生非對稱 EC 金鑰對HSM CLI
在 雲端HSM中使用 key asymmetric-pair ec命令CLI,在您的 AWS CloudHSM 叢集中產生非對稱橢圓曲線 (EC) 金鑰對。
使用者類型
下列類型的使用者可以執行此命令。
-
加密使用者 (CUs)
要求
若要執行此命令,必須以 CU 的身分登入。
語法
aws-cloudhsm >
help key generate-asymmetric-pair ec
Generate an Elliptic-Curve Cryptography (ECC) key pair Usage: key generate-asymmetric-pair ec [OPTIONS] --public-label
<PUBLIC_LABEL>
--private-label<PRIVATE_LABEL>
--curve<CURVE>
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 --public-label<PUBLIC_LABEL>
Label for the public key --private-label<PRIVATE_LABEL>
Label for the private key --session Creates a session key pair that exists only in the current session. The key cannot be recovered after the session ends --curve<CURVE>
Elliptic curve used to generate the key pair [possible values: prime256v1, secp256r1, secp224r1, secp384r1, secp256k1, secp521r1] --public-attributes [<PUBLIC_KEY_ATTRIBUTES>
...] Space separated list of key attributes to set for the generated EC public key in the form of KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE --private-attributes [<PRIVATE_KEY_ATTRIBUTES>
...] Space separated list of key attributes to set for the generated EC private key in the form of KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE --share-crypto-users [<SHARE_CRYPTO_USERS>
...] Space separated list of Crypto User usernames to share the EC private key with --manage-private-key-quorum-value<MANAGE_PRIVATE_KEY_QUORUM_VALUE>
The quorum value for key management operations for the private key --use-private-key-quorum-value<USE_PRIVATE_KEY_QUORUM_VALUE>
The quorum value for key usage operations for the private key -h, --help Print help
範例
下列範例示範如何使用 key generate-asymmetric-pair ec 命令來建立 EC 金鑰對。
範例:建立 EC 金鑰對
aws-cloudhsm >
key generate-asymmetric-pair ec \ --curve secp224r1 \ --public-label ec-public-key-example \ --private-label ec-private-key-example
{ "error_code": 0, "data": { "public_key": { "key-reference": "0x000000000012000b", "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": "ec", "label": "ec-public-key-example", "id": "", "check-value": "0xd7c1a7", "class": "public-key", "encrypt": false, "decrypt": false, "token": true, "always-sensitive": false, "derive": false, "destroyable": true, "extractable": true, "local": true, "modifiable": true, "never-extractable": false, "private": true, "sensitive": false, "sign": false, "trusted": false, "unwrap": false, "verify": false, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 57, "ec-point": "0x047096513df542250a6b228fd9cb67fd0c903abc93488467681974d6f371083fce1d79da8ad1e9ede745fb9f38ac8622a1b3ebe9270556000c", "curve": "secp224r1" } }, "private_key": { "key-reference": "0x000000000012000c", "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": "ec", "label": "ec-private-key-example", "id": "", "check-value": "0xd7c1a7", "class": "private-key", "encrypt": false, "decrypt": false, "token": true, "always-sensitive": true, "derive": false, "destroyable": true, "extractable": true, "local": true, "modifiable": true, "never-extractable": false, "private": true, "sensitive": true, "sign": false, "trusted": false, "unwrap": false, "verify": false, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 122, "ec-point": "0x047096513df542250a6b228fd9cb67fd0c903abc93488467681974d6f371083fce1d79da8ad1e9ede745fb9f38ac8622a1b3ebe9270556000c", "curve": "secp224r1" } } } }
範例:建立具有選用屬性的 EC 金鑰對
aws-cloudhsm >
key generate-asymmetric-pair ec \ --curve secp224r1 \ --public-label ec-public-key-example \ --private-label ec-private-key-example \ --public-attributes encrypt=true \ --private-attributes decrypt=true
{ "error_code": 0, "data": { "public_key": { "key-reference": "0x00000000002806eb", "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": "ec", "label": "ec-public-key-example", "id": "", "check-value": "0xedef86", "class": "public-key", "encrypt": true, "decrypt": false, "token": true, "always-sensitive": false, "derive": false, "destroyable": true, "extractable": true, "local": true, "modifiable": true, "never-extractable": false, "private": true, "sensitive": false, "sign": false, "trusted": false, "unwrap": false, "verify": false, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 57, "ec-point": "0x0487af31882189ec29eddf17a48e8b9cebb075b7b5afc5522fe9c83a029a450cc68592889a1ebf45f32240da5140d58729ffd7b2d44262ddb8", "curve": "secp224r1" } }, "private_key": { "key-reference": "0x0000000000280c82", "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": "ec", "label": "ec-private-key-example", "id": "", "check-value": "0xedef86", "class": "private-key", "encrypt": false, "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": false, "trusted": false, "unwrap": false, "verify": false, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 122, "ec-point": "0x0487af31882189ec29eddf17a48e8b9cebb075b7b5afc5522fe9c83a029a450cc68592889a1ebf45f32240da5140d58729ffd7b2d44262ddb8", "curve": "secp224r1" } } } }
範例:使用規定人數值建立 EC 金鑰對
使用規定人數控制產生金鑰時,該金鑰必須與等於最大金鑰規定人數值的最小使用者數目相關聯。相關聯的使用者包括金鑰擁有者和與金鑰共用的加密使用者。若要判斷要共用金鑰的最小使用者數量,請取得金鑰使用量值與金鑰管理量值之間的最大規定人數值,並減去 1 以考慮金鑰擁有者,該擁有者預設與金鑰相關聯。若要與更多使用者共用金鑰,請使用 使用 Cloud 共用金鑰HSM CLI命令。
aws-cloudhsm >
key generate-asymmetric-pair ec \ --curve secp224r1 \ --public-label ec-public-key-example \ --private-label ec-private-key-example \ --public-attributes verify=true \ --private-attributes sign=true --share-crypto-users cu2 cu3 cu4 \ --manage-private-key-quorum-value 4 \ --use-private-key-quorum-value 2
{ "error_code": 0, "data": { "public_key": { "key-reference": "0x00000000002806eb", "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": "ec", "label": "ec-public-key-example", "id": "", "check-value": "0xedef86", "class": "public-key", "encrypt": false, "decrypt": false, "token": true, "always-sensitive": false, "derive": false, "destroyable": true, "extractable": true, "local": true, "modifiable": true, "never-extractable": false, "private": true, "sensitive": false, "sign": false, "trusted": false, "unwrap": false, "verify": true, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 57, "ec-point": "0x0487af31882189ec29eddf17a48e8b9cebb075b7b5afc5522fe9c83a029a450cc68592889a1ebf45f32240da5140d58729ffd7b2d44262ddb8", "curve": "secp224r1" } }, "private_key": { "key-reference": "0x0000000000280c82", "key-info": { "key-owners": [ { "username": "cu1", "key-coverage": "full" } ], "shared-users": [ { "username": "cu2", "key-coverage": "full" }, { "username": "cu3", "key-coverage": "full" }, { "username": "cu4", "key-coverage": "full" }, ], "key-quorum-values": { "manage-key-quorum-value": 4, "use-key-quorum-value": 2 }, "cluster-coverage": "full" }, "attributes": { "key-type": "ec", "label": "ec-private-key-example", "id": "", "check-value": "0xedef86", "class": "private-key", "encrypt": false, "decrypt": false, "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": false, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 122, "ec-point": "0x0487af31882189ec29eddf17a48e8b9cebb075b7b5afc5522fe9c83a029a450cc68592889a1ebf45f32240da5140d58729ffd7b2d44262ddb8", "curve": "secp224r1" } } } }
引數
<CLUSTER_ID>
-
要執行此操作的叢集 ID。
必要:如果已設定多個叢集。
<CURVE>
-
指橢圓曲線的識別符。
prime256v1
secp256r1
secp224r1
secp384r1
secp256k1
secp521r1
必要:是
<PUBLIC_KEY_ATTRIBUTES>
-
指一個空格分隔的金鑰屬性清單,以
KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE
(例如,verify=true
) 的形式為產生的 EC 公有金鑰設定如需支援的金鑰屬性清單,請參閱 雲端的關鍵屬性HSM CLI。
必要:否
<PUBLIC_LABEL>
-
指使用者定義的公有金鑰標籤。用戶端 5.11
label
和更新版本允許的大小上限為 SDK 127 個字元。用戶端 SDK 5.10 和以前的 限制為 126 個字元。必要:是
<PRIVATE_KEY_ATTRIBUTES>
-
指一個空格分隔的金鑰屬性清單,以
KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE
(例如,sign=true
) 的形式為產生的 EC 私有金鑰設定如需支援的金鑰屬性清單,請參閱 雲端的關鍵屬性HSM CLI。
必要:否
<PRIVATE_LABEL>
-
指使用者定義的私有金鑰標籤。用戶端 5.11
label
和更新版本允許的大小上限為 SDK 127 個字元。用戶端 SDK 5.10 和以前的 限制為 126 個字元。必要:是
<SESSION>
-
建立只在目前工作階段中存在的金鑰。工作階段結束後,金鑰無法復原。
當您僅短暫需要金鑰 (例如,加密後快速解密另一個金鑰的包裝金鑰) 時,請使用此參數。請勿使用工作階段金鑰來加密工作階段結束後可能需要解密的資料。
根據預設,產生的金鑰是持久性 (權杖) 金鑰。傳入 <SESSION> 會變更此項目,確保使用此引數產生的金鑰是工作階段 (暫時性) 金鑰。
必要:否
<SHARE_CRYPTO_USERS>
-
指定要與 共用 EC 私有金鑰的加密使用者名稱清單,以空格分隔
必要:否
<MANAGE_PRIVATE_KEY_QUORUM_VALUE>
-
私有金鑰金鑰管理操作的規定人數值。此值必須小於或等於與金鑰相關聯的使用者數量。這包括與之共用金鑰的使用者,以及金鑰擁有者。最大值為 8。
必要:否
<USE_PRIVATE_KEY_QUORUM_VALUE>
-
私有金鑰金鑰使用量操作的規定人數值。此值必須小於或等於與金鑰相關聯的使用者數量。這包括與之共用金鑰的使用者,以及金鑰擁有者。最大值為 8。
必要:否