Download and install the Google Cloud SDK
Follow the instructions at this URL to download, install, and configure the Google Cloud SDK: https://cloud.google.com/sdk/docs/installVerify Google JWKS reachability
From the CryptoHub network, verify reachability from your network to Google’s JWKS endpoint:200 OK.
Encrypt a test file
Before proceeding, ensure the Google Cloud user that is calling the encrypt and decrypt methods has the
cloudkms.cryptoKeyVersions.useToEncrypt and cloudkms.cryptoKeyVersions.useToDecrypt`` permissions on the key being used.To permit a user to encrypt or decrypt, add the user to the roles/cloudkms.cryptoKeyEncrypter and roles/cloudkms.cryptoKeyDecrypter IAM roles, or the roles/cloudkms.cryptoKeyEncrypterDecrypter IAM role for that key. For more information, seePermissions and Roles.- Replace [key] with the name of the key to use for encryption.
- Replace [key-ring] with the name of the key ring where the key is located.
- Replace **[location]**with the Cloud KMS location for the key ring.
- Replace [file-with-data-to-encrypt] and [file-to-store-encrypted-data] with the local file paths for reading the plaintext data and saving the encrypted output.
If the command is successful, it returns no output.
Decrypt the encrypted file
Run the following gcloud kms command to decrypt the file you encrypted in the previous step, using the externally managed key:- Replace** [key]** with the name of the key to use for decryption.
- Replace [key-ring] with the name of the key ring where the key is located.
- Replace [location] with the Cloud KMS location for the key ring.
- Replace [encrypted-file] and [path-to-store-decrypted-file] with the local file paths for reading the encrypted data and saving the decrypted output.
If the command is successful, it returns no output.
Troubleshooting (Auth)
invalid audience** / “JWT validation failed”** -> Re-deploy the Google EKM service after opening CryptoHub at the correct FQDN so the audience matches Google’s token. (Google ID tokens must match issuer/JWKS and the exactaud.)JWKS fetch failed** / timeouts** -> Allow outbound HTTPS from CryptoHub (or via proxy) tohttps://www.googleapis.com/oauth2/v3/certs.

