Optimizely Forms is only supported by MVC-based websites and HTML5-compliant browsers.
By default, form submission data is stored as plain text. However, in some environments, the law requires data to be encrypted. For this reason, Optimizely Forms (version 4.6 and higher) includes a data encryption feature which can help clients meet strict legal requirements. All submission data can be encrypted before being saved into the database and then, decrypted later on.
For data encryption, the algorithm key is the most crucial feature and it needs to be ultimately secured for data safety. Therefore, Optimizely Forms uses Azure Key Vault – a new feature of the Azure platform, as the default algorithm key storage, which allows you to separate administrators or IT staff from accessing the key like traditional servers. This significantly improves data security. Without Azure Key Vault, the feature still works well with other kinds of key storage, such as on-premises servers or SQL Server. The article Forms crypto engine explains how you can customize the crypto engine with different kinds of key storage or algorithms.
Azure Key Vault is not included with Optimizely DXP and cannot be purchased as an add-on. You can purchase your own Azure Key Vault and use it with your applications implementation.
The default crypto engine of Optimizely Forms uses Azure Key Vault to store the symmetric algorithm key. It then retrieves the key from KeyVault and uses it for encryption and decryption. For more information, see:
Optimizely Forms uses the Advanced Encryption Standard (AES) to encrypt and decrypt data. AES has two main concepts:
- Data block size. Optimizely Forms follows the standard 128-bit length.
- Key size. Optimizely Forms supports three types: 128 bits, 192 bits, and 256 bits.
Azure Key Vault refers to their key as a "secret." To use encryption mode, create a secret on Azure Key Vault. Optimizely Forms retrieves your secret key from the Key Vault server and uses it in the encryption engine's symmetric algorithm. The secret should be base-64 encoded, meaning its characters are in the ASCII range of UTF8, and each character is 1 byte. So, the secret should contain only 16 characters for a key size of 128 bits, 24 characters for a key size of 192 bits, and 32 characters for a key size of 256 bits.
To enable form data encryption, follow these steps.
- A secret on Azure Key Vault.
- Installed NuGet package EPiServer.Forms.Crypto.AzureKeyVault.
- Session state is enabled.
- Open the Forms.config file.
- Before the <providers> section, add a <storage defaultProvider="DdsEncryptedPermanentStorage"> element.
- Within the <providers>element, specify three Azure Key Vault–related parameters for the cryptographic engine.
- ClientId. Application ID registered with Azure Active Directory.
- ClientSecret. The key created for the application in Active Directory.
- KeyIdentifier. The endpoint used for communication with Azure Key Vault. Used to retrieve token access, public key retrieval, and data decryption.
- Restart your site.
After you complete these steps, all forms data is encrypted before being saved (except system fields).
Sample Forms.config file excerpt:
<add name="DdsEncryptedPermanentStorage" type="EPiServer.Forms.Core.Data.Internal.DdsEncryptedPermanentStorage, EPiServer.Forms.Core" cryptoEngineType="EPiServer.Forms.Crypto.AzureKeyVault.Internal.AzureKeyVaultCryptoEngine, PiServer.Forms.Crypto.AzureKeyVault" clientId="abnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnhi" clientSecret="nnnnnnnnnnnnnnnnnnn/nnnnnnnnnnnnnA=" keyIdentifier="https://addonkeyvault.vault.azure.net/secrets/Thuy16Bytes/annnnnnnnnnnnnnnnnnnnnnnef"/>
To return to Optimizely Forms default mode that does not encrypt data, set DdsPermanentStorage as the storage element's default provider.
When you want certain users to access the Form Submissions view, which lets users see encrypted data and export decrypted data, create a new role and assign to it the privileges eligible to access form data. Those privileges are defined in the minimumAccessRightLevelToReadFormData element of the Forms.config file for the Optimizely Forms folder, such as shows in the following example.
Next, assign the role to appropriate users.
From now on, those users can view encrypted data and see an option to export as Decrypted CSV data.
Currently, the asynchronous export of decrypted CSV files is not supported. Because encryption is a time-consuming operation, if forms contain a large amount of data and the allowed time is too short, timeouts may occur. To use decryption more efficiently, you should increase your system timeout.
When using encryption mode, all columns must have the string data type (except system columns). As a result, the sort functionality does not work because it is based on numeric data types.
Normally, when a visitor clicks Next in a form, data is saved to the database. But in encryption mode, submission data is saved only when a user finalizes a submission, to enhance performance. This is because data must be encrypted before it is saved, and encryption is a resource-consuming operation.
For performance and security reasons, the progress button does not work in encryption mode. If a session expires, users are required to refill form data from the beginning. Old data is removed.
Updated 5 months ago