# Restore encrypted backups

> Restore encrypted data while retaining access to keys and required metadata.

---

LLMS index: [llms.txt](/llms.txt)

---

> For Mimus, restore the matching kernel, startup libraries, provider metadata and historical keys along with the backup. [Mimus procedure](/docs/tde/recovery/)

To restore an encrypted backup created with an earlier key, ensure the key is still available in your Key Management System (KMS). The backup remains **encrypted** on disk, `pg_tde` uses the correct key to transparently access the data.

## How pg_tde uses old keys to load backups {#how-pgtde-uses-old-keys-to-load-backups}

* **KMS**: stores the principal key(s) that were active when the backup was made.
* **Encrypted backup**: contains data encrypted with the key available at that time.
* **Current server**: `pg_tde` automatically loads the backup if the key is accessible through the KMS.

The table (internal) keys are stored within the backup. At runtime, `pg_tde` retrieves the principal key(s) from the configured KMS and uses them to decrypt the internal keys, enabling access to the encrypted table data.

> [!NOTE]
> If the required key(s) get deleted or are missing, the backup **cannot** be read.
>
> If the key(s) still exists but the KMS configuration has changed, you can use [`pg_tde_change_key_provider`](/docs/tde/upstream/command-line-tools/pg-tde-change-key-provider/) to update the configuration.
>
> However, if the key(s) got deleted from all accessible KMS sources, the encrypted backup is **unrecoverable**.

[PG.CENTER edition](https://github.com/pgsty/doc.pg.center/blob/4410c32dc9186a22859008303f474b72a779f583/content/percona/how-to/restore-backups.md) · [Upstream source](https://github.com/percona/pg_tde/blob/5dd7a9e4e3599d88546f5de67ff0f4ef3fe51a9a/documentation/docs/how-to/restore-backups.md)

---

Backlinks:

- [Migration and operations](/docs/mssql/operations/)
- [Operational impact](/docs/tde/upstream/index/what-tde-impacts/)
