---
title: "ezgh keys re-encrypt"
description: "Move a ciphertext to another key, without showing its plaintext."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ezgh keys re-encrypt

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh keys re-encrypt <key> [--file path] [--context key=value]... [--new-context key=value]... [flags]
```

Open a ciphertext read from stdin or `--file`, and seal it under &lt;key&gt; with `--new-context`. The plaintext is never shown. It needs decrypt on the key that sealed it, and encrypt on &lt;key&gt;.

Part of [`ezgh keys`](/cli/reference/keys).

## Examples

```sh
ezgh keys re-encrypt kms_… --context tenant=acme --new-context tenant=acme < old.enc > new.enc
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--context` | string, repeatable |  | encryption context; opening it needs the same one, key=value; repeat for more |
| `--context-file` | string |  | encryption context; opening it needs the same one, from a file holding a JSON object of strings |
| `--file` | string |  | read the ciphertext from this file instead of stdin |
| `--new-context` | string, repeatable |  | encryption context to seal under, key=value; repeat for more |
| `--new-context-file` | string |  | encryption context to seal under, from a file holding a JSON object of strings |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/keys-re-encrypt/index.mdx
