Complete the code to create a new key ring in Cloud KMS.
gcloud kms keyrings create [1] --location=us-central1The command gcloud kms keyrings create my-keyring --location=us-central1 creates a key ring named my-keyring in the specified location.
Complete the code to create a new symmetric encryption key in the key ring.
gcloud kms keys create [1] --location=us-central1 --keyring=my-keyring --purpose=encryptionThe command creates a symmetric encryption key named my-symmetric-key in the my-keyring key ring.
Fix the error in the command to encrypt data using the key.
echo 'Hello World' | gcloud kms encrypt --location=us-central1 --keyring=my-keyring --key=[1] --plaintext-file=- --ciphertext-file=encrypted.txt
The --key flag requires the name of the key, which is my-symmetric-key. Using other values causes errors.
Fill both blanks to decrypt the ciphertext file and output the plaintext.
gcloud kms decrypt --location=us-central1 --keyring=[1] --key=[2] --ciphertext-file=encrypted.txt --plaintext-file=decrypted.txt
The command uses the key ring my-keyring and the key my-symmetric-key to decrypt the file.
Fill all three blanks to list all keys in a key ring with their purpose.
gcloud kms keys list --location=[1] --keyring=[2] --format='table(name, [3])'
This command lists all keys in the my-keyring key ring located in us-central1, showing their names and purposes.