key set-attribute - AWS CloudHSM

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

key set-attribute

使用key set-attribute命令设置集 AWS CloudHSM 群中密钥的属性。只有创建密钥、并因此拥有密钥的 CU 才能更改密钥属性。

有关可在 CloudHSM CLI 中使用的密钥属性列表,请参阅 CloudHSM CLI 的密钥属性

用户类型

以下类型的用户均可运行此命令。

  • 加密用户 (CU) 可运行此命令。

  • 管理员可以设置信任属性。

要求

要运行此命令,必须以 CU 身份登录。若要设置信任属性,您必须以管理员身份登录。

语法

aws-cloudhsm > help key set-attribute Set an attribute for a key in the HSM cluster Usage: cloudhsm-cli key set-attribute [OPTIONS] --filter [<FILTER>...] --name <KEY_ATTRIBUTE> --value <KEY_ATTRIBUTE_VALUE> 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 to modify --name <KEY_ATTRIBUTE> Name of attribute to be set --value <KEY_ATTRIBUTE_VALUE>... Attribute value to be set -h, --help Print help

示例:设置密钥属性

以下示例将介绍了如何使用 key set-attribute 命令设置标签。

  1. 使用带有 my_key 标签的密钥,如下所示:

    aws-cloudhsm > key set-attribute --filter attr.label=my_key --name encrypt --value false { "error_code": 0, "data": { "message": "Attribute set successfully" } }
  2. 使用 key list 命令确认 encrypt 属性已更改:

    aws-cloudhsm > key list --filter attr.label=my_key --verbose { "error_code": 0, "data": { "matched_keys": [ { "key-reference": "0x00000000006400ec", "key-info": { "key-owners": [ { "username": "bob", "key-coverage": "full" } ], "shared-users": [], "cluster-coverage": "full" }, "attributes": { "key-type": "aes", "label": "my_key", "id": "", "check-value": "0x6bd9f7", "class": "secret-key", "encrypt": false, "decrypt": true, "token": true, "always-sensitive": true, "derive": true, "destroyable": true, "extractable": true, "local": true, "modifiable": true, "never-extractable": false, "private": true, "sensitive": true, "sign": true, "trusted": true, "unwrap": true, "verify": true, "wrap": true, "wrap-with-trusted": false, "key-length-bytes": 32 } } ], "total_key_count": 1, "returned_key_count": 1 } }

参数

<CLUSTER_ID>

要运行此操作的集群的 ID。

必需:如果已配置多个集群。

<KEY_ATTRIBUTE>

指定了键属性名称。

必需:是

<FILTER>

按键引用(例如key-reference=0xabc)或以空格分隔的按键属性列表,attr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE以选择要删除的匹配密钥。

有关支持的 CloudHSM CLI key 密钥属性列表,请参阅 CloudHSM CLI 的密钥属性

必需:否

<KEY_ATTRIBUTE_VALUE>

指定密钥属性值。

必需:是

<KEY_REFERENCE>

密钥的十六进制或十进制表现形式(例如密钥处理程序)。

必需:否

相关 主题