鍵バージョンの破棄と復元

このページでは、Cloud Key Management Service の鍵バージョンを永久に破棄するようにスケジュールする方法について説明します。Cloud KMS では、データの暗号化、復号、署名、検証に使用する暗号鍵マテリアルが、鍵バージョンに保存されています。鍵には、0 個以上の鍵バージョンがあります。鍵をローテーションすると、新しい鍵バージョンが作成されます。

鍵バージョンを破棄すると、鍵マテリアルが完全に削除されます。鍵バージョンを破棄しても、鍵名や鍵バージョン番号などの他の詳細は削除されません。鍵が破棄された後は、その鍵バージョンで暗号化されたデータを復号することはできません。

鍵の破棄は元に戻せないため、Cloud KMS では鍵のバージョンをすぐに破棄することはできません。代わりに、鍵バージョンの破棄をスケジュールします。鍵バージョンは、構成可能な破棄がスケジュールされた状態のままです。破棄がスケジュールされている間は、鍵バージョンを復元して破棄をキャンセルできます。

デフォルトの破棄の予定期間は 24 時間です。鍵の作成時に、カスタムの鍵の破棄の予定期間を設定できます。組織は、組織のポリシーで [鍵ごとの破棄の最小予定期間] 制約を設定することで、最小の破棄の予定期間を適用できます。

鍵へのアクセスは、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 に移動

  2. 破棄をスケジュールする鍵バージョンの横にあるチェックボックスをオンにします。

  3. ヘッダーの [破棄] をクリックします。

  4. 確認プロンプトで、鍵名を入力して [破棄をスケジュール] をクリックします。

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: キーリングの Cloud KMS のロケーション

すべてのフラグと有効な値については、--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

これらの例では、HTTP クライアントとして curl を使用して 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"

鍵バージョンを破棄できない場合は、破棄する前に鍵バージョンを無効にしなければならない場合があります。破棄する前に、鍵バージョンを無効にしてみてください。

破棄リクエストを送信すると、鍵バージョンの状態は破棄がスケジュール設定されます。キーの後構成された破棄がスケジュール済みの期間が過ぎると、鍵バージョンの状態が破棄されます。これはアクティブ システムから鍵マテリアルの論理的な削除が開始されたことを意味し、鍵のマテリアルをお客様が復元することはできません。鍵マテリアルは、スケジュールされた破棄時刻から最大 45 日間 Google システムに残ることが可能です。

鍵バージョンの破棄がスケジュールされたときにアラートを受け取るには、Cloud KMS での Cloud Monitoring の使用をご覧ください。

破棄された鍵バージョンは、課金対象のリソースではありません。

外部鍵の破棄

Cloud EKM 鍵と外部鍵の関連付けを完全に削除するには、鍵バージョンを破棄します。破棄がスケジュール済みの期間が経過すると、鍵は破棄されます。鍵バージョンが破棄された後は、Cloud EKM 鍵バージョンで暗号化されたデータの暗号化やデータの復号はできなくなります。

Cloud KMS で手動で管理する鍵バージョンを破棄しても、外部鍵マネージャーの鍵は変更されません。最初に、Google Cloud で鍵または鍵バージョンを破棄することをおすすめします。Cloud EKM 鍵バージョンが破棄された後は、外部鍵マネージャーで鍵マテリアルを破棄できます。

Cloud KMS で調整された外部鍵バージョンを破棄すると、まず Google Cloud で鍵バージョンが破棄された後、EKM に破棄リクエストが送信されて外部鍵マテリアルが破棄されます。

鍵バージョンを復元する

鍵バージョンの破棄がスケジュールされている期間中に、復元リクエストを送信することで鍵バージョンを復元できます。

コンソール

  1. Google Cloud コンソールで、[鍵の管理] ページに移動します。

    [鍵管理] ページに移動

  2. 復元にする鍵バージョンの鍵が含まれるキーリング名をクリックします。

  3. 復元する鍵バージョンの鍵をクリックします。

  4. 復元する鍵バージョンの横にあるチェックボックスをオンにします。

  5. ヘッダーの [復元] をクリックします。

  6. 確認プロンプトで [復元] をクリックします。

gcloud

コマンドラインで Cloud KMS を使用するには、まず Google Cloud CLI の最新バージョンをインストールまたはアップグレードします

gcloud kms keys versions restore key-version \
    --key key \
    --keyring key-ring \
    --location location

key-version は、復元する鍵のバージョンに置き換えます。key を鍵の名前に置き換えます。key-ring は、鍵が配置されているキーリングの名前に置き換えます。location をキーリングの Cloud KMS の場所に置き換えます。

すべてのフラグと有効な値については、--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

これらの例では、HTTP クライアントとして curl を使用して API の使用例を示しています。アクセス制御の詳細については、Cloud KMS API へのアクセスをご覧ください。

鍵バージョンを復元するには、CryptoKeyVersions.restore メソッドを呼び出します。

curl "https://cloudkms.googleapis.com/v1/projects/project-id/locations/location-id/keyRings/key-ring-id/cryptoKeys/crypto-key-id/cryptoKeyVersions/version-id:restore" \
    --request "POST" \
    --header "authorization: Bearer token"

復元リクエストが完了すると、鍵バージョンの状態は無効になります。使用する前に、鍵を有効にする必要があります。

必要な IAM 権限

鍵バージョンを破棄するには、呼び出し元に、鍵、キーリング、プロジェクト、フォルダ、または組織に対する cloudkms.cryptoKeyVersions.destroy IAM 権限が必要です。

鍵バージョンを復元するには、呼び出し元に cloudkms.cryptoKeyVersions.restore 権限が必要です。

これらの権限は、Cloud KMS 管理者のロール(roles/cloudkms.admin)に付与されます。

削除のタイムライン

Cloud KMS は、予定された破棄時間から 45 日以内にすべての Google インフラストラクチャから顧客鍵マテリアルの削除を確約します。これには、アクティブ システムとデータセンターのバックアップの両方からのデータの削除が含まれます。その他のお客様のデータには、180 日間の標準 Google Cloud 削除タイムラインが適用されます。