Questa pagina mostra come ruotare automaticamente o manualmente una chiave. Per ulteriori informazioni informazioni sulla rotazione della chiave in generale, consulta Rotazione della chiave.
Ruoli obbligatori
Per ottenere le autorizzazioni di cui hai bisogno per ruotare le chiavi, chiedi all'amministratore di concederti i seguenti ruoli IAM sulla chiave:
-
Amministratore Cloud KMS (
roles/cloudkms.admin
) -
Ricripta i dati:
Autore crittografia/decrittografia CryptoKey Cloud KMS (
roles/cloudkms.cryptoKeyEncrypterDecrypter
)
Per saperne di più sulla concessione dei ruoli, consulta Gestire l'accesso a progetti, cartelle e organizzazioni.
Questi ruoli predefiniti le autorizzazioni necessarie per ruotare le chiavi. Per vedere le autorizzazioni esatte obbligatorie, espandi la sezione Autorizzazioni obbligatorie:
Autorizzazioni obbligatorie
Per ruotare le chiavi sono necessarie le seguenti autorizzazioni:
-
Modifica la versione della chiave principale:
cloudkms.cryptoKeys.update
-
Modificare o disattivare la rotazione automatica:
cloudkms.cryptoKeys.update
-
Crea nuova versione della chiave:
cloudkms.cryptoKeyVersions.create
-
Disabilita le versioni precedenti della chiave:
cloudkms.cryptoKeyVersions.update
-
Ricripta i dati:
-
cloudkms.cryptoKeyVersions.useToDecrypt
-
cloudkms.cryptoKeyVersions.useToEncrypt
-
Potresti anche ottenere queste autorizzazioni con ruoli personalizzati o altri ruoli predefiniti.
Un singolo utente con un ruolo personalizzato contenente tutte queste autorizzazioni può ruotare le chiavi e ricriptare i dati in autonomia. Utenti con il ruolo Amministratore Cloud KMS e il ruolo Autore crittografia/decrittografia CryptoKey Cloud KMS può collaborare per la rotazione e criptare i dati. Segui il principio del privilegio minimo quando assegni i ruoli. Per ulteriori dettagli, vedi Autorizzazioni e ruoli.
Quando ruoti una chiave, i dati criptati con versioni precedenti della chiave automaticamente ricriptata. Per saperne di più, vedi decriptare e ricriptare. La rotazione di una chiave non disattiva o elimina automaticamente le versioni delle chiavi esistenti.
Configurare la rotazione automatica
Per configurare la rotazione automatica durante la creazione di una nuova chiave:
Console
Quando utilizzi la console Google Cloud per creare una chiave, Cloud KMS imposta automaticamente il periodo di rotazione e la data e l'ora della rotazione successiva. Puoi scegliere di utilizzare i valori predefiniti o specificare valori diversi.
Per specificare un periodo di rotazione e un'ora di inizio diversi, al momento della creazione la chiave, ma prima di fare clic il pulsante Crea:
Seleziona un'opzione per Periodo di rotazione della chiave.
In corrispondenza di A partire dal, seleziona la data in cui vuoi che venga registrata la prima la rotazione. Puoi lasciare impostato il valore predefinito A partire da avvia la prima rotazione automatica un periodo di rotazione della chiave da quando per creare la chiave.
gcloud
Per utilizzare Cloud KMS nella riga di comando, devi prima Installa o esegui l'upgrade alla versione più recente di Google Cloud CLI.
gcloud kms keys create KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --purpose "encryption" \ --rotation-period ROTATION_PERIOD \ --next-rotation-time NEXT_ROTATION_TIME
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la posizione Cloud KMS della raccolta di chiavi.ROTATION_PERIOD
: l'intervallo da Ruota la chiave, ad esempio30d
per ruotare la chiave ogni 30 giorni. La rotazione deve essere di almeno 1 giorno e al massimo 100 anni. Per ulteriori informazioni, vedi CryptoKey.rotationPeriod.NEXT_ROTATION_TIME
: il timestamp in cui completare la prima rotazione, ad esempio2023-01-01T01:02:03
. Puoi omettere--next-rotation-time
per pianificare la prima rotazione per una rotazione dall'esecuzione del comando. Per ulteriori informazioni, vediCryptoKey.nextRotationTime
Per informazioni su tutti i flag e i possibili valori, esegui il comando con il flag --help
.
C#
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo C# e installare l'SDK Cloud KMS C#.
Go
Per eseguire questo codice, devi prima configurare un ambiente di sviluppo Go e installa l'SDK Cloud KMS Go.
Java
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo Java e installare l'SDK Java di Cloud KMS.
Node.js
Per eseguire questo codice, devi prima configurare un ambiente di sviluppo Node.js e installare l'SDK Node.js di Cloud KMS.
PHP
Per eseguire questo codice, scopri innanzitutto come utilizzare PHP su Google Cloud e installa l'SDK PHP di Cloud KMS.
Python
Per eseguire questo codice, devi innanzitutto configurare un ambiente di sviluppo Python e installare l'SDK Python Cloud KMS.
Ruby
Per eseguire questo codice, prima configura un ambiente di sviluppo Ruby e installa l'SDK Ruby di Cloud KMS.
API
In questi esempi viene utilizzato curl come client HTTP per dimostrare l'uso dell'API. Per ulteriori informazioni sul controllo dell'accesso, vedi Accesso all'API Cloud KMS.
Per creare una chiave, utilizza
CryptoKey.create
:
curl "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys?crypto_key_id=KEY_NAME" \ --request "POST" \ --header "authorization: Bearer TOKEN" \ --header "content-type: application/json" \ --data '{"purpose": "PURPOSE", "rotationPeriod": "ROTATION_PERIOD", "nextRotationTime": "NEXT_ROTATION_TIME"}'
Sostituisci quanto segue:
PURPOSE
: il valore scopo della chiave.ROTATION_PERIOD
: l'intervallo da Ruota la chiave, ad esempio30d
per ruotare la chiave ogni 30 giorni. La rotazione deve essere di almeno 1 giorno e al massimo 100 anni. Per ulteriori informazioni, vedi CryptoKey.rotationPeriod.NEXT_ROTATION_TIME
: il timestamp in cui completare la prima rotazione, ad esempio2023-01-01T01:02:03
. Per ulteriori informazioni, vediCryptoKey.nextRotationTime
Per configurare la rotazione automatica di una chiave esistente:
Console
Vai alla pagina Gestione delle chiavi nella console Google Cloud.
Fai clic sul nome del mazzo di chiavi contenente la chiave per la quale vuoi aggiungere una pianificazione della rotazione.
Fai clic sulla chiave a cui vuoi aggiungere una pianificazione di rotazione.
Nel titolo, fai clic su Modifica periodo di rotazione.
Nel prompt, scegli nuovi valori per Periodo di rotazione e Inizio on.
Nel prompt, fai clic su Salva.
gcloud
Per utilizzare Cloud KMS sulla riga di comando, esegui l'installazione o l'upgrade alla versione più recente di Google Cloud CLI.
gcloud kms keys update KEY_NAME \ --location LOCATION \ --keyring KEY_RING \ --rotation-period ROTATION_PERIOD \ --next-rotation-time NEXT_ROTATION_TIME
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la posizione Cloud KMS della raccolta di chiavi.ROTATION_PERIOD
: l'intervallo per girare la chiave, ad esempio30d
per ruotarla ogni 30 giorni. La rotazione deve essere di almeno 1 giorno e al massimo 100 anni. Per ulteriori informazioni, vedi CryptoKey.rotationPeriod.NEXT_ROTATION_TIME
: il timestamp in corrispondenza del quale completare la successiva rotazione, ad esempio2023-01-01T01:02:03
. Puoi omettere--next-rotation-time
per pianificare la prossima rotazione per una rotazione dall'esecuzione del comando. Per ulteriori informazioni, vediCryptoKey.nextRotationTime
Per informazioni su tutti i flag e sui possibili valori, esegui il comando con
--help
flag.
C#
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo C# e installare l'SDK Cloud KMS C#.
Go
Per eseguire questo codice, devi prima configurare un ambiente di sviluppo Go e installa l'SDK Cloud KMS Go.
Java
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo Java e installare l'SDK Java di Cloud KMS.
Node.js
Per eseguire questo codice, devi innanzitutto configurare un ambiente di sviluppo Node.js e installare l'SDK Node.js di Cloud KMS.
PHP
Per eseguire questo codice, scopri innanzitutto come utilizzare PHP su Google Cloud e installa l'SDK PHP di Cloud KMS.
Python
Per eseguire questo codice, configura prima un ambiente di sviluppo Python e installare l'SDK per Python di Cloud KMS.
Ruby
Per eseguire questo codice, prima configura un ambiente di sviluppo Ruby e installa l'SDK Ruby di Cloud KMS.
API
In questi esempi viene utilizzato curl come client HTTP per dimostrare l'uso dell'API. Per ulteriori informazioni sul controllo dell'accesso, vedi Accesso all'API Cloud KMS.
Per aggiornare una chiave, utilizza
CryptoKey.patch
:
curl "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME?updateMask=rotationPeriod,nextRotationTime" \ --request "PATCH" \ --header "authorization: Bearer TOKEN" \ --header "content-type: application/json" \ --data '{"rotationPeriod": "ROTATION_PERIOD", "nextRotationTime": "NEXT_ROTATION_TIME"}'
Sostituisci quanto segue:
ROTATION_PERIOD
: l'intervallo da Ruota la chiave, ad esempio30d
per ruotare la chiave ogni 30 giorni. La rotazione deve essere di almeno 1 giorno e al massimo 100 anni. Per ulteriori informazioni, vedi CryptoKey.rotationPeriod.NEXT_ROTATION_TIME
: il timestamp in corrispondenza del quale completare la successiva rotazione, ad esempio2023-01-01T01:02:03
. Per ulteriori informazioni, vediCryptoKey.nextRotationTime
Ruotare manualmente una chiave
Innanzitutto, crea una nuova versione della chiave:
Console
Vai alla pagina Gestione delle chiavi nella console Google Cloud.
Fai clic sul nome del keyring che contiene la chiave per la quale per creare una nuova versione della chiave.
Fai clic sulla chiave per la quale vuoi creare una nuova versione.
Nell'intestazione, fai clic su Ruota.
Nel messaggio, fai clic su Ruota per confermare.
gcloud
Per utilizzare Cloud KMS nella riga di comando, devi prima Installa o esegui l'upgrade alla versione più recente di Google Cloud CLI.
gcloud kms keys versions create \ --key KEY_NAME \ --keyring KEY_RING \ --location LOCATION
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.
Le versioni della chiave sono numerate in sequenza.
Per informazioni su tutti i flag e sui possibili valori, esegui il comando con
--help
flag.
C#
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo C# e installare l'SDK Cloud KMS C#.
Go
Per eseguire questo codice, devi prima configurare un ambiente di sviluppo Go e installa l'SDK Cloud KMS Go.
Java
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo Java e installare l'SDK Java di Cloud KMS.
Node.js
Per eseguire questo codice, devi innanzitutto configurare un ambiente di sviluppo Node.js e installare l'SDK Node.js di Cloud KMS.
PHP
Per eseguire questo codice, devi innanzitutto scoprire come utilizzare PHP su Google Cloud e installare l'SDK PHP Cloud KMS.
Python
Per eseguire questo codice, configura prima un ambiente di sviluppo Python e installare l'SDK per Python di Cloud KMS.
Ruby
Per eseguire questo codice, prima configura un ambiente di sviluppo Ruby e installa l'SDK Ruby di Cloud KMS.
API
In questi esempi viene utilizzato curl come client HTTP per dimostrare l'uso dell'API. Per ulteriori informazioni sul controllo dell'accesso, vedi Accesso all'API Cloud KMS.
Per ruotare manualmente una chiave, devi prima creare una nuova versione della chiave chiamando il metodo CryptoKeyVersions.create .
curl "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions" \ --request "POST" \ --header "authorization: Bearer TOKEN"
Questo comando crea una nuova versione della chiave, ma non la imposta come versione primaria.
Per impostare la nuova versione della chiave come primaria, consulta la sezione Impostazione di una versione esistente come o la versione della chiave primaria.
Se necessario, cripta nuovamente i dati criptati utilizzando la versione precedente della chiave.
Imposta una versione esistente come versione della chiave primaria
Per impostare una versione della chiave diversa come versione primaria di una chiave, aggiorna la chiave con le informazioni sulla nuova versione primaria. È necessario abilitare una versione della chiave prima di poterla configurare come versione principale.
Console
Vai alla pagina Gestione delle chiavi nella console Google Cloud.
Fai clic sul nome del keyring contenente la chiave la cui versione primaria che vuoi aggiornare.
Fai clic sulla chiave di cui vuoi aggiornare la versione primaria.
Nella riga corrispondente alla versione della chiave che vuoi impostare come primaria, fai clic su Mostra altro
.Fai clic su Imposta versione principale nel menu.
Nel messaggio di conferma, fai clic su Imposta come principale.
gcloud
Per utilizzare Cloud KMS nella riga di comando, devi prima Installa o esegui l'upgrade alla versione più recente di Google Cloud CLI.
gcloud kms keys update KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --primary-version KEY_VERSION
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.- KEY_VERSION: il numero di versione della nuova versione della chiave primaria.
Per informazioni su tutti i flag e sui possibili valori, esegui il comando con
--help
flag.
C#
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo C# e installare l'SDK Cloud KMS C#.
Go
Per eseguire questo codice, devi prima configurare un ambiente di sviluppo Go e installa l'SDK Cloud KMS Go.
Java
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo Java e installare l'SDK Java di Cloud KMS.
Node.js
Per eseguire questo codice, devi prima configurare un ambiente di sviluppo Node.js e installare l'SDK Node.js di Cloud KMS.
PHP
Per eseguire questo codice, scopri innanzitutto come utilizzare PHP su Google Cloud e installa l'SDK PHP di Cloud KMS.
Ruby
Per eseguire questo codice, devi innanzitutto configurare un ambiente di sviluppo Ruby e installare l'SDK Ruby Cloud KMS.
Python
Per eseguire questo codice, configura prima un ambiente di sviluppo Python e installare l'SDK per Python di Cloud KMS.
API
In questi esempi viene utilizzato curl come client HTTP per dimostrare l'uso dell'API. Per ulteriori informazioni sul controllo dell'accesso, vedi Accesso all'API Cloud KMS.
Modifica la versione della chiave primaria chiamando il metodo CryptoKey.updatePrimaryVersion .
curl "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME:updatePrimaryVersion" \ --request "POST" \ --header "authorization: Bearer TOKEN" \ --header "content-type: application/json" \ --data '{"cryptoKeyVersionId": "KEY_VERSION"}'
Sostituisci quanto segue:
PROJECT_ID
: l'ID del progetto che contiene il keyring.LOCATION
: la località Cloud KMS del keyring.KEY_RING
: il nome del keyring che contiene la chiave.KEY_NAME
: il nome della chiave.- KEY_VERSION: il numero di versione della nuova versione della chiave primaria.
Quando modifichi la versione della chiave primaria, la modifica in genere diventa coerente entro 1 minuto. Tuttavia, la propagazione di questa modifica può richiedere fino a tre ore casi eccezionali. Durante questo periodo, potrebbe essere utilizzata la versione principale precedente crittografare i dati. Per ulteriori informazioni, vedi Coerenza delle risorse di Cloud KMS.
Disattiva la rotazione automatica
Per disattivare la rotazione automatica di una chiave, cancella la pianificazione della rotazione della chiave:
Console
Vai alla pagina Gestione delle chiavi nella console Google Cloud.
Fai clic sul nome del keyring che contiene la chiave per la quale vuoi rimuovi la pianificazione della rotazione.
Fai clic sulla chiave da cui vuoi rimuovere la pianificazione della rotazione.
Nell'intestazione, fai clic su Modifica periodo di rotazione.
Quando richiesto, fai clic sul campo Periodo di rotazione e seleziona Mai (rotazione manuale).
Al prompt, fai clic su Salva.
gcloud
Per utilizzare Cloud KMS sulla riga di comando, esegui l'installazione o l'upgrade alla versione più recente di Google Cloud CLI.
gcloud kms keys update KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --remove-rotation-schedule
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la posizione Cloud KMS della raccolta di chiavi.
Per informazioni su tutti i flag e sui possibili valori, esegui il comando con
--help
flag.
C#
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo C# e installare l'SDK Cloud KMS C#.
Go
Per eseguire questo codice, devi innanzitutto configurare un ambiente di sviluppo Go e installare l'SDK Go Cloud KMS.
Java
Per eseguire questo codice, per prima cosa configura un ambiente di sviluppo Java e installare l'SDK Java di Cloud KMS.
Node.js
Per eseguire questo codice, devi prima configurare un ambiente di sviluppo Node.js e installare l'SDK Node.js di Cloud KMS.
PHP
Per eseguire questo codice, scopri innanzitutto come utilizzare PHP su Google Cloud e installa l'SDK PHP di Cloud KMS.
Ruby
Per eseguire questo codice, devi innanzitutto configurare un ambiente di sviluppo Ruby e installare l'SDK Ruby Cloud KMS.
Python
Per eseguire questo codice, configura prima un ambiente di sviluppo Python e installare l'SDK per Python di Cloud KMS.
API
In questi esempi viene utilizzato curl come client HTTP per dimostrare l'uso dell'API. Per ulteriori informazioni sul controllo dell'accesso, vedi Accesso all'API Cloud KMS.
Per aggiornare una chiave, utilizza
CryptoKey.patch
:
curl "https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME?updateMask=rotationPeriod,nextRotationTime" \ --request "PATCH" \ --header "authorization: Bearer TOKEN" \ --header "content-type: application/json" \ --data '{"rotationPeriod": null, "nextRotationTime": null}'
Per ulteriori dettagli su rotationPeriod
e nextRotationTime
, vedi
keyRings.cryptoKeys
Ruotare una chiave esterna
Ruota una chiave esterna coordinata
Puoi configurare la rotazione automatica per funzioni simmetriche coordinate chiavi esterne. Puoi anche creare manualmente una nuova versione della chiave per le chiavi simmetriche chiavi esterne coordinate asimmetriche.
La rotazione o la creazione di una nuova versione della chiave fa sì che tutti i dati di nuova creazione protetti con quella chiave vengano criptati con la nuova versione. Dati protetti con se una versione precedente della chiave non viene ricriptata. Di conseguenza, la chiave esterna gestore deve continuare a creare il materiale della chiave della versione precedente della chiave possono essere utilizzate.
Per creare una nuova versione della chiave per una chiave esterna coordinata, completa i seguenti passaggi:
Console
Nella console Google Cloud, vai alla Gestione delle chiavi.
Seleziona il portachiavi e poi la chiave.
Fai clic su Crea versione. Un messaggio indica che la nuova versione della chiave verrà generato sia in Cloud KMS sia nell'EKM. Se vedi un Key path (Percorso chiave) o Key URI (URI chiave), la chiave selezionata non è coordinata chiave esterna.
Per confermare che vuoi creare una nuova versione della chiave, fai clic su Crea dell'audiodescrizione.
La nuova versione della chiave viene visualizzata nello stato Generare in attesa. Per simmetri le versioni delle chiavi create manualmente non vengono impostate automaticamente come e la versione della chiave primaria. Puoi impostare la nuova versione della chiave come principale.
Interfaccia a riga di comando gcloud
Per creare una nuova versione della chiave simmetrica e impostarla come versione della chiave primaria,
usa il comando kms keys versions create
con il flag --primary
:
gcloud kms keys versions create \ --key KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --primary
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.
Per creare una nuova versione della chiave asimmetrica o creare una nuova chiave simmetrica
diversa da quella della chiave primaria, usa il comando kms keys versions
create
:
gcloud kms keys versions create \ --key KEY_NAME \ --keyring KEY_RING \ --location LOCATION
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.
Ruota un Cloud EKM gestito manualmente tramite chiave VPC
Innanzitutto, ruota il materiale della chiave esterna nel gestore di chiavi esterno. Se questo genera un nuovo percorso della chiave, devi eseguire la rotazione o creare un nuovo Cloud EKM con il nuovo percorso della chiave. Per le chiavi di crittografia simmetriche, rotate la chiave Cloud EKM e specifica il nuovo percorso della chiave dalla chiave esterna responsabile. Per le chiavi asimmetriche, crea una nuova versione della chiave e specifica la nuova chiave del tuo percorso di apprendimento.
La rotazione o la creazione di una nuova versione della chiave fa sì che tutti i nuovi dati creati siano protetti a quella chiave per la crittografia con la nuova versione della chiave. Dati protetti con se una versione precedente della chiave non viene ricriptata. Di conseguenza, il gestore di chiavi esterno deve continuare a rendere disponibile per l'utilizzo il materiale della chiave della versione precedente della chiave.
Se il materiale della chiave nel sistema esterno di gestione delle chiavi del partner non cambia, ma la chiave modifiche al percorso, puoi aggiornare il campo senza ruotare la chiave.
Console
Nella console Google Cloud, vai alla Gestione delle chiavi.
Seleziona il keyring e poi la chiave.
Fai clic su Ruota la chiave.
In Percorso chiave, inserisci il percorso della chiave per la nuova versione.
Fai clic su Ruota la chiave per confermare.
gcloud
Per utilizzare Cloud KMS nella riga di comando, devi prima Installa o esegui l'upgrade alla versione più recente di Google Cloud CLI.
Per creare una nuova versione della chiave simmetrica e impostarla come versione della chiave principale,
utilizza il comando kms keys versions create
con il flag --primary
:
gcloud kms keys versions create \ --key KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --ekm-connection-key-path EXTERNAL_KEY_PATH \ --primary
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.EXTERNAL_KEY_PATH
: il percorso della nuova versione della chiave esterna.
Per creare una nuova versione della chiave asimmetrica o creare una nuova chiave simmetrica
diversa da quella della chiave primaria, usa il comando kms keys versions
create
:
gcloud kms keys versions create \ --key KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --ekm-connection-key-path EXTERNAL_KEY_PATH
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.EXTERNAL_KEY_PATH
: il percorso del nuovo server esterno e la versione della chiave.
Per informazioni su tutti i flag e sui possibili valori, esegui il comando con
--help
flag.
Dopo aver creato la versione della chiave, puoi utilizzarla come faresti e utilizzare qualsiasi altra versione della chiave Cloud KMS.
Ruotare un Cloud EKM gestito manualmente tramite chiave internet
Innanzitutto, ruota il materiale della chiave esterna nel gestore di chiavi esterno. Se questo restituisce un nuovo URI, devi eseguire la rotazione o creare una nuova chiave Cloud EKM con il nuovo URI. Per le chiavi di crittografia simmetrica, ruota la chiave Cloud EKM e specifica il nuovo URI chiave dal gestore di chiavi esterno. Per le chiavi asimmetriche, crea una nuova versione della chiave e specifica la nuova chiave URI.
La rotazione o la creazione di una nuova versione della chiave fa sì che tutti i nuovi dati creati siano protetti a quella chiave per la crittografia con la nuova versione della chiave. Dati protetti con se una versione precedente della chiave non viene ricriptata. Di conseguenza, la chiave esterna gestore deve continuare a creare il materiale della chiave della versione precedente della chiave possono essere utilizzate.
Se il materiale della chiave nel sistema esterno di gestione delle chiavi del partner non cambia, ma l'URI modifiche, puoi aggiornare il codice esterno della chiave URI senza ruotare la chiave.
Console
Nella console Google Cloud, vai alla Gestione delle chiavi.
Seleziona il keyring e poi la chiave.
Seleziona Ruota chiave per le chiavi simmetriche o Crea versione per e asimmetriche.
Inserisci il nuovo URI della chiave, quindi seleziona Ruota chiave per le chiavi simmetriche o Crea versione per le chiavi asimmetriche.
La nuova versione della chiave diventa la versione primaria.
Interfaccia a riga di comando gcloud
Per creare una nuova versione della chiave simmetrica e impostarla come versione della chiave primaria,
usa il comando kms keys versions create
con il flag --primary
:
gcloud kms keys versions create \ --key KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --external-key-uri EXTERNAL_KEY_URI \ --primary
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.EXTERNAL_KEY_URI
: l'URI della chiave del nuovo server esterno e la versione della chiave.
Per creare una nuova versione della chiave asimmetrica o creare una nuova chiave simmetrica
diversa da quella della chiave primaria, usa il comando kms keys versions
create
:
gcloud kms keys versions create \ --key KEY_NAME \ --keyring KEY_RING \ --location LOCATION \ --external-key-uri EXTERNAL_KEY_URI
Sostituisci quanto segue:
KEY_NAME
: il nome della chiave.KEY_RING
: il nome del keyring che contiene la chiave.LOCATION
: la località Cloud KMS del keyring.EXTERNAL_KEY_URI
: l'URI della chiave del nuovo server esterno e la versione della chiave.