本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Cloud 共享密钥 HSM CLI
使用 Cloud HSM CLI 中的key share命令与 AWS CloudHSM 集群CUs中的其他人共享密钥。
只有创建密钥、并因此拥有密钥的 CU 才能共享密钥。共享密钥的用户可以在加密操作中使用该密钥,但不能删除、导出、共享或取消共享该密钥。此外,这些用户无法更改密钥属性。
用户类型
以下类型的用户均可运行此命令。
-
加密用户 (CUs)
要求
要运行此命令,必须以 CU 身份登录。
语法
aws-cloudhsm >
help key share
Share a key in the HSM cluster with another user Usage: key share --filter [
<FILTER>
...] --username<USERNAME>
--role<ROLE>
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 a matching key for sharing --username<USERNAME>
A username with which the key will be shared --role<ROLE>
Role the user has in the cluster Possible values: - crypto-user: A CryptoUser has the ability to manage and use keys - admin: An Admin has the ability to manage user accounts -h, --help Print help (see a summary with '-h')
示例:与另一个 CU 共享密钥
以下示例演示了如何使用 key share 命令与 CU alice
共享密钥。
-
运行 key share 命令与
alice
共享密钥。aws-cloudhsm >
key share --filter attr.label="rsa_key_to_share" attr.class=private-key --username alice --role crypto-user
{ "error_code": 0, "data": { "message": "Key shared successfully" } }
-
运行 key list 命令。
aws-cloudhsm >
key list --filter attr.label="rsa_key_to_share" attr.class=private-key --verbose
{ "error_code": 0, "data": { "matched_keys": [ { "key-reference": "0x00000000001c0686", "key-info": { "key-owners": [ { "username": "cu3", "key-coverage": "full" } ], "shared-users": [ { "username": "cu2", "key-coverage": "full" }, { "username": "cu1", "key-coverage": "full" }, { "username": "cu4", "key-coverage": "full" }, { "username": "cu5", "key-coverage": "full" }, { "username": "cu6", "key-coverage": "full" }, { "username": "cu7", "key-coverage": "full" }, { "username": "alice", "key-coverage": "full" } ], "cluster-coverage": "full" }, "attributes": { "key-type": "rsa", "label": "rsa_key_to_share", "id": "", "check-value": "0xae8ff0", "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": true, "trusted": false, "unwrap": true, "verify": false, "wrap": false, "wrap-with-trusted": false, "key-length-bytes": 1219, "public-exponent": "0x010001", "modulus": "0xa8855cba933cec0c21a4df0450ec31675c024f3e65b2b215a53d2bda6dcd191f75729150b59b4d86df58254c8f518f7d000cc04d8e958e7502c7c33098e28da4d94378ef34fb57d1cc7e042d9119bd79be0df728421a980a397095157da24cf3cc2b6dab12225d33fdca11f0c6ed1a5127f12488cda9a556814b39b06cd8373ff5d371db2212887853621b8510faa7b0779fbdec447e1f1d19f343acb02b22526487a31f6c704f8f003cb4f7013136f90cc17c2c20e414dc1fc7bcfb392d59c767900319679fc3307388633485657ce2e1a3deab0f985b0747ef4ed339de78147d1985d14fdd8634219321e49e3f5715e79c298f18658504bab04086bfbdcd3b", "modulus-size-bits": 2048 } } ], "total_key_count": 1, "returned_key_count": 1 } }
-
在上面的列表中,verify
alice
在shared-users
列表中
参数
<CLUSTER_ID>
-
要运行此操作的集群的 ID。
必需:如果已配置多个集群。
<FILTER>
-
按键引用(例如
key-reference=0xabc
)或以空格分隔的按键属性列表,attr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE
以选择要删除的匹配密钥。有关支持的密钥属性的列表,请参阅 云的关键属性 HSM CLI。
必需:是
<USERNAME>
-
为用户指定友好名称。最大长度为 31 个字符。唯一允许的特殊字符是下划线 ( _ )。此命令中的用户名不区分大小写,用户名始终以小写形式显示。
必需:是
<ROLE>
-
指定分配给该用户的角色。此参数为必需参数。要获取用户的角色,请使用 user list 命令。有关用户类型的详细信息HSM,请参阅HSM云端用户类型 HSM CLI。
必需:是