Encryption

Last modified: January 17, 2025

Introduction

The Encryption module takes care of the following encryption needs:

  • Plain text encryption (for example, passwords)
  • FileDocument encryption (for example, files or photos)

Plain Text Encryption

Encrypt and decrypt plain texts using the AES algorithm. The key used for encryption is configured as a constant and remains on the application server.

Typical Use Cases

The typical usage scenario is when an app/module consumes a service where a user name and password are required, you can store the password in an encrypted way in the database.

Limitations

Currently, only AES is supported.

Configuration

EncryptionKey Constant

Set the EncryptionKey constant in your application, which can be found in the Private - String en/de-cryption folder. In module versions 2.2.0 and above, the EncryptionKey constant must be 32 characters long, corresponding to the updated 256 bits key length. You can use the LegacyEncryptionKey constant to decrypt strings which were encrypted with 128 bit keys using an older version of the Encryption module.

For versions below 2.2.0, ensure the key is 16 characters long to support the 128 bits key length.

When running the application locally, set the Value for the EncryptionKey constant in the App Settings > Configurations tab.

EncryptionPrefix Constant

Set the EncryptionPrefix constant in the Private - String en/de-cryption folder. The value depends on the module version you are using:

  • For version 2.2.0 and above, set the constant to {AES3}
  • For versions 1.4.1–2.1.3, set the constant to {AES2}

FileDocument Encryption

Encrypt and decrypt the contents of FileDocument entities using the PGP algorithm. The key used for symmetric encryption is embedded into encrypted file content. The certificate to use asymmetric encryption of the symmetric key is stored in the database.

Typical Use Cases

One of the typical usage scenarios may be an app/module that stores customer-sensitive documents such as photos. In such a case, you may want to encrypt those documents in a way that only the owner can see.

Configuration

No configuration is needed. However, you should generate or upload certificates upfront using the CertificateManagement page.