Customer-managed encryption keys (original) (raw)

Setup

By default, Cloud Storage encrypts customer content at rest. Cloud Storage handles encryption for you without any additional actions on your part. This option is called Google default encryption.

If you want to control your encryption keys, then you can use customer-managed encryption keys (CMEKs) in Cloud KMS with CMEK-integrated services including Cloud Storage. Using Cloud KMS keys gives you control over their protection level, location, rotation schedule, usage and access permissions, and cryptographic boundaries. Using Cloud KMS also lets you track key usage, view audit logs, and control key lifecycles. Instead of Google owning and managing the symmetrickey encryption keys (KEKs) that protect your data, you control and manage these keys in Cloud KMS.

After you set up your resources with CMEKs, the experience of accessing your Cloud Storage resources is similar to using Google default encryption. For more information about CMEKs, see Customer-managed encryption keys (CMEK). To learn how to use manually-created CMEKs to protect your Cloud Storage resources, seeUse customer-managed encryption keys.

For more information about other encryption options when using Cloud Storage, seeData Encryption Options.

CMEK with Cloud KMS Autokey

You can either create CMEKs manually to protect your Cloud Storage buckets and the objects within them or use Cloud KMS Autokey. With Autokey, key rings and keys are generated on demand as part of resource creation or update in Cloud Storage. Service agents that use the keys for encrypt and decrypt operations are created if they don't already exist and are granted the required Identity and Access Management (IAM) roles. For more information, see Autokey overview.

Autokey doesn't create keys for objects. By default, objects in a bucket use the bucket default key. If you want to encrypt an object using a key other than the bucket default key, you can manually create a CMEK and use that key when creating the object.

To learn how to use CMEKs created by Cloud KMS Autokey to protect your Cloud Storage buckets and the objects within them, see Using Autokey with Cloud Storage resources.

When is the key used?

When you apply a CMEK to an object, Cloud Storage uses the key when encrypting:

Cloud Storage uses standard server-side keys to encrypt the remaining metadata for the object, including the object's name. Thus, if you have sufficient permission, you can perform actions such as reading most metadata, listing objects, and deleting objects even after you've disabled or destroyed the associated CMEK.

Service agents

Each project has a special Cloud Storage service account called a_service agent_ that performs encryption and decryption with CMEKs. Once yougive the service agent access to an encryption key, that service agent encrypts:

When adding or rewriting an object in Cloud Storage, if you have both a default key set on your bucket and a specific key included in your request, Cloud Storage uses the specific key to encrypt the object.

When a requester wants to read an object encrypted with a CMEK, they simply access the object as they normally would. During such a request, the service agent automatically decrypts the requested object as long as:

If one of these conditions is not met, the service agent does not decrypt the data, and the request fails.

Restrictions

The following restrictions apply when using CMEKs:

Cloud KMS quotas and Cloud Storage

When you use CMEK in Cloud Storage, your projects can consume Cloud KMS cryptographic requests quotas.

Encryption and decryption operations using CMEK keys affect Cloud KMS quotas in these ways:

For more information, seeCloud KMS quotas.

Relation to customer-supplied encryption keys

In addition to customer-managed encryption, Cloud Storage offersCustomer-Supplied Encryption Keys as a way of controlling your data encryption. You can encrypt different objects in a single bucket with different encryption methods, but note that:

Key management

This section discusses considerations when rotating keys, replacing keys, and disabling or destroying key versions.

Key rotation

Cloud KMS supports both automatic and manual key rotation to a new version. After rotating a key, Cloud Storage uses the new version for all operations that encrypt using the key, such as:

Previous versions of the key are not disabled or destroyed, so Cloud Storage can still decrypt existing objects that were previously encrypted using those versions.

Key replacement

Use the following guidelines when replacing the key you use to encrypt Cloud Storage objects with a new key:

  1. Check your buckets to see which use the key as their default encryption key. For these buckets, replace the old key with a new key.
    This ensures that all objects written to the bucket use the new key going forward.
  2. Inspect your source code to understand which requests use the key in ongoing operations, such as setting bucket configurations and uploading, copying, or rewriting objects. Update these instances to use the new key.
  3. Check for objects, in all of your buckets, encrypted with the old key. Use the Rewrite Object method to re-encrypt each object with the new key.
  4. Disable all versions of the old key. After disabling old key versions, monitor client and service logs for operations that fail due to a version becoming unavailable.

Disabling or destroying a key version

Key versions and locked objects

If a key version encrypts an object that is locked, either because the object is stored in a bucket with a locked retention policy or because the object has its own locked retention configuration, the key version can only be destroyed if the following conditions are met:

Once all relevant objects have met these conditions, it's possible to destroy the key version, even without deleting the objects. If you do so, affected object data becomes permanently inaccessible.

What's next