刪除及還原金鑰版本

本頁面說明如何排定永久刪除 Cloud Key Management Service 金鑰版本。在 Cloud KMS 中,用於加密、解密、簽署和驗證資料的加密編譯金鑰內容會儲存在金鑰版本中。一個金鑰可以有零或多個金鑰版本。輪替金鑰時,您會建立新的金鑰版本。

刪除金鑰版本代表永久刪除金鑰內容。刪除金鑰版本時,金鑰名稱和金鑰版本編號等其他詳細資料不會刪除。金鑰刪除後,以該金鑰版本加密的資料就無法解密。

唯一的例外狀況是金鑰重新匯入,這項功能可讓您提供相同的原始金鑰內容,還原先前匯入的金鑰。

由於金鑰刪除作業通常無法復原,Cloud KMS 不允許立即刪除金鑰版本。而是安排刪除金鑰版本。金鑰版本會維持在已排定刪除狀態,時間長度可自行設定。在排定刪除期間,您可以還原金鑰版本,取消刪除作業。

預設的排定刪除時間長度為 30 天。您可以在建立金鑰時,自訂排定刪除時間長度。貴組織可以設定組織政策中的「每個金鑰的最短刪除排程時長」限制,強制執行最短刪除排程時長。

您也可以使用 Identity and Access Management (IAM) 管理金鑰存取權。IAM 作業會在幾秒內保持一致。詳情請參閱「使用 IAM」。

您也可以暫時停用金鑰版本。建議您先停用金鑰版本,再排定刪除時間,確保金鑰可以安全刪除。視組織政策而定,您可能需要先停用金鑰版本,才能排定刪除。如要進一步瞭解如何使用組織政策控管金鑰版本刪除作業,請參閱「控管金鑰版本刪除作業」。

在本文件的其餘部分,安排刪除金鑰稱為刪除金鑰,即使刪除作業不會立即執行。

事前準備

瞭解風險

金鑰版本刪除後即無法復原。刪除仍需使用的金鑰版本可能會有風險,包括:

  • 服務中斷:如果刪除啟動容器或執行個體所需的金鑰,服務或應用程式可能會無法使用。

  • 永久遺失資料:如果刪除用於加密資料的金鑰,該資料就會無法使用。以已刪除金鑰加密的資料,會視為加密碎裂。在某些情況下,刪除金鑰可能會導致加密資源永久刪除。

  • 法規或法規遵循問題:如果資料有保留期限,而您在保留期限結束前刪除存取資料所需的金鑰,可能會違反法規或法規遵循要求。

必要的角色

如要取得刪除及還原金鑰版本所需的權限,請要求管理員授予您金鑰的 Cloud KMS 管理員 (roles/cloudkms.admin) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

您或許也能透過自訂角色或其他預先定義的角色,取得必要權限。

檢查金鑰版本是否正在使用中

刪除金鑰版本前,請完成下列步驟,確認金鑰版本是否正在使用中:

  1. 查看金鑰使用情形追蹤詳細資料。如果有任何資源受到要刪除的金鑰版本保護,請使用其他金鑰版本重新加密。

  2. 為可能使用金鑰版本的任何服務或應用程式啟用記錄。

  3. 在含有金鑰的 Cloud KMS 專案中啟用記錄。

  4. 停用金鑰版本。停用金鑰版本後,該版本就無法使用。停用金鑰版本後,任何使用金鑰版本的嘗試都會失敗。

  5. 請持續監控記錄,直到確定沒有任何應用程式或服務仍依賴已停用的金鑰版本。如果任何錯誤指出無法存取金鑰版本,請將應用程式或資源設為使用其他金鑰版本。

    在刪除金鑰版本之前,您需要監控記錄的時間長度取決於金鑰類型、使用模式和機密程度。舉例來說,如果某個金鑰版本用於每季執行的程序,請先停用該金鑰版本,直到該程序成功完成,再刪除金鑰版本。

  6. 請根據適用的法規遵循要求,檢查金鑰的使用情形。舉例來說,金鑰版本和以該版本加密的資料可能受資料保留期限規範。

這些步驟可協助您判斷是否仍需要金鑰,但無法保證金鑰版本已不再需要。貴組織應實施程序和指南,確保金鑰版本刪除不會造成負面影響。

刪除金鑰版本

您可以刪除已啟用或停用的金鑰版本。

