# unikraft certificates edit

Replace the chain and private key of an uploaded certificate.

```
unikraft certificates edit <target> [flags]
```

## Examples

Replace a certificate before it expires:

```bash
unikraft certificate edit demo-cert \
  --chain cert.pem \
  --pkey cert.key
```

## Options

```
  --add <name>=<value>        Key-value pairs to add to the certificate.
  --add-file <name>=<filename>  Files containing key-value pairs to add to the certificate.
  --chain file                PEM certificate chain: the certificate followed by any intermediates. On edit, set it with pkey. Only uploaded certificates can be edited, and the common name must not change.
  --cmd CMD                   Run a command to edit fields (receives YAML on stdin, outputs edited YAML on stdout).
  --del <name>=<value>        Keys to delete from the certificate.
  --del-file <name>=<filename>  Files containing keys to delete from the certificate.
  --dry-run                   Print patches without applying them.
  -f, --field FIELD           Specify which fields to include in the output.
  --load LOAD                 Load fields from a YAML file.
  -o, --output OUTPUT         Output format. One of: kv, table, json, yaml, raw, quiet, template.
  --private-key file          PEM private key matching the certificate chain. On edit, set it with chain.
  --save FILE                 Save editable fields as YAML to a file (use - for stdout).
  --set <name>=<value>        Key-value pairs to set on the certificate.
  --set-file <name>=<filename>  Files containing key-value pairs to set on the certificate.
  --visual                    Open an editor to modify fields visually.
```

## Options inherited from parent commands

```
  --config file               Path to the configuration file.
  --log-level level           Set the logging level. (default info)
  --log-type type             Set the log type. (default text)
  --profile name              Set the current profile.
  --telemetry                 Toggle usage analytics. (default true)
  --timeout duration          Set a deadline for the command (e.g. 30s, 5m, 1h).
```

## See Also

* [`unikraft certificates`](../certificates.mdx): Manage Unikraft Cloud certificates.

