CloudHSM CLI を使用して非対称 EC キーペアを生成する
CloudHSM CLI で key asymmetric-pair ec コマンドを使用して、AWS CloudHSM クラスターに非対称楕円曲線 (EC) キーペアを生成します。
ユーザータイプ
このコマンドは、次のタイプのユーザーが実行できます。
-
Crypto User (CU)
要件
このコマンドを実行するには、CU としてログインする必要があります。
Syntax
aws-cloudhsm >help key generate-asymmetric-pair ecGenerate 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 キーペア作成
クォーラム制御を使用してキーを生成する場合、キーには、キーの最大クォーラム値と同じ数以上のユーザーを関連付ける必要があります。関連付けられるユーザーには、キー所有者と、そのキーが共有されている Crypto User が含まれます。キーを共有すべき最小ユーザー数を決定するには、キー使用クォーラム値とキー管理クォーラム値のうち大きい方のクォーラム値を取得し、デフォルトでキーに関連付けられているキー所有者を考慮して 1 を差し引きます。キーをさらに多くのユーザーと共有するには、CloudHSM 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形式で生成された EC パブリックキーに設定するキー属性のスペース区切りリストを指定します (例:verify=true)。サポートされているキー属性のリストについては、「CloudHSM CLI のキー属性」を参照してください。
必須: いいえ
<PUBLIC_LABEL>-
パブリックキーのユーザー定義ラベルを指定します。
labelに許可される最大サイズは、クライアント SDK 5.11 以降では 127 文字です。クライアント SDK 5.10 以前では、制限は 126 文字です。必須: はい
<PRIVATE_KEY_ATTRIBUTES>-
KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE形式で生成された EC プライベートキーに設定するキー属性のスペース区切りリストを指定します (例:sign=true)。サポートされているキー属性のリストについては、「CloudHSM CLI のキー属性」を参照してください。
必須: いいえ
<PRIVATE_LABEL>-
プライベートキーのユーザー定義ラベルを指定します。
labelに許可される最大サイズは、クライアント SDK 5.11 以降では 127 文字です。クライアント SDK 5.10 以前では、制限は 126 文字です。必須: はい
<SESSION>-
現在のセッションにのみ存在するキーを作成します。セッション終了後、キーをリカバリすることはできません。
このパラメータは、別のキーを暗号化してからすばやく復号化するラッピングキーなど、キーが短時間だけ必要な場合に使用します。セッション終了後に復号する必要がある可能性のあるデータを暗号化するためにセッションキーを使用しないでください。
デフォルトでは、生成されるキーは永続 (トークン) キーです。<SESSION> で渡すことでこれが変わり、この引数で生成されたキーがセッション (エフェメラル) キーであることが保証されます。
必須: いいえ
<SHARE_CRYPTO_USERS>-
EC プライベートキーを共有する Crypto User ユーザー名のスペース区切りリストを指定します。
必須: いいえ
<MANAGE_PRIVATE_KEY_QUORUM_VALUE>-
プライベートキーのキー管理オペレーションのクォーラム値。この値は、キーが関連付けられているユーザーの数以下である必要があります。これには、そのキーが共有されているユーザーと、キー所有者が含まれます。最大値は 8 です。
必須: いいえ
<USE_PRIVATE_KEY_QUORUM_VALUE>-
プライベートキーのキー使用オペレーションのクォーラム値。この値は、キーが関連付けられているユーザーの数以下である必要があります。これには、そのキーが共有されているユーザーと、キー所有者が含まれます。最大値は 8 です。
必須: いいえ