CloudHSM CLI でユーザーのキーを一覧表示する
CloudHSM CLI の key list コマンドを使用して、AWS CloudHSM クラスターに存在する現在のユーザーのすべてのキーを検索します。出力には、そのユーザーが所有および共有しているキーと、CloudHSM クラスターのすべてのパブリックキーが含まれます。
ユーザータイプ
このコマンドは、次のタイプのユーザーが実行できます。
-
管理者 (CO)
-
Crypto User (CU)
Syntax
aws-cloudhsm >help key listList the keys the current user owns, shares, and all public keys in the HSM cluster Usage: key list [OPTIONS] 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 matching key(s) to list --max-items<MAX_ITEMS>The total number of items to return in the command's output. If the total number of items available is more than the value specified, a next-token is provided in the command's output. To resume pagination, provide the next-token value in the starting-token argument of a subsequent command [default: 10] --starting-token<STARTING_TOKEN>A token to specify where to start paginating. This is the next-token from a previously truncated response -v, --verbose If included, prints all attributes and key information for each matched key. By default each matched key only displays its key-reference and label attribute. This flag when used by Admins has no effect -h, --help Print help
例
次の例は、key list コマンドを実行するためのさまざまな方法を示しています。次の例は、Crypto User としての出力を示しています。
例: すべてのキーを検索 - デフォルト
このコマンドは、AWS CloudHSM クラスターに存在するログインユーザーのキーを一覧表示します。
注記
デフォルトでは、現在ログインしているユーザーのキーは 10 個だけ表示され、出力には key-reference と label のみ表示されます。適切なページ分割オプションを使用して、出力として表示するキーの数を増やしたり減らしたりします。
aws-cloudhsm >key list{ "error_code": 0, "data": { "matched_keys": [ { "key-reference": "0x00000000000003d5", "attributes": { "label": "test_label_1" } }, { "key-reference": "0x0000000000000626", "attributes": { "label": "test_label_2" } },. ...8 keys later... ], "total_key_count": 56, "returned_key_count": 10, "next_token": "10" } }
例: すべてのキーを検索 - 詳細度
出力には、そのユーザーが所有および共有しているキーと、HSM のすべてのパブリックキーが含まれます。
注記
注: デフォルトでは、現在ログインしているユーザーのキーは 10 個だけ表示されます。適切なページ分割オプションを使用して、出力として表示するキーの数を増やしたり減らしたりします。
aws-cloudhsm >key list --verbose{ "error_code": 0, "data": { "matched_keys": [ { "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-test-private-key", "id": "", "check-value": "0x2a737d", "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": "0x0442d53274a6c0ec1a23c165dcb9ccdd72c64e98ae1a9594bb5284e752c746280667e11f1e983493c1c605e0a8071ede47ca280f94c6b2aa33", "curve": "secp224r1" } }, { "key-reference": "0x000000000012000d", "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-test-public-key", "id": "", "check-value": "0x2a737d", "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": "0x0442d53274a6c0ec1a23c165dcb9ccdd72c64e98ae1a9594bb5284e752c746280667e11f1e983493c1c605e0a8071ede47ca280f94c6b2aa33", "curve": "secp224r1" } } ], ...8 keys later... "total_key_count": 1580, "returned_key_count": 10 } }
例: ページ分割されたリターン
次の例では、2 つのキーのみを表示するページ分割されたキーのサブセットを表示しています。次に、この例では次の 2 つのキーを表示する後続の呼び出しを行います。
aws-cloudhsm >key list --verbose --max-items 2{ "error_code": 0, "data": { "matched_keys": [ { "key-reference": "0x0000000000000030", "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": "98a6688d1d964ed7b45b9cec5c4b1909", "id": "", "check-value": "0xb28a46", "class": "secret-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": true, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 32 } }, { "key-reference": "0x0000000000000042", "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": "4ad6cdcbc02044e09fa954143efde233", "id": "", "check-value": "0xc98104", "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": true, "verify": true, "wrap": true, "wrap-with-trusted": false, "key-length-bytes": 16 } } ], "total_key_count": 1580, "returned_key_count": 2, "next_token": "2" } }
次の 2 つのキーを表示するには、後続の呼び出しを行います。
aws-cloudhsm >key list --verbose --max-items 2 --starting-token 2{ "error_code": 0, "data": { "matched_keys": [ { "key-reference": "0x0000000000000081", "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": "6793b8439d044046982e5b895791e47f", "id": "", "check-value": "0x3f986f", "class": "secret-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": true, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 32 } }, { "key-reference": "0x0000000000000089", "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": "56b30fa05c6741faab8f606d3b7fe105", "id": "", "check-value": "0xe9201a", "class": "secret-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": true, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 32 } } ], "total_key_count": 1580, "returned_key_count": 2, "next_token": "4" } }
CloudHSM CLI でキーフィルタリングメカニズムがどのように機能するかを示すその他の例については、CloudHSM CLI を使用してキーをフィルタリングする を参照してください。
引数
<CLUSTER_ID>-
このオペレーションを実行するクラスターの ID。
必須: 複数のクラスターが設定されている場合。
<FILTER>-
キーリファレンス (例:
key-reference=0xabc) またはattr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE形式のキー属性のスペース区切りリスト。これに一致するキー (複数可) を一覧表示対象として選択します。サポートされている CloudHSM CLI キー属性のリストについては、「CloudHSM CLI のキー属性」を参照してください
必須: いいえ
<MAX_ITEMS>-
コマンドの出力で返される項目の総数。使用可能な項目の総数が指定された値を上回る場合、コマンドの出力で next-token が提供されます。ページ分割を再開するには、後続コマンドの starting-token 引数で next-token 値を指定します。
必須: いいえ
<STARTING_TOKEN>-
ページ分割を始める場所を指定するトークン。これは、以前に切り詰められたレスポンスからの next-token です。
必須: いいえ
<VERBOSE>-
含まれている場合は、一致した各キーのすべての属性とキー情報を出力します。デフォルトでは、一致した各キーには key-reference とラベル属性のみが表示されます。管理者が使用する場合、このフラグは効果がありません。
必須: いいえ