Encrypting User Names and Email Addresses in the Database

Starting with ManualWorks 6.0.17, you can store user names and email addresses encrypted in the database. Starting with 6.0.22, the authors of documents and chapters are also encrypted.

ManualWorks can encrypt the names and email addresses in the user (R_USER) table and the authors in the document (R_BOOK) and chapter (R_CHAPTER) tables with the AES-256/GCM algorithm. When this feature is on, these values are encrypted when saved and decrypted automatically when read.

Turning On User Information Encryption

User information encryption is turned on and off with a startup script option. Add the following option to the startup script options, and restart ManualWorks. This setting alone does not encrypt user information or document and chapter authors that are already stored, so also run the user information migration below.

3rabbitz.enable_user_encryption=true

If you do not set the property, or set it to anything other than true, encryption is off.

If you turn off this option after data is encrypted, the data is not decrypted, so names and email addresses appear as ciphertext starting with {v:KEY_ID}. To turn off encryption, keep the option on, change the active value in the key file to plain, restart ManualWorks, and run the user information migration. After the migration finishes, remove the option and restart ManualWorks.

Key File

The encryption key is stored in the .key.json file in the Data Directory.

API keys of AI providers are also encrypted with this key file. This applies even if the user information encryption option is off, and API keys are not encrypted if the active value in the key file is plain. The key file is not included in ManualWorks backups, so if you restore a backup on another server without the key file, the API keys cannot be decrypted. In that case, enter the API keys again in the AI Provider screen.

In a redundant server environment, all nodes must use the NAS for the data and backup directories. All nodes therefore share one .key.json file stored in the same data directory on the NAS. Separate data directories or key files for each node are not supported.

The key file uses the following JSON format.

{
    "active": "k1",
    "keys": {
        "k1": "Base64-encoded 32-byte key"
    }
}

After you change the key file, restart ManualWorks.

Rules for Key IDs and Values

Key IDs follow these rules.

You can create a key with the generate-key command in the Console.

generate-key

Format of Encrypted Values

Encrypted values have a prefix in the following format.

{v:KEY_ID}Base64-encoded IV + ciphertext

For example, a value encrypted with the k1 key starts as follows.

{v:k1}fI3YfyWSJ+...

The prefix identifies which key encrypted the value, which makes key rotation possible.

Plain Mode

To store user information as plain text without encryption, set the active value in the key file to plain.

{
    "active": "plain",
    "keys": {
        "k1": "Base64-encoded 32-byte key"
    }
}

In plain mode, ManualWorks works as follows.

Key Rotation

To rotate keys, add a new key and change the active value to the new key ID.

{
    "active": "k2",
    "keys": {
        "k1": "previous key",
        "k2": "new key"
    }
}

Do not remove k1 from keys right after the migration. Data in backups or on other nodes might still need the k1 key.

User Information Migration

After you turn on user information encryption for the first time or rotate keys, run the migration to store all user information again with the current active key. The authors of documents and chapters are processed at the same time.

Run the migration as follows.

  1. Log in as an administrator.

  2. Go to the 1User Encryption Migration page (/#/r/user_encryption).

  3. Check the active key ID shown at the top of the page (for example, key: k1).

  1. Click the 2 button. If the 3rabbitz.enable_user_encryption option is not set, the button is disabled.

  2. In the “Are you sure you want to execute?” dialog, click the button.

  3. Watch the progress and wait until all users are processed.

  4. When the migration finishes, the message Completed. appears.

The migration saves every user record again. With many users, it can take a while, so we recommend running it when few users are active.

Operational Considerations

Keep the following in mind when you operate user information encryption.

Limitations