Cloud HSM

במסמך הזה מפורטת סקירה כללית על Cloud HSM ומוסבר איך ליצור מפתחות הצפנה שמוגנים על ידי HSM ב-Cloud Key Management Service ולהשתמש בהם.

מה זה Cloud HSM?

‫Cloud HSM הוא שירות של מודול אבטחה לחומרה (HSM) שמארח מפתחות הצפנה ומבצע פעולות קריפטוגרפיות באשכול של מודולים של HSM עם אישור FIPS 140-2 ברמה 3. ‫Google מנהלת את אשכול ה-HSM בשבילכם, כך שלא צריך לדאוג לגבי אשכולות, שינוי גודל או תיקון. מכיוון ש-Cloud HSM משתמש ב-Cloud KMS כממשק קצה שלו, אתם יכולים ליהנות מכל היתרונות והתכונות ש-Cloud KMS מספק.

יצירת אוסף מפתחות

כשיוצרים מפתח, מוסיפים אותו לאוסף מפתחות במיקום Google Cloud מסוים. אתם יכולים ליצור מחזיק מפתחות חדש או להשתמש במחזיק מפתחות קיים. בנושא הזה, נסביר איך ליצור אוסף מפתחות חדש ולהוסיף לו מפתח חדש.

יוצרים אוסף מפתחות ב Google Cloud מיקום שתומך ב-Cloud HSM.

המסוף

  1. נכנסים לדף Key Management במסוף Google Cloud .

    כניסה אל Key Management

  2. לוחצים על Create key ring (יצירת מחזיק מפתחות).

  3. בשדה Key ring name, מזינים שם לאוסף המפתחות.

  4. בקטע מיקום מחזיק המפתחות, בוחרים מיקום כמו "us-east1".

  5. לוחצים על יצירה.

gcloud

  1. במסוף Google Cloud , מפעילים את Cloud Shell.

    הפעלת Cloud Shell

  2. בסביבה שלכם, מריצים את הפקודה gcloud kms keyrings create:

    gcloud kms keyrings create KEY_RING \
        --location LOCATION
    

    מחליפים את מה שכתוב בשדות הבאים:

    • KEY_RING: השם של אוסף המפתחות שמכיל את המפתח.
    • LOCATION: המיקום ב-Cloud KMS שבו נמצא אוסף המפתחות.

    כדי לקבל מידע על כל הדגלים והערכים האפשריים, מריצים את הפקודה עם הדגל --help.

C#

כדי להריץ את הקוד הזה, קודם צריך להגדיר סביבת פיתוח בשפת C# ‎ ולהתקין את ה-SDK של Cloud KMS C# ‎.


using Google.Api.Gax.ResourceNames;
using Google.Cloud.Kms.V1;

public class CreateKeyRingSample
{
    public KeyRing CreateKeyRing(
      string projectId = "my-project", string locationId = "us-east1",
      string id = "my-key-ring")
    {
        // Create the client.
        KeyManagementServiceClient client = KeyManagementServiceClient.Create();

        // Build the parent location name.
        LocationName locationName = new LocationName(projectId, locationId);

        // Build the key ring.
        KeyRing keyRing = new KeyRing { };

        // Call the API.
        KeyRing result = client.CreateKeyRing(locationName, id, keyRing);

        // 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"
)

// createKeyRing creates a new ring to store keys on KMS.
func createKeyRing(w io.Writer, parent, id string) error {
	// parent := "projects/PROJECT_ID/locations/global"
	// id := "my-key-ring"

	// 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.CreateKeyRingRequest{
		Parent:    parent,
		KeyRingId: id,
	}

	// Call the API.
	result,