> For the complete documentation index, see [llms.txt](https://oten.gitbook.io/kms-support/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oten.gitbook.io/kms-support/google-cse-integration/google-cse-backup-and-re-wrap.md).

# Google CSE Backup & Re-wrap

### 1. What Problem Does This Solve? <a href="#id-1.-what-problem-does-this-solve" id="id-1.-what-problem-does-this-solve"></a>

You're using Google Workspace Client-Side Encryption (CSE) with **Key Service A** (e.g., Oten KMS). Now you need to switch to **Key Service B** (maybe upgrading to a new version, changing vendors, or consolidating services).

**The challenge:** Thousands of files are already encrypted with Key Service A. How do you switch without:

* Breaking access to existing files?
* Requiring users to re-encrypt everything manually?
* Causing downtime?

**The solution:** Google's **Rewrap** feature coordinates with your KMS providers to automatically re-encrypt all Data Encryption Keys (DEKs) in the background while users continue working normally.

***

#### Architecture Overview <a href="#architecture-overview" id="architecture-overview"></a>

Understanding the architecture helps clarify who does what during migration.

**The Three Players**

<figure><img src="/files/hZbqRhgcIpb6vmhxEiyz" alt=""><figcaption></figcaption></figure>

***

#### What "Backup" Really Means <a href="#what-backup-really-means" id="what-backup-really-means"></a>

> **Your Old Key Service remains connected so the New one can call it** to unwrap old DEKs during migration.

The "Backup" configuration does TWO things:

1. **For Rewrap:** Tells the New Key Service where to send `/unwrap` requests for old DEKs
2. **For User Access:** Allows Google to route decryption requests to Old Key Service for files not yet migrated

<figure><img src="/files/dC8JxhuZdef2XCjtzmxv" alt=""><figcaption></figcaption></figure>

**The "Backup" is NOT:**

* A copy of your data
* A snapshot of your keys
* A disaster recovery mechanism
* Managed by Google

**The "Backup" IS:**

* Your Old Key Service that must stay running
* A configuration that enables Key Service-to-Key Service communication
* Your responsibility to maintain

### 2. Step-by-Step Migration Guide <a href="#id-2.-step-by-step-migration-guide" id="id-2.-step-by-step-migration-guide"></a>

#### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* Super Administrator account for Google Workspace
* Old Key Service running and accessible
* New Key Service deployed with `/rewrap` implemented
* New Key Service configured with Old Key Service credentials

#### Step 1: Add New Key Service with Backup Configuration <a href="#step-1-add-new-key-service-with-backup-configuration" id="step-1-add-new-key-service-with-backup-configuration"></a>

1. Go to **Google Admin Console**
2. Navigate to **Data > Compliance > Client-side encryption**
3. Click **Add new service**
4. Enter New Key Service details:
   * **Name:** Your new service name
   * **URL:** `https://new-key-service.example.com`
5. **Critical:** Under "Select backup key", choose your **Old Key Service**

> This tells Google to include `original_kacls_url` in rewrap requests, pointing to your Old Key Service

#### Step 2: Assign New Key Service and Enable Migration <a href="#step-2-assign-new-key-service-and-enable-migration" id="step-2-assign-new-key-service-and-enable-migration"></a>

1. In Client-side encryption, click **Assign**
2. Select your **Organizational Unit** or **Group**
3. Under "Key service", select your **New Key Service**
4. Toggle **Migration** to **ON**
5. Confirm and **Save**

> Migration starts immediately - Google begins sending `/rewrap` requests to your New Key Service

#### Step 3: Monitor Progress <a href="#step-3-monitor-progress" id="step-3-monitor-progress"></a>

1. Go back to **Assign** section
2. Select your Organizational Unit
3. Check the **Migration** counter

| Status              | Meaning                              |
| ------------------- | ------------------------------------ |
| `X items remaining` | X files still using Old Key Service  |
| `0 items`           | All DEKs migrated to New Key Service |

**Monitor your Key Service logs** for:

* `/rewrap` requests from Google
* `/unwrap` calls to Old Key Service
* Any errors or failures

#### Step 4: Cleanup (Optional - After Migration Complete) <a href="#step-4-cleanup-optional-after-migration-complete" id="step-4-cleanup-optional-after-migration-complete"></a>

Once migration counter shows **0 items**:

1. Go to Key Service list
2. Select your New Key Service
3. Click **Remove backup**

> After this, you can decommission Old Key Service (but keep key material for potential recovery)

***

### 3. When Does Each Flow Trigger? <a href="#id-3.-when-does-each-flow-trigger" id="id-3.-when-does-each-flow-trigger"></a>

#### Scenario A: Active Migration (Admin initiated) <a href="#scenario-a-active-migration-admin-initiated" id="scenario-a-active-migration-admin-initiated"></a>

| Trigger                  | Admin enables Migration toggle                           |
| ------------------------ | -------------------------------------------------------- |
| Google's action          | Sends `/rewrap` to New Key Service for each file         |
| New Key Service's action | Calls Old Key Service `/unwrap`, then wraps with new KEK |
| Result                   | DEKs permanently converted to New Key Service format     |

#### Scenario B: User Opens Old File (Migration in progress) <a href="#scenario-b-user-opens-old-file-migration-in-progress" id="scenario-b-user-opens-old-file-migration-in-progress"></a>

| Trigger                  | User opens file not yet migrated                                          |
| ------------------------ | ------------------------------------------------------------------------- |
| Google's action          | Sends `/unwrap` to Old Key Service (Backup)                               |
| Old Key Service's action | Unwraps DEK and returns to Google                                         |
| Result                   | User gets access; file stays with Old Key Service until rewrap reaches it |

#### Scenario C: Emergency Failover <a href="#scenario-c-emergency-failover" id="scenario-c-emergency-failover"></a>

| Trigger         | New Key Service has critical failure                                       |
| --------------- | -------------------------------------------------------------------------- |
| Admin's action  | Click "Disable & use backup"                                               |
| Google's action | Routes ALL requests to Old Key Service                                     |
| Result          | Old Key Service handles all encrypt/decrypt until Key Service KMS recovers |

<figure><img src="/files/OSj9GHOfF6a9IzTIOcSN" alt=""><figcaption></figcaption></figure>

***

### Important Limitations <a href="#important-limitations" id="important-limitations"></a>

#### Single Backup Rule <a href="#single-backup-rule" id="single-backup-rule"></a>

Only **ONE** backup service per KMS at a time.

#### Gmail Requires a Separate Process <a href="#gmail-requires-separate-process" id="gmail-requires-separate-process"></a>

| Service                     | Rewrap via Admin Console?   |
| --------------------------- | --------------------------- |
| Drive, Docs, Sheets, Slides | Yes                         |
| Calendar, Meet              | Yes                         |
| **Gmail**                   | **No** - requires Gmail API |

#### No Automatic Notifications <a href="#no-automatic-notifications" id="no-automatic-notifications"></a>

* No email when migration completes
* No progress bar
* Admins must manually check the counter
