

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

# 使用 CM AWS CloudHSM U 将用户与密钥相关联
<a name="cloudhsm_mgmt_util-registerQuorumPubKey"></a>

使用 c AWS CloudHSM loudhsm\$1mgmt\$1util 中的**registerQuorumPubKey**命令将硬件安全模块 (HSM) 用户与非对称 RSA-2048 密钥对关联起来。将 HSM 用户与密钥关联后，这些用户就可以使用私钥批准仲裁人数请求，集群可以使用注册的公钥验证签名是否来自该用户。有关仲裁身份验证的更多信息，请参阅[管理仲裁身份验证（M of N 访问控制）](quorum-authentication.md)。

**提示**  
*在 AWS CloudHSM 文档中，法定人数身份验证有时被称为 M of N (MoFN)，这意味着在总数 N 个批准者中，至少有 *M* 个批准者。*

## 用户类型
<a name="registerQuorumPubKey-userType"></a>

以下类型的用户均可运行此命令。
+ 加密员（CO）

## 语法
<a name="registerQuorumPubKey-syntax"></a>

由于此命令没有命名参数，因此您必须按语法图中指定的顺序输入参数。

```
registerQuorumPubKey <user-type> <user-name> <registration-token> <signed-registration-token> <public-key>
```

## 示例
<a name="registerQuorumPubKey-examples"></a>

此示例说明如何使用 **registerQuorumPubKey** 将加密员（CO）注册为仲裁身份验证请求的批准者。若要运行此命令，您必须拥有非对称 RSA-2048 密钥对、已签名令牌和未签名令牌。有关要求的更多信息，请参阅 [参数](#registerQuorumPubKey-params)。

**Example ：注册 HSM 用户以进行仲裁身份验证**  
此示例将名为 `quorum_officer` 的 CO 注册为仲裁身份验证批准者。  

```
aws-cloudhsm> registerQuorumPubKey CO <quorum_officer> </path/to/quorum_officer.token> </path/to/quorum_officer.token.sig> </path/to/quorum_officer.pub>

*************************CAUTION********************************
This is a CRITICAL operation, should be done on all nodes in the
cluster. AWS does NOT synchronize these changes automatically with the
nodes on which this operation is not executed or failed, please
ensure this operation is executed on all nodes in the cluster.
****************************************************************

Do you want to continue(y/n)?y
registerQuorumPubKey success on server 0(10.0.0.1)
```
最后一个命令使用 [listUsers](cloudhsm_mgmt_util-listUsers.md) 命令验证 `quorum_officer` 是否以 MofN 用户身份注册。  

```
aws-cloudhsm> listUsers
Users on server 0(10.0.0.1):
Number of users found:3

    User Id             User Type       User Name                          MofnPubKey    LoginFailureCnt         2FA
         1              PCO             admin                                    NO               0               NO
         2              AU              app_user                                 NO               0               NO
         3              CO              quorum_officer                          YES               0               NO
```

## 参数
<a name="registerQuorumPubKey-params"></a>

由于此命令没有命名参数，因此您必须按语法图中指定的顺序输入参数。

```
registerQuorumPubKey <user-type> <user-name> <registration-token> <signed-registration-token> <public-key>
```

**<user-type>**  
指定用户类型。此参数为必需参数。  
有关 HSM 上的用户类型的详细信息，请参阅 [AWS CloudHSM 管理实用程序的 HSM 用户类型](understanding-users-cmu.md)。  
有效值：  
+ **CO**：加密员可以管理用户，但无法管理密钥。
是否必需：是

**<user-name>**  
为用户指定友好名称。最大长度为 31 个字符。唯一允许的特殊字符是下划线 ( \$1 )。  
用户名在创建之后无法更改。在 cloudhsm\$1mgmt\$1util 命令中，用户类型和密码都区分大小写，但用户名不区分大小写。  
是否必需：是

**<registration-token>**  
指定包含未签名注册令牌的文件路径。可以有最大文件大小为 245 字节的任何随机数据。有关创建未签名注册令牌的更多信息，请参阅[创建和签名注册令牌](quorum-authentication-crypto-officers-first-time-setup.md#mofn-registration-token)。  
是否必需：是

**<signed-registration-token>**  
指定包含注册令牌的 SHA256 \$1PKCS 机制签名哈希值的文件路径。有关更多信息，请参阅[创建和签名注册令牌](quorum-authentication-crypto-officers-first-time-setup.md#mofn-registration-token)。  
是否必需：是

**<public-key>**  
指定包含非对称 RSA-2048 密钥对公钥的文件路径。使用私有密钥对注册令牌进行签名。有关更多信息，请参阅[创建 RSA 密钥对](quorum-authentication-crypto-officers-first-time-setup.md#mofn-key-pair-create)。  
是否必需：是  
集群使用相同的密钥进行仲裁身份验证和双重身份验证 (2FA, two-factor authentication)。这意味着您无法对使用 **registerQuorumPubKey** 进行双因素身份验证的用户轮换仲裁密钥。若要要轮换密钥，必须使用 **changePswd**。有关使用仲裁身份验证和双因素身份验证的更多信息，请参阅[仲裁身份验证和双因素身份验证](quorum-2fa.md)。

## 相关主题
<a name="registerQuorumPubKey-seealso"></a>
+ [创建 RSA 密钥对](quorum-authentication-crypto-officers-first-time-setup.md#mofn-key-pair-create)
+ [创建注册令牌并签名](quorum-authentication-crypto-officers-first-time-setup.md#mofn-registration-token)
+ [通过 HSM 注册公钥](quorum-authentication-crypto-officers-first-time-setup.md#mofn-register-key)
+ [管理仲裁身份验证（M of N 访问控制）](quorum-authentication.md)
+ [仲裁身份验证和双因素身份验证](quorum-2fa.md)
+ [listUsers](cloudhsm_mgmt_util-listUsers.md)