The [VPC-SC security controls](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/security-controls.md.txt) and
CMEK are supported by RAG Engine on Gemini Enterprise Agent Platform. Data residency and AXT security controls aren't
supported.

This page shows you how to enable CMEK to work with
RAG Engine on Gemini Enterprise Agent Platform.

## Overview

RAG Engine provides robust options for managing how
your data at rest is encrypted. By default, all user data within `RagManagedDb`
is encrypted using a Google-owned and Google-managed encryption key, which is the default
setting. This default setting helps you to verify that your data is secure
without requiring any specific configuration.

If you require more control over your keys used for encryption,
RAG Engine supports [Customer-managed encryption keys (CMEK)](https://docs.cloud.google.com/kms/docs/cmek.md.txt). With CMEK, you can use your
cryptographic keys, managed within Cloud Key Management Service (Cloud KMS), to protect your RAG
corpus data.

## Set up the encryption key with your RAG corpus

To set up an encryption key, follow the steps at [Set up your Cloud KMS key and grant
permissions](https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/rag-engine/use-ragmanageddb-with-rag#set-up-your-kms-key-and-grant-permissions).

## CMEK limitations for RAG Engine on Gemini Enterprise Agent Platform

RAG Engine on Gemini Enterprise Agent Platform supports CMEK with the following limitations:

- Before creating a RAG corpus, you must manually enable the RAG Service
  account. For detailed instructions, see [Grant Permissions to the
  RAG Engine service
  agent](https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/rag-engine/use-ragmanageddb-with-rag#grant-permissions-to-rag-engine-service-agent).

- CMEK is only supported on `RagVectorDbConfig` of type `RagManagedDb`.

- The `encryption_spec` field defines the Cloud KMS key, and the field is immutable,
  which means that CMEK can't be enabled or disabled after the RAG corpus is
  created.

- No more than 50 unique Cloud KMS keys can be used to create RAG corpora per
  project per region.

## What's next

- For information about managing your encryption, see [Manage your
  encryption](https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/rag-engine/use-ragmanageddb-with-rag#manage_your_encryption).

- For more information on RAG Engine, see
  [RAG Engine on Gemini Enterprise Agent Platform
  overview](https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/rag-engine/rag-overview).

- To learn more about data at rest, see [Data residency](https://docs.cloud.google.com/gemini-enterprise-agent-platform/resources/data-residency.md.txt).

- To learn more about RAG API methods and resources, see
  [Agent Platform
  API](https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest).