# Password encryption

> OpenAEV 2.1.0 encrypts the secrets of integrations stored in its database and needs two new mandatory settings, an encryption key and a salt.

- URL: https://filigran.io/docs/deploy/upgrade/breaking-changes/openaev/2-1-0-password-encryption/
- Products: OpenAEV 3.261118.0
- For: platform engineers
- Type: How-to guide

From OpenAEV 2.1.0, the integrations of the catalog are managed from the OpenAEV interface, and their configuration is stored in the database. OpenAEV encrypts the passwords and secrets of that configuration, which needs two new mandatory settings. This page gives them and how to set them.

**Diagram: From OpenAEV 2.1.0, a key and a salt set before the start let OpenAEV encrypt the secrets of integrations in its database, so keep both with your backups**

- Configuration (.env): Encryption key (OPENAEV_ADMIN_ENCRYPTION_KEY), Encryption salt (OPENAEV_ADMIN_ENCRYPTION_SALT, at least 8 bytes)
- OpenAEV 2.1.0 and later: OpenAEV (Derives a 256-bit key)
- Storage: Integration configuration (Passwords and secrets encrypted), Your backups (A copy of the key and the salt)

Connections:

- Encryption key → OpenAEV: set before start
- Encryption salt → OpenAEV: set before start
- OpenAEV ↔ Integration configuration: encrypts and reads
- Encryption key → Your backups: keep a copy
- Encryption salt → Your backups: keep a copy

| | Version |
| --- | --- |
| Introduced in | OpenAEV 2.1.0 |

## The two settings {#the-two-settings}

| Parameter | Environment variable | Default | Description |
| --- | --- | --- | --- |
| `openaev.admin.encryption_key` | `OPENAEV_ADMIN_ENCRYPTION_KEY` | None, mandatory | Key used with the salt to derive the 256-bit key that encrypts sensitive data in the database |
| `openaev.admin.encryption_salt` | `OPENAEV_ADMIN_ENCRYPTION_SALT` | None, mandatory | Salt used with the key. At least 8 bytes long |

## Set them {#set-them}

Set both before you start OpenAEV 2.1.0 or later. With xtm-docker, they are in `.env`.

1. Check whether `.env` already gives them a value.

   ```bash
   grep -E '^OPENAEV_ADMIN_ENCRYPTION_(KEY|SALT)=[^ #]' .env
   ```

   If it prints both lines, keep them and stop here: OpenAEV needs the same values to read the secrets it has already encrypted.

2. Otherwise, generate a key and a salt and write them to `.env`.

   ```bash
   sed -i.bak -e "s|^OPENAEV_ADMIN_ENCRYPTION_KEY=.*|OPENAEV_ADMIN_ENCRYPTION_KEY=$(openssl rand -hex 32)|" \
     -e "s|^OPENAEV_ADMIN_ENCRYPTION_SALT=.*|OPENAEV_ADMIN_ENCRYPTION_SALT=$(openssl rand -hex 16)|" .env
   ```

   **Check that it worked**

   ```bash
   grep -E '^OPENAEV_ADMIN_ENCRYPTION_(KEY|SALT)=[^ #]' .env
   ```
   It prints both lines, each with a value.

3. Start OpenAEV again: `docker compose up -d openaev`.

Keep a copy of both values with your backups: without them, OpenAEV cannot read the secrets it has encrypted.

## What's next {#what-s-next}

- [OpenAEV configuration reference](https://filigran.io/docs/reference/openaev/configuration/), every OpenAEV setting.
- [Breaking changes](https://filigran.io/docs/deploy/upgrade/breaking-changes/), the other changes per version.