控制台

  1. 前往 Google Cloud 控制台的「Key Management」(金鑰管理) 頁面。

    前往「Key Management」(金鑰管理) 頁面

  2. 找出要排定刪除的金鑰版本,然後勾選旁邊的方塊。

  3. 按一下標頭中的「Destroy」。

  4. 在確認提示中輸入金鑰名稱,然後按一下「Schedule Destruction」(安排刪除作業)。

gcloud

如要在指令列使用 Cloud KMS,請先安裝或升級至最新版 Google Cloud CLI。

gcloud kms keys versions destroy KEY_VERSION \
    --key KEY_NAME \
    --keyring KEY_RING \
    --location LOCATION

更改下列內容:

  • KEY_VERSION:要刪除的金鑰版本編號。
  • KEY_NAME:金鑰名稱,其中包含要刪除的金鑰版本。
  • KEY_RING:金鑰環的名稱,內含要刪除的金鑰版本。
  • LOCATION:金鑰環的位置,其中包含要刪除的金鑰版本。

如要瞭解所有旗標和可能的值,請使用 --help 旗標執行指令。

C#

如要執行這段程式碼,請先設定 C# 開發環境,並安裝 Cloud KMS C# SDK。


using Google.Cloud.Kms.V1;

public class DestroyKeyVersionSample
{
    public CryptoKeyVersion DestroyKeyVersion(
      string projectId = "my-project", string locationId = "us-east1", string keyRingId = "my-key-ring", string keyId = "my-key", string keyVersionId = "123")
    {
        // Create the client.
        KeyManagementServiceClient client = KeyManagementServiceClient.Create();

        // Build the key version name.
        CryptoKeyVersionName keyVersionName = new CryptoKeyVersionName(projectId, locationId, keyRingId, keyId, keyVersionId);

        // Call the API.
        CryptoKeyVersion result = client.DestroyCryptoKeyVersion(keyVersionName);

        // Return the result.
        return result;
    }
}

Go

如要執行這段程式碼,請先設定 Go 開發環境,並安裝 Cloud KMS Go SDK。

import (
	"context"
	"fmt"
	"io"

	kms "cloud.google.com/go/kms/apiv1"
	"cloud.google.com/go/kms/apiv1/kmspb"
)

// destroyKeyVersion marks a specified key version for deletion. The key can be
// restored if requested within 24 hours.
func destroyKeyVersion(w io.Writer, name string) error {
	// name := "projects/my-project/locations/us-east1/keyRings/my-key-ring/cryptoKeys/my-key/cryptoKeyVersions/123"

	// Create the client.
	ctx := context.Background()
	client, err := kms.NewKeyManagementClient(ctx)
	if err != nil {
		return fmt.Errorf("failed to create kms client: %w", err)
	}
	defer client.Close()

	// Build the request.
	req := &kmspb.DestroyCryptoKeyVersionRequest{
		Name: name,
	}

	// Call the API.
	result, err := client.DestroyCryptoKeyVersion(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to destroy key version: %w", err)
	}
	fmt.Fprintf(w, "Destroyed key version: %s\n", result)
	return nil
}

Java

如要執行這段程式碼,請先設定 Java 開發環境,並安裝 Cloud KMS Java SDK。

import com.google.cloud.kms.v1.CryptoKeyVersion;
import com.google.cloud.kms.v1.CryptoKeyVersionName;
import com.google.cloud.kms.v1.KeyManagementServiceClient;
import java.io.IOException;

public class DestroyKeyVersion {

  public void destroyKeyVersion() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String locationId = "us-east1";
    String keyRingId = "my-key-ring";
    String keyId = "my-key";
    String keyVersionId = "123";
    destroyKeyVersion(projectId, locationId, keyRingId, keyId, keyVersionId);
  }

  // Schedule destruction of the given key version.
  public void destroyKeyVersion(
      String projectId, String locationId, String keyRingId, String keyId, String keyVersionId)
      throws IOException {
    // Initialize client that will be used to send requests. This client only
    // needs to be created once, and can be reused for multiple requests. After
    // completing all of your requests, call the "close" method on the client to
    // safely clean up any remaining background resources.
    try (KeyManagementServiceClient client = KeyManagementServiceClient.create()) {
      // Build the key version name from the project, location, key ring, key,
      // and key version.
      CryptoKeyVersionName keyVersionName =
          CryptoKeyVersionName.of(projectId, locationId, keyRingId, keyId, keyVersionId);

      // Destroy the key version.
      CryptoKeyVersion response = client.destroyCryptoKeyVersion(keyVersionName);
      System.out.printf("Destroyed key version: %s%n", response.getName());
    }
  }
}

