全部產品
Search
文件中心

Key Management Service:shareKey

更新時間:Nov 05, 2024

本文介紹如何使用shareKey命令實現密鑰的共用和不共用。

功能說明

shareKey命令可將您的密鑰共用給其他使用者,也可取消其他使用者對您的密鑰共用。只有密鑰所有者才能共用和不共用密鑰,另外您還可以在建立密鑰時共用它。

重要

在運行此命令之前,必須啟動hsm_mgmt_tool並登入HSM,並確保登入使用者的使用者類型在命令允許的範圍內。

使用者類型

以下使用者可運行此命令,使用者說明請參見HSM使用者權限表

  • 加密使用者(CU)

文法

請按照下方文法輸入參數,更多請參見參數

shareKey <key handle> <user id> <(share/unshare key?) 1/0>
重要

您必須按文法指定的順序輸入參數。

樣本

  1. 使用listUsers命令列舉HSM使用者

    cloudmgmt>listUsers
    Users on server 0(172.16.0.2):
    Number of users found:4
    
        User Id    		User Type      	User Name      			   MofnPubKey  	 LoginFailureCnt       	 2FA
             1     		CO     		admin                                  	 NO               0    	       	  NO
             2     		AU     		app_user                               	 NO               0    	       	  NO
             3     		CU     		crypto_user                            	 NO               0    	       	  NO
             4     		CU     		crypto_user1                           	 NO               0    	       	  NO
  2. crypto_user使用loginHSM登入HSM。

    cloudmgmt>loginHSM CU crypto_user user123
    loginHSM success on server 0(172.16.0.2)
  3. crypto_user和crypto_user1(User ID為4)共用密鑰6

    cloudmgmt>shareKey 6 4 1
    *************************CAUTION********************************
    This is a CRITICAL operation, should be done on all nodes in the
    cluster. Cav server does NOT synchronize these changes 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
    shareKey success on server 0(172.16.0.2)

參數

參數名稱

描述

是否必需

有效值

<key handle>

密鑰控制代碼

無特殊要求

<user id>

使用者id

無特殊要求

<(share/unshare key?) 1/0>

是否共用密鑰

  • 1 共用密鑰

  • 0 不共用