Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Der AO führt Verschlüsselungs- und Entschlüsselungsvorgänge über die Air-Gap-CLI von Google Distributed Cloud (GDC) für den KMS über einen gRPC-Client aus.
Hinweise
Bevor Sie kryptografische Vorgänge ausführen, laden Sie die gcloud CLI herunter, installieren und konfigurieren Sie sie, um auf den Management API-Server zuzugreifen. Folgen Sie dazu der Übersicht über die gcloud CLI.
Bitten Sie Ihren IAM-Administrator der Organisation, Ihnen die Rolle „KMS-Entwickler“ (kms-developer) zuzuweisen, um die Berechtigungen zu erhalten, die Sie für kryptografische Vorgänge benötigen.
Daten verschlüsseln
Verwenden Sie den Befehl gdcloud kms keys encrypt, um Daten zu verschlüsseln. Mit diesem Befehl wird eine angegebene Klartextdatei mit dem Schlüssel AEAD verschlüsselt und in eine benannte Chiffretextdatei geschrieben.
Um Daten zu verschlüsseln, übergeben Sie den Schlüsselnamen und Folgendes:
NAMESPACE: der Projekt-Namespace, z. B. kms-test1.
KEY_NAME: der Name des Schlüssels, mit dem der Klartext verschlüsselt wird, z. B. key-1.
PLAINTEXT_PATH: Der Pfad zur Datei, die den zu verschlüsselnden Klartext enthält.
ADDITIONAL_AUTHENTICATED_DATA_FILE: Eine optionale Datei, die zusätzliche authentifizierte Daten (AAD) enthält. AAD werden für Integritätsprüfungen verwendet und schützen Ihre Daten vor einer Confused Deputy Attack. AAD und Klartext haben jeweils eine Größenbeschränkung von 64 KB.
CIPHERTEXT_PATH: Der Pfad zur Datei, die den verschlüsselten Klartext enthält.
Nachdem Sie den Befehl ausgeführt haben, wird eine Datei angezeigt, die Sie im Flag --ciphertext-file angegeben haben und die den verschlüsselten Inhalt der Klartextdatei enthält.
Daten entschlüsseln
Verwenden Sie den Befehl gdcloud kms keys decrypt, um Daten zu entschlüsseln. Mit diesem Befehl wird eine bestimmte Geheimtextdatei mit dem Schlüssel AEAD entschlüsselt und in eine benannte Klartextdatei geschrieben.
Um Geheimtext zu entschlüsseln, übergeben Sie den Schlüsselnamen und Folgendes:
KEY_NAME: der Name des Schlüssels, mit dem der Klartext verschlüsselt wird.
CIPHERTEXT_PATH: Der Pfad der Datei, die Sie entschlüsseln möchten.
ADDITIONAL_AUTHENTICATED_DATA_FILE: Eine optionale Datei, die zusätzliche authentifizierte Daten (AAD) enthält. AAD werden für Integritätsprüfungen verwendet und schützen Ihre Daten vor einer Confused Deputy Attack. AAD und Klartext haben jeweils eine Größenbeschränkung von 64 KB.
PLAINTEXT_PATH: Der Pfad zur Datei, die den entschlüsselten Klartext enthält.
Nachdem Sie den Befehl ausgeführt haben, wird eine Datei angezeigt, die Sie im Flag --plaintext-file angegeben haben und die die entschlüsselten Daten enthält.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThe AO (air-gapped operations) utilizes the Google Distributed Cloud (GDC) air-gapped CLI and a gRPC client to perform encryption and decryption operations via the KMS.\u003c/p\u003e\n"],["\u003cp\u003eBefore starting cryptographic operations, users must download, install, and configure the \u003ccode\u003egdcloud\u003c/code\u003e CLI to access the Management API server as detailed in the \u003ccode\u003egdcloud\u003c/code\u003e CLI overview.\u003c/p\u003e\n"],["\u003cp\u003eEncrypting data requires the \u003ccode\u003egdcloud kms keys encrypt\u003c/code\u003e command, where you must specify the key name, plaintext file path, an optional additional authenticated data file path, and a ciphertext file path.\u003c/p\u003e\n"],["\u003cp\u003eDecrypting data requires the \u003ccode\u003egdcloud kms keys decrypt\u003c/code\u003e command, specifying the key name, ciphertext file path, and the path for the decrypted plaintext file, in addition to the optional additional authenticated data file path.\u003c/p\u003e\n"],["\u003cp\u003eTo complete cryptographic operations, users must be granted the KMS Developer (\u003ccode\u003ekms-developer\u003c/code\u003e) role by their Organization IAM Admin.\u003c/p\u003e\n"]]],[],null,["# Encrypt and decrypt data\n\nThe AO performs encrypt and decrypt operations through the\nGoogle Distributed Cloud (GDC) air-gapped CLI to the KMS through a gRPC client.\n\nBefore you begin\n----------------\n\nBefore performing crypto operations, download, install, and configure the\ngdcloud CLI to access the Management API server. To do this, follow the\n[gdcloud CLI overview](/distributed-cloud/hosted/docs/latest/gdch/resources/gdcloud-overview).\n\nTo get the permissions you need to perform cryptographic operations, ask\nyour Organization IAM Admin to grant you the KMS Developer (`kms-developer`)\nrole.\n\nEncrypt data\n------------\n\nTo encrypt data, use the `gdcloud kms keys encrypt` command. This command encrypts a\ngiven plaintext file using the `AEAD` key, and writes it to a named ciphertext\nfile.\n\n- To encrypt data, pass in the key name and the following:\n\n gdcloud kms keys encrypt namespaces/\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e/aeadKeys/\u003cvar translate=\"no\"\u003eKEY_NAME\u003c/var\u003e \\\n --plaintext-file=\u003cvar translate=\"no\"\u003ePLAINTEXT_PATH\u003c/var\u003e \\\n --additional-authenticated-data-file=\u003cvar translate=\"no\"\u003eADDITIONAL_AUTHENTICATED_DATA_FILE\u003c/var\u003e \\\n --ciphertext-file=\u003cvar translate=\"no\"\u003eCIPHERTEXT_PATH\u003c/var\u003e\n\n Replace the following variables:\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace---for example: `kms-test1`.\n - \u003cvar translate=\"no\"\u003eKEY_NAME\u003c/var\u003e: the name of the key used to encrypt the plaintext---for example: `key-1`.\n - \u003cvar translate=\"no\"\u003ePLAINTEXT_PATH\u003c/var\u003e: the path to the file that contains the plaintext to encrypt.\n - \u003cvar translate=\"no\"\u003eADDITIONAL_AUTHENTICATED_DATA_FILE\u003c/var\u003e: an optional file that contains additional authenticated data (AAD). AAD is used for integrity checks and protects your data from a confused deputy attack. AAD and the plaintext each have a size limit of 64KB.\n - \u003cvar translate=\"no\"\u003eCIPHERTEXT_PATH\u003c/var\u003e: the path to the file that contains the encrypted plaintext.\n\n After running the command, you see a file you specified in the\n `--ciphertext-file` flag that contains the encrypted contents of the plaintext\n file.\n\nDecrypt data\n------------\n\nTo decrypt data, use the `gdcloud kms keys decrypt` command. This command decrypts a\ngiven ciphertext file using the `AEAD` key, and writes it to a named plaintext\nfile.\n\n- To decrypt ciphertext, pass in the key name and the following:\n\n gdcloud kms keys decrypt namespaces/\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e/aeadKeys/\u003cvar translate=\"no\"\u003eKEY_NAME\u003c/var\u003e \\\n --ciphertext-file=\u003cvar translate=\"no\"\u003eCIPHERTEXT_PATH\u003c/var\u003e \\\n --additional-authenticated-data-file=\u003cvar translate=\"no\"\u003eADDITIONAL_AUTHENTICATED_DATA_FILE\u003c/var\u003e \\\n --plaintext-file=\u003cvar translate=\"no\"\u003ePLAINTEXT_PATH\u003c/var\u003e\n\n Replace the following variables:\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n - \u003cvar translate=\"no\"\u003eKEY_NAME\u003c/var\u003e: the name of the key used to encrypt the plaintext.\n - \u003cvar translate=\"no\"\u003eCIPHERTEXT_PATH\u003c/var\u003e: the path of the file you want to decrypt.\n - \u003cvar translate=\"no\"\u003eADDITIONAL_AUTHENTICATED_DATA_FILE\u003c/var\u003e: an optional file that contains additional authenticated data (AAD). AAD is used for integrity checks and protects your data from a confused deputy attack. AAD and the plaintext each have a size limit of 64KB. **Note**: You must use the same AAD you passed during the encrypt operation for the decrypt operation.\n - \u003cvar translate=\"no\"\u003ePLAINTEXT_PATH\u003c/var\u003e: the path to the file that contains the decrypted plaintext.\n\n After running the command, you see a file you specified in the\n `--plaintext-file` flag that contains the decrypted data."]]