本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 CloudHSM CLI 用 AES-PKCS5-PAD 封装密钥
使用 CloudHSM CLI 中的 key wrap aes-pkcs5-pad 命令通过硬件安全模块(HSM)上的 AES 密钥和 AES-PKCS5-PAD
包装机制包装有效载荷密钥。有效载荷密钥的extractable
属性必须设置为true
。
只有密钥的所有者(即创建密钥的加密用户(CU))才能包装密钥。共享密钥的用户可以使用该密钥进行加密操作。
要使用该key wrap aes-pkcs5-pad命令,您必须先在 AWS CloudHSM 集群中拥有 AES 密钥。您可以使用 使用 CloudHSM CLI 生成对称 AES 密钥 命令并将 wrap
属性设置为 true
来生成用于包装的 AES 密钥。
用户类型
以下类型的用户均可运行此命令。
-
加密用户 (CUs)
要求
-
要运行此命令,必须以 CU 身份登录。
语法
aws-cloudhsm >
help key wrap aes-pkcs5-pad
Usage: key wrap aes-pkcs5-pad [OPTIONS] --payload-filter [
<PAYLOAD_FILTER>
...] --wrapping-filter [<WRAPPING_FILTER>
...] 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 --payload-filter [<PAYLOAD_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 payload key --wrapping-filter [<WRAPPING_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 wrapping key --path<PATH>
Path to the binary file where the wrapped key data will be saved --wrapping-approval<WRAPPING_APPROVALR>
File path of signed quorum token file to approve operation for wrapping key --payload-approval<PAYLOAD_APPROVALR>
File path of signed quorum token file to approve operation for payload key -h, --help Print help
示例
此示例展示了如何通过 AES 密钥使用 key wrap aes-pkcs5-pad 命令并将 wrap
属性值设置为 true
。
aws-cloudhsm >
key wrap aes-pkcs5-pad --payload-filter attr.label=payload-key --wrapping-filter attr.label=aes-example
{ "error_code": 0, "data": { "payload_key_reference": "0x00000000001c08f1", "wrapping_key_reference": "0x00000000001c08ea", "wrapped_key_data": "MbuYNresfOKyGNnxKWen88nSfX+uUE/0qmGofSisicY=" } }
参数
<CLUSTER_ID>
-
要运行此操作的集群的 ID。
必需:如果已配置多个集群。
<PAYLOAD_FILTER>
-
密钥引用(例如
key-reference=0xabc
)或空格分隔的密钥属性列表,采用attr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE
形式,可选择有效载荷密钥。必需:是
<PATH>
-
保存包装密钥数据的二进制文件的路径。
必需:否
<WRAPPING_FILTER>
-
密钥引用(例如
key-reference=0xabc
)或空格分隔的密钥属性列表,采用attr.KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE
形式,可选择包装密钥。必需:是
<WRAPPING_APPROVALR>
-
指定已签名法定令牌文件的文件路径,以批准封装密钥的操作。仅当包装密钥的密钥管理服务法定值大于 1 时才需要。
<PAYLOAD_APPROVALR>
-
指定用于批准有效载荷密钥操作的已签名法定令牌文件的文件路径。仅当负载密钥的密钥管理服务法定值大于 1 时才需要。