Understanding Data Encryption Keys and Master Keys
Encryption works by using a key, which is a piece of data, to scramble plaintext into ciphertext. When you first begin using the application, Arc generates a random key that is never saved in plaintext anywhere. That is the data encryption key, or DEK. All data is encrypted using this key. A master key (also known as a Key Encryption Key or KEK) does not encrypt data directly. Instead, it is a wrapper which encrypts other keys. Arc also provides a built-in master key, but as mentioned above, you can define your own master key instead. The remainder of this topic describes how to create or update your user-defined master key. The following table compares the two keys:Using the same master key file on two instances does not let them decrypt each other’s values. Only the data encryption key determines that. Do not point an existing instance’s
AppKey at a different master key file. Use the change master key command instead, or the instance fails to start with an Incorrect user master key or key file is damaged message.Check Whether Master Key Encryption Is Enabled
Some features, such as the data encryption key export and import used for development environments, require master key encryption to be enabled. To check whether it is enabled on an instance:- Cross-Platform edition: Master key encryption is enabled if the cdata.encryption.key property is set in the arc.properties configuration file, or the
APP_KEYenvironment variable is set. - .NET edition: Master key encryption is enabled if an
AppKeyentry exists in theappSettingselement of theWeb.Configfile in thewwwfolder of the installation directory, or theAPP_KEYenvironment variable is set.
Enable Master Key Encryption
To enable master key encryption on an instance where it is not enabled, including an existing instance that already stores values:- Stop Arc.
-
Set the master key:
-
Cross-Platform edition: Set the cdata.encryption.key property in the arc.properties configuration file:
-
.NET edition: Add the following entry to the
appSettingselement of theWeb.Configfile in both thewwwfolder and thewww_servicesfolder of the installation directory:
-
Cross-Platform edition: Set the cdata.encryption.key property in the arc.properties configuration file:
-
Start Arc. If you use
default.master_keyand the file does not exist, Arc generates it in the application directory. Values that are already stored remain readable.
APP_KEY environment variable to supply the key file path. Relative paths are resolved against the application directory. To use your own key file instead of the default, see Define Custom Master Key.
Define Custom Master Key
The way in which you define a master key varies by Arc edition type.-
Cross-Platform edition: Define the key using the cdata.encryption.key property in the arc.properties configuration file. If you are defining a PFX key and require a password, set it in the cdata.encryption.key.password property. Alternatively, if you are using an AES key, you can use the
APP_KEYenvironment variable to supply the file path to the key file. -
.NET edition: Set a file path in the
AppKeysetting in theappSettingselement of theWeb.Configfile in both thewwwfolder and thewww_servicesfolder of the installation directory. If you are defining a PFX key and require a password, set it in theAppKeyPasswordsetting. Here is the XML snippet in Web.Config that you need to add:
Change Master Key
If necessary, you can replace the master key file. Arc always uses the key that you have provided for encryption. To change the master key, ensure that you have stopped the server, then use one of the following options:- Cross-Platform edition: Administrators can use the
arc.jar -ChangeMasterKey <new-master-key-file-path>command to rotate the master key. If you are changing the master key to a PFX file, and you require a password, use thearc.jar -ChangeMasterKey <new-master-key-file-path> <new-master-key-password>command. - .NET edition: Administrators must use the
CData.exe appChangeMasterKey -NewKey <new-master-key-file-path> -@libdir "www\bin"command (do not modify the Web.Config file directly). If you are changing the master key to a PFX file, and need a password, use theCData.exe appChangeMasterKey -NewKey <new-master-key-file-path> -NewKeyPassword <new-PFX-password> -@libdir "www\bin"command.
Arc only supports the RSA algorithm in PFX certificate files. Other DSA or ECC certificates are rejected.
Use Safe Mode
If you lose your custom master key and need to re-save your configuration’s sensitive values (from another source of record that you have), you can start Arc in safe mode. This disables all backend automation services and enables very limited features so you can try to recover your settings and other tasks. To enable safe mode:- Cross-Platform edition: Run
java -jar arc.jar -safemode - .NET edition: Add
<add key="SafeMode" value="true" />to theappSettingselement of your Web.Config file.