Node.js

如要執行這段程式碼,請先設定 Node.js 開發環境,並安裝 Cloud KMS Node.js SDK。

//
// TODO(developer): Uncomment these variables before running the sample.
//
// const projectId = 'my-project';
// const locationId = 'us-east1';
// const keyRingId = 'my-key-ring';
// const keyId = 'my-key';
// const versionId = '123';

// Imports the Cloud KMS library
const {KeyManagementServiceClient} = require('@google-cloud/kms');

// Instantiates a client
const client = new KeyManagementServiceClient();

// Build the key version name
const versionName = client.cryptoKeyVersionPath(
  projectId,
  locationId,
  keyRingId,
  keyId,
  versionId
);

async function destroyKeyVersion() {
  const [version] = await client.destroyCryptoKeyVersion({
    name: versionName,
  });

  console.log(`Destroyed key version: ${version.name}`);
  return version;
}

return destroyKeyVersion();

PHP

如要執行這段程式碼,請先瞭解如何在 Google Cloud上使用 PHP,並安裝 Cloud KMS PHP SDK。

use Google\Cloud\Kms\V1\Client\KeyManagementServiceClient;
use Google\Cloud\Kms\V1\DestroyCryptoKeyVersionRequest;

function destroy_key_version(
    string $projectId = 'my-project',
    string $locationId = 'us-east1',
    string $keyRingId = 'my-key-ring',
    string $keyId = 'my-key',
    string $versionId = '123'
) {
    // Create the Cloud KMS client.
    $client = new KeyManagementServiceClient();

    // Build the key version name.
    $keyVersionName = $client->cryptoKeyVersionName($projectId, $locationId, $keyRingId, $keyId, $versionId);

    // Call the API.
    $destroyCryptoKeyVersionRequest = (new DestroyCryptoKeyVersionRequest())
        ->setName($keyVersionName);
    $destroyedVersion = $client->destroyCryptoKeyVersion($destroyCryptoKeyVersionRequest);
    printf('Destroyed key version: %s' . PHP_EOL, $destroyedVersion->getName());

    return $destroyedVersion;
}

Python

如要執行這段程式碼,請先設定 Python 開發環境,並安裝 Cloud KMS Python SDK。

from google.cloud import kms


def destroy_key_version(
    project_id: str, location_id: str, key_ring_id: str, key_id: str, version_id: str
) -> kms.CryptoKeyVersion:
    """
    Schedule destruction of the given key version.

    Args:
        project_id (string): Google Cloud project ID (e.g. 'my-project').
        location_id (string): Cloud KMS location (e.g. 'us-east1').
        key_ring_id (string): ID of the Cloud KMS key ring (e.g. 'my-key-ring').
        key_id (string): ID of the key to use (e.g. 'my-key').
        version_id (string): ID of the key version to destroy (e.g. '1').

    Returns:
        CryptoKeyVersion: The version.

    """

    # Create the client.
    client = kms.KeyManagementServiceClient()

    # Build the key version name.
    key_version_name = client.crypto_key_version_path(
        project_id, location_id, key_ring_id, key_id, version_id
    )

    # Call the API.
    destroyed_version = client.destroy_crypto_key_version(
        request={"name": key_version_name}
    )
    print(f"Destroyed key version: {destroyed_version.name}")
    return destroyed_version

Ruby

如要執行這段程式碼,請先設定 Ruby 開發環境,並安裝 Cloud KMS Ruby SDK。

# TODO(developer): uncomment these values before running the sample.
# project_id  = "my-project"
# location_id = "us-east1"
# key_ring_id = "my-key-ring"
# key_id      = "my-key"
# version_id  = "123"

# Require the library.
require "google/cloud/kms"

# Create the client.
client = Google::Cloud::Kms.key_management_service

# Build the key version name.
key_version_name = client.crypto_key_version_path project:            project_id,
                                                  location:           location_id,
                                                  key_ring:           key_ring_id,
                                                  crypto_key:         key_id,
                                                  crypto_key_version: version_id

# Call the API.
destroyed_version = client.destroy_crypto_key_version name: key_version_name
puts "Destroyed key version: #{destroyed_version.name}"

API

這些範例使用 curl 做為 HTTP 用戶端,示範如何使用 API。如要進一步瞭解存取控管,請參閱「存取 Cloud KMS API」。

呼叫 CryptoKeyVersions.destroy 方法,刪除金鑰版本。

curl "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/KEY_VERSION:destroy" \
    --request "POST" \
    --header "authorization: Bearer TOKEN"

更改下列內容:

  • PROJECT_ID:專案 ID,用於存放您要刪除的金鑰版本。
  • LOCATION:金鑰環的位置,其中包含要刪除的金鑰版本。
  • KEY_RING:金鑰環的名稱,內含要刪除的金鑰版本。
  • KEY_NAME:金鑰名稱,其中包含要刪除的金鑰版本。
  • KEY_VERSION:要刪除的金鑰版本編號。

如果無法刪除金鑰版本,可能是因為貴組織要求先停用金鑰版本,才能刪除。請先停用金鑰版本,再進行刪除。

提交刪除要求後,金鑰版本的狀態會變更為「已排定刪除」。金鑰設定的排定刪除時間過後,金鑰版本的狀態會變更為「已刪除」,表示已開始從使用中的系統邏輯刪除金鑰內容,且客戶無法復原金鑰內容。金鑰資料最多可在 Google 系統中保留 45 天 (從排定刪除時間算起)。

如要在金鑰版本排定刪除時收到快訊,請參閱「搭配使用 Cloud Monitoring 和 Cloud KMS」。

已刪除的金鑰版本不屬於計費資源。

刪除外部金鑰

如要永久移除 Cloud EKM 金鑰與外部金鑰之間的關聯,可以刪除金鑰版本。「已排定刪除」期限過後,金鑰就會刪除。金鑰版本刪除後,您就無法再加密資料,也無法解密以 Cloud EKM 金鑰版本加密的資料。

在 Cloud KMS 中刪除手動管理的金鑰版本,不會修改外部金鑰管理工具中的金鑰。建議您先在 Google Cloud中刪除金鑰或金鑰版本。Cloud EKM 金鑰版本刪除後,您可以在外部金鑰管理工具中刪除金鑰內容。

在 Cloud KMS 中刪除協調式外部金鑰版本時,會先刪除 Google Cloud中的金鑰版本,然後向 EKM 傳送刪除要求,刪除外部金鑰內容。

還原金鑰版本

在金鑰版本狀態為「已安排刪除」的期間,您可以提交還原要求來還原金鑰版本。

控制台

  1. 前往 Google Cloud 控制台的「Key Management」(金鑰管理) 頁面。

    前往「Key Management」(金鑰管理) 頁面

  2. 按一下金鑰環名稱,找出要還原的金鑰版本。

  3. 按一下要還原的金鑰版本。

  4. 找出要還原的金鑰版本,然後勾選旁邊的方塊。

  5. 按一下標頭中的「還原」。

  6. 在確認提示中,按一下「還原」。

gcloud

如要在指令列使用 Cloud KMS,請先安裝或升級至最新版 Google Cloud CLI。

gcloud kms keys versions restore KEY_VERSION \
    --key KEY_NAME \
    --keyring KEY_RING \
    --location LOCATION

更改下列內容:

  • KEY_VERSION:要還原的金鑰版本編號。
  • KEY_NAME:金鑰名稱,其中包含要還原的金鑰版本。
  • KEY_RING:金鑰環的名稱,其中包含要還原的金鑰版本。
  • LOCATION:金鑰環的位置,其中包含要還原的金鑰版本。

如要瞭解所有旗標和可能的值,請使用 --help 旗標執行指令。

C#

如要執行這段程式碼,請先設定 C# 開發環境,並安裝 Cloud KMS C# SDK。


using Google.Cloud.Kms.V1;

public class RestoreKeyVersionSample
{
    public CryptoKeyVersion RestoreKeyVersion(string projectId = "my-project", string locationId = "us-east1", string keyRingId = "my-key-ring", string keyId = "my-key", string keyVersionId = "123")
    {
        // Create the client.
        KeyManagementServiceClient client = KeyManagementServiceClient.Create();

        // Build the key version name.
        CryptoKeyVersionName cryptoKeyVersionName = new CryptoKeyVersionName(projectId, locationId, keyRingId, keyId, keyVersionId);

        // Call the API.
        CryptoKeyVersion result = client.RestoreCryptoKeyVersion(cryptoKeyVersionName);

        // Return the result.
        return result;
    }
}

Go

如要執行這段程式碼,請先設定 Go 開發環境,並安裝 Cloud KMS Go SDK。

import (
	"context"
	"fmt"
	"io"

	kms "cloud.google.com/go/kms/apiv1"
	"cloud.google.com/go/kms/apiv1/kmspb"
)

// restoreKeyVersion attempts to recover a key that has been marked for
// destruction in the past 24h.
func restoreKeyVersion(w io.Writer, name string) error {
	// name := "projects/my-project/locations/us-east1/keyRings/my-key-ring/cryptoKeys/my-key/cryptoKeyVersions/123"

	// Create the client.
	ctx := context.Background()
	client, err := kms.NewKeyManagementClient(ctx)
	if err != nil {
		return fmt.Errorf("failed to create kms client: %w", err)
	}
	defer client.Close()

	// Build the request.
	req := &kmspb.RestoreCryptoKeyVersionRequest{
		Name: name,
	}

	// Call the API.
	result, err := client.RestoreCryptoKeyVersion(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to restore key version: %w", err)
	}
	fmt.Fprintf(w, "Restored key version: %s\n", result)
	return nil
}

Java

如要執行這段程式碼,請先設定 Java 開發環境,並安裝 Cloud KMS Java SDK。

import com.google.cloud.kms.v1.CryptoKeyVersion;
import com.google.cloud.kms.v1.CryptoKeyVersionName;
import com.google.cloud.kms.v1.KeyManagementServiceClient;
import java.io.IOException;

public class RestoreKeyVersion {

  public void restoreKeyVersion() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String locationId = "us-east1";
    String keyRingId = "my-key-ring";
    String keyId = "my-key";
    String keyVersionId = "123";
    restoreKeyVersion(projectId, locationId, keyRingId, keyId, keyVersionId);
  }

  // Schedule destruction of the given key version.
  public void restoreKeyVersion(
      String projectId, String locationId, String keyRingId, String keyId, String keyVersionId)
      throws IOException {
    // Initialize client that will be used to send requests. This client only
    // needs to be created once, and can be reused for multiple requests. After
    // completing all of your requests, call the "close" method on the client to
    // safely clean up any remaining background resources.
    try (KeyManagementServiceClient client = KeyManagementServiceClient.create()) {
      // Build the key version name from the project, location, key ring, key,
      // and key version.
      CryptoKeyVersionName keyVersionName =
          CryptoKeyVersionName.of(projectId, locationId, keyRingId, keyId, keyVersionId);

      // Restore the key version.
      CryptoKeyVersion response = client.restoreCryptoKeyVersion(keyVersionName);
      System.out.printf("Restored key version: %s%n", response.getName());
    }
  }
}

Node.js

如要執行這段程式碼,請先設定 Node.js 開發環境,並安裝 Cloud KMS Node.js SDK。

//
// TODO(developer): Uncomment these variables before running the sample.
//
// const projectId = 'my-project';
// const locationId = 'us-east1';
// const keyRingId = 'my-key-ring';
// const keyId = 'my-key';
// const versionId = '123';

// Imports the Cloud KMS library
const {KeyManagementServiceClient} = require('@google-cloud/kms');

// Instantiates a client
const client = new KeyManagementServiceClient();

// Build the key version name
const versionName = client.cryptoKeyVersionPath(
  projectId,
  locationId,
  keyRingId,
  keyId,
  versionId
);

async function restoreKeyVersion() {
  const [version] = await client.restoreCryptoKeyVersion({
    name: versionName,
  });

  console.log(`Restored key version: ${version.name}`);
  return version;
}

return restoreKeyVersion();

PHP

如要執行這段程式碼,請先瞭解如何在 Google Cloud上使用 PHP,並安裝 Cloud KMS PHP SDK。

use Google\Cloud\Kms\V1\Client\KeyManagementServiceClient;
use Google\Cloud\Kms\V1\RestoreCryptoKeyVersionRequest;

function restore_key_version(
    string $projectId = 'my-project',
    string $locationId = 'us-east1',
    string $keyRingId = 'my-key-ring',
    string $keyId = 'my-key',
    string $versionId = '123'
) {
    // Create the Cloud KMS client.
    $client = new KeyManagementServiceClient();

    // Build the key version name.
    $keyVersionName = $client->cryptoKeyVersionName($projectId, $locationId, $keyRingId, $keyId, $versionId);

    // Call the API.
    $restoreCryptoKeyVersionRequest = (new RestoreCryptoKeyVersionRequest())
        ->setName($keyVersionName);
    $restoredVersion = $client->restoreCryptoKeyVersion($restoreCryptoKeyVersionRequest);
    printf('Restored key version: %s' . PHP_EOL, $restoredVersion->getName());

    return $restoredVersion;
}

Python

如要執行這段程式碼,請先設定 Python 開發環境,並安裝 Cloud KMS Python SDK。

from google.cloud import kms


def restore_key_version(
    project_id: str, location_id: str, key_ring_id: str, key_id: str, version_id: str
) -> kms.CryptoKeyVersion:
    """
    Restore a key version scheduled for destruction.

    Args:
        project_id (string): Google Cloud project ID (e.g. 'my-project').
        location_id (string): Cloud KMS location (e.g. 'us-east1').
        key_ring_id (string): ID of the Cloud KMS key ring (e.g. 'my-key-ring').
        key_id (string): ID of the key to use (e.g. 'my-key').
        version_id (string): ID of the version to use (e.g. '1').

    Returns:
        CryptoKeyVersion: Restored Cloud KMS key version.

    """

    # Create the client.
    client = kms.KeyManagementServiceClient()

    # Build the key version name.
    key_version_name = client.crypto_key_version_path(
        project_id, location_id, key_ring_id, key_id, version_id
    )

    # Call the API.
    restored_version = client.restore_crypto_key_version(
        request={"name": key_version_name}
    )
    print(f"Restored key version: {restored_version.name}")
    return restored_version

Ruby

如要執行這段程式碼,請先設定 Ruby 開發環境,並安裝 Cloud KMS Ruby SDK。

# TODO(developer): uncomment these values before running the sample.
# project_id  = "my-project"
# location_id = "us-east1"
# key_ring_id = "my-key-ring"
# key_id      = "my-key"
# version_id  = "123"

# Require the library.
require "google/cloud/kms"

# Create the client.
client = Google::Cloud::Kms.key_management_service

# Build the key version name.
key_version_name = client.crypto_key_version_path project:            project_id,
                                                  location:           location_id,
                                                  key_ring:           key_ring_id,
                                                  crypto_key:         key_id,
                                                  crypto_key_version: version_id

# Call the API.
restored_version = client.restore_crypto_key_version name: key_version_name
puts "Restored key version: #{restored_version.name}"

API

這些範例使用 curl 做為 HTTP 用戶端,示範如何使用 API。如要進一步瞭解存取控管,請參閱「存取 Cloud KMS API」。

呼叫 CryptoKeyVersions.restore 方法,還原金鑰版本。

curl "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/KEY_VERSION:restore" \
    --request "POST" \
    --header "authorization: Bearer TOKEN"

更改下列內容:

  • PROJECT_ID:專案 ID,用於存放您要還原的金鑰版本。
  • LOCATION:金鑰環的位置,其中包含要還原的金鑰版本。
  • KEY_RING:金鑰環的名稱,其中包含要還原的金鑰版本。
  • KEY_NAME:金鑰名稱,其中包含要還原的金鑰版本。
  • KEY_VERSION:要還原的金鑰版本編號。

還原要求完成後,金鑰版本的狀態會變更為停用。您必須啟用金鑰才能使用。

必要 IAM 權限

如要刪除金鑰版本,呼叫端必須具備金鑰、金鑰環或專案、資料夾或組織的 cloudkms.cryptoKeyVersions.destroy IAM 權限。

如要還原金鑰版本,呼叫端必須具備 cloudkms.cryptoKeyVersions.restore 權限。

這兩項權限都會授予 Cloud KMS 管理員角色 (roles/cloudkms.admin)。

刪除時間軸

Cloud KMS 承諾在排定刪除時間後的 45 天內,從所有 Google 基礎架構中刪除客戶金鑰內容。包括從使用中的系統和資料中心備份中移除資料。其他客戶資料則適用標準Google Cloud 刪除時間表,即 180 天。