檢視根金鑰或標準金鑰的詳細資料

您可以使用來擷取單一加密金鑰的一般性質 IBM Cloud® Hyper Protect Crypto Services.

擷取根金鑰或標準金鑰需要 WriterManager 存取原則,但您可能需要一種方法,只檢視根金鑰或標準金鑰的詳細資料,例如轉移歷程或配置,而不擷取金鑰本身。 如果您具有 讀者 存取權,則可以使用 Hyper Protect Crypto Services 金鑰管理 API 來僅擷取根金鑰或標準金鑰的相關 meta 資料。

使用使用者介面檢視金鑰詳細資料

您可以透過完成下列步驟,使用使用者介面來檢視特定金鑰的詳細資料:

  1. 登入使用者介面
  2. 選單>資源列表查看您的資源清單。
  3. 從 IBM Cloud 資源清單,選取已佈建的 Hyper Protect Crypto Services 實例。
  4. KMS 金鑰頁面,使用按鍵表來瀏覽您服務中的金鑰。
  5. 按一下 動作 圖示 「動作」圖示,以開啟特定按鍵的選項清單。
  6. 從選項功能表中,按一下 檢視金鑰詳細資料,以檢視金鑰的詳細資料。

使用金鑰管理服務 API 檢視金鑰詳細資料

要查看有關特定根密鑰或標準密鑰的詳細信息,您可以創建 GET 調用以下端點。

https://<instance_ID>.api.<region>.hs-crypto.appdomain.cloud/api/v2/keys/<key_ID_or_alias>/metadata
  1. 擷取鑑別認證以使用服務中的金鑰

  2. 檢索您要檢查的密鑰的 ID。

    ID 值用來存取金鑰的詳細資訊。 您可以透過下列方式在服務實例中尋找金鑰的 ID: 擷取金鑰清單,或透過存取使用者介面。

  3. 執行下列 cURL 指令,以取得金鑰的詳細資料。

    curl -X GET \
      'https://<instance_ID>.api.<region>.hs-crypto.appdomain.cloud/api/v2/keys/<key_ID_or_alias>/metadata' \
      -H 'accept: application/vnd.ibm.kms.key+json' \
      -H 'authorization: Bearer <IAM_token>' \
      -H 'bluemix-instance: <instance_ID>' \
      -H 'x-kms-key-ring: <key_ring_ID>' \
      -H 'correlation-id: <correlation_ID>'
    

    根據下表取代範例要求中的變數。

    表 1. 說明使用 API 檢視金鑰詳細資料所需的變數
    變數 說明
    region 必要。 地區縮寫,例如 us-south 或者 eu-de,代表您所在的地理區域Hyper Protect Crypto Services實例駐留。 如需相關資訊,請參閱地區服務端點
    key_ID_or_alias 必要。 您要檢查之金鑰的 ID 或別名。
    IAM_token 必要。 您的 IBM Cloud 存取記號。 請在 cURL 要求中包含 IAM 記號的完整內容,包括 Bearer 值。 有關更多信息,請參閱 檢索訪問令牌
    instance_ID 必要。 分配給您的唯一識別符Hyper Protect Crypto Services實例。 有關更多信息,請參閱 檢索實例 ID
    key_ring_ID 選用。 金鑰所屬金鑰環的唯一 ID。 如果未指定,Hyper Protect Crypto Services 將在與指定實例相關聯的每個金鑰環中搜尋金鑰。 因此,建議為更最佳化的要求指定金鑰環 ID。

    附註: 在沒有 x-kms-key-ring 標頭的情況下建立之金鑰的金鑰環 ID 為: 預設值。 如需相關資訊,請參閱 管理金鑰環

    correlation_ID 用來追蹤及關聯交易的唯一 ID。

    成功的 GET api/v2/keys/<key_ID_or_alias>/metadata 回應會傳回金鑰的相關詳細資料。 下列 JSON 物件顯示標準金鑰的回覆值範例。

    {
      "metadata": {
        "collectionType": "application/vnd.ibm.kms.key+json",
        "collectionTotal": 1
      },
      "resources": [
        {
          "type": "application/vnd.ibm.kms.key+json",
          "id": "02fd6835-6001-4482-a892-13bd2085f75d",
          "name": "test-standard-key",
          "state": 1,
          "extractable": true,
          "crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/f047b55a3362ac06afad8a3f2f5586ea:12e8c9c2-a162-472d-b7d6-8b9a86b815a6:key:02fd6835-6001-4482-a892-13bd2085f75d",
          "imported": false,
          "creationDate": "2020-03-12T03:50:12Z",
          "createdBy": "...",
          "algorithmType": "AES",
          "algorithmMetadata": {
            "bitLength": "256",
            "mode": "CBC_PAD"
          },
          "algorithmBitSize": 256,
          "algorithmMode": "CBC_PAD",
          "lastUpdateDate": "2020-03-12T03:50:12Z",
          "dualAuthDelete": {
            "enabled": false
          },
          "deleted": false
        }
      ]
    }
    

    需要擷取標準金鑰的 payload 值嗎? 若要進一步瞭解,請參閱 擷取根金鑰或標準金鑰

    如需回應參數的詳細說明,請參閱 Hyper Protect Crypto Services 金鑰管理 REST API 參考資料文件