Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Panduan ini menunjukkan cara membuat dan memperbarui set kunci untuk Media CDN.
Sebelum memulai
EdgeCacheKeyset yang Anda konfigurasi untuk memverifikasi token permintaan bertanda tangan
harus menyertakan kunci yang benar untuk algoritma tanda tangan yang Anda pilih.
Tabel berikut menjelaskan setiap algoritma tanda tangan dan kunci yang diperlukan.
Algoritme tanda tangan
Kunci yang diperlukan dalam keyset
Ed25519
Kunci publik
HMAC-SHA1
Kunci bersama validasi
HMAC-SHA256
Kunci bersama validasi
Minimal, Anda harus memiliki kunci publik atau kunci bersama validasi. Anda
dapat memiliki hingga tiga kunci publik dan tiga kunci bersama validasi, dengan
total enam kunci per set kunci. Untuk mengetahui informasi tentang cara membuat HMAC saat menggunakan
autentikasi token ganda,
lihat Membuat token.
Membuat keyset
Untuk membuat set kunci baru, lakukan hal berikut:
Untuk Name, masukkan nama set kunci yang unik—misalnya,
prod-vod-keyset.
Opsional: Untuk Deskripsi, masukkan deskripsi untuk set kunci Anda.
Opsional: Klik Tambahkan label dan masukkan satu atau beberapa pasangan nilai kunci untuk set kunci Anda.
Tentukan setidaknya satu kunci publik atau satu kunci validasi.
Untuk menentukan kunci publik, klik Tambahkan kunci publik, lalu lakukan langkah-langkah berikut:
Untuk ID, masukkan ID alfanumerik.
Pilih Masukkan nilai dan tentukan nilai
kunci publik Ed25519 Anda yang berenkode base64. Atau, pilih
Gunakan kunci yang dikelola Google untuk autentikasi token ganda.
Untuk menentukan kunci bersama validasi, klik Tambahkan kunci bersama validasi, lalu lakukan tindakan berikut:
Untuk Secret, pilih secret dari daftar, masukkan secret secara manual dengan menentukan ID resource-nya, atau
buat secret baru, lalu pilih secret tersebut.
Untuk Versi secret, pilih versi secret dari
daftar atau
buat versi secret baru, lalu pilih versi tersebut.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],null,["# Create and update keysets\n\nThis guide shows how to create and update keysets for Media CDN.\n\nBefore you begin\n----------------\n\nThe `EdgeCacheKeyset` that you configure for verifying signed request tokens\nmust include the correct keys for the signature algorithm that you choose.\n\nThe following table describes each of the signature algorithms and their\nrequired keys.\n\nAt a minimum, you must have either a public key or a validation shared key. You\ncan have up to three public keys and three validation shared keys, for a\ntotal of six keys per keyset. For information on generating HMACs when using\n[dual-token authentication](/media-cdn/docs/use-dual-token-authentication),\nsee [Generate tokens](/media-cdn/docs/generate-tokens).\n\nCreate a keyset\n---------------\n\nTo create a new keyset, do the following: \n\n### Console\n\n1. In the Google Cloud console, go to the **Media CDN** page.\n\n [Go to Media CDN](https://console.cloud.google.com/net-services/media-cdn)\n2. Click the **Keysets** tab.\n3. Click add**Create keyset**.\n4. For **Name** , enter a unique keyset name---for example, `prod-vod-keyset`.\n5. Optional: For **Description**, enter a description for your keyset.\n6. Optional: Click **Add label** and enter one or more key-value pairs for your keyset.\n7. Specify at least one public key or one validation key. To specify a public key, click **Add public key** and then do the following:\n\n 1. For **ID**, enter an alphanumeric ID.\n 2. Select **Enter the value** and specify the base64-encoded value of your Ed25519 public key. Alternatively, select **Use Google-managed key for dual-token authentication**.\n8. To specify a validation shared key, click **Add validation\n shared key** , and then do the following:\n 1. For **Secret** , select a secret from the list, enter a secret manually by specifying its resource ID, or [create a new secret](/secret-manager/docs/create-secret-quickstart#create_a_secret_and_access_a_secret_version) and then select it.\n 2. For **Secret version** , select a secret version from the list or [create a new secret version](/secret-manager/docs/add-secret-version#add-secret-version) and then select it.\n9. Click **Create keyset**.\n\n### gcloud\n\nUse the [`gcloud edge-cache keysets create` command](/sdk/gcloud/reference/edge-cache/keysets/create). \n\n```\ngcloud edge-cache keysets create SHORT_KEYSET_NAME \\\n --public-key='id=SSL_PUBLIC_KEY_NAME,value=SSL_PUBLIC_KEY_VALUE'\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eSHORT_KEYSET_NAME\u003c/var\u003e: a unique name for the keyset---for example, `prod-vod-keyset`\n- \u003cvar translate=\"no\"\u003eSSL_PUBLIC_KEY_NAME\u003c/var\u003e: the name of your SSL public key\n- \u003cvar translate=\"no\"\u003eSSL_PUBLIC_KEY_VALUE\u003c/var\u003e: the value of your SSL public key\n\nReview the keys associated with a keyset. Use the\n[`gcloud edge-cache keysets describe` command](/sdk/gcloud/reference/edge-cache/keysets/describe). \n\n```\ngcloud edge-cache keysets describe prod-vod-keyset\n```\n\nThe output is similar to the following: \n\n```\nname: prod-vod-keyset\ndescription: \"Keyset for prod.example.com\"\npublicKeys:\n - id: \"key-20200918\"\n value: \"DThVLjhAKm3VYOvLBAwFZ5XbjVyF98Ias8NZU0WEM9w\"\n - id: \"key-20200808\"\n value: \"Lw7LDSaDUrbDdqpPA6JEmMF5BA5GPtd7sAjvsnh7uDA=\"\n```\n\n### Terraform\n\n resource \"google_network_services_edge_cache_keyset\" \"default\" {\n name = \"prod-vod-keyset\"\n description = \"Keyset for prod.example.com\"\n public_key {\n id = \"key-20200918\"\n value = \"FHsTyFHNmvNpw4o7-rp-M1yqMyBF8vXSBRkZtkQ0RKY\" # Update Ed25519 public key\n }\n public_key {\n id = \"key-20200808\"\n value = \"Lw7LDSaDUrbDdqpPA6JEmMF5BA5GPtd7sAjvsnh7uDA=\" # Update Ed25519 public key\n }\n }\n\nModify a keyset\n---------------\n\nTo modify a keyset, do the following: \n\n### Console\n\n1. In the Google Cloud console, go to the **Media CDN** page.\n\n [Go to Media CDN](https://console.cloud.google.com/net-services/media-cdn)\n2. Click the **Keysets** tab.\n3. Click the keyset name.\n4. To switch to the edit mode, click the **Edit** button.\n5. Make the changes that you need, and then click **Update keyset**.\n\n### gcloud\n\nUse the [`gcloud edge-cache keysets update` command](/sdk/gcloud/reference/edge-cache/keysets/update): \n\n```\ngcloud edge-cache keysets update KEYSET_NAME\n```"]]