Compress and encrypt files compress-and-encrypt-files
Adobe Campaign lets you export zipped or encrypted files and import zipped or encrypted files. You apply a post-processing to the file when you export it, or a pre-processing before you load it.
Prerequisites prerequisites
To zip, unzip, encrypt or decrypt files:
-
Use the Control Panel to manage your GPG keys:
- To encrypt exported data, install a GPG key pair for your instance. Learn more
- To decrypt imported data, generate a public/private key pair. Learn more
note NOTE Control Panel is accessible to Admin users only. The steps to grant Admin access to a user are detailed in this page. Learn more about the Control Panel. -
Contact Adobe Customer Care to have the necessary utilities (for example GPG or GZIP) installed on the server.
Zip or encrypt a file before export zipping-or-encrypting-a-file
Adobe Campaign lets you export zipped or encrypted files. When defining an export through a Data extraction (file) activity, you can define a post-processing to zip or to encrypt the file.
You can then use commands or code in the Script tab of the activity or in a JavaScript code activity. An example is presented in the use case below.
Related topics:
Use case: Encrypt and export data using a key installed on Control Panel use-case-gpg-encrypt
In this use case, we will build a workflow in order to encrypt and export data using a key installed on Control Panel.
The steps to perform this use case are as follows:
-
Generate a GPG key pair (public/private) using a GPG utility, then install the public key onto Control Panel. Detailed steps are available in Control Panel documentation.
-
In Campaign, build a workflow to export the data and encrypt it using the private key that has been installed via the Control Panel. To do this, we will build a workflow as follows:
- Query activity: In this example, we want to execute a query to target the data from the database that we want to export.
- Data extraction (file) activity: Extracts the data into a file.
- JavaScript code activity: Encrypts the data to extract.
- File transfer activity: Sends the data to an external source (in this example, an SFTP server).
-
Configure the Query activity to target the desired data from the database. Refer to the Campaign v8 documentation.
-
Open the Data extraction (file) activity then configure it according to your needs. Global concepts on how to configure the activity are available in the Campaign v8 documentation.
-
Open the JavaScript code activity, then copy-paste the command below to encrypt the data to extract.
note important IMPORTANT Make sure you replace the fingerprint value from the command with the fingerprint of the public key installed on the Control Panel. code language-none var cmd='gpg '; cmd += ' --trust-model always'; cmd += ' --batch --yes'; cmd += ' --recipient fingerprint'; cmd += ' --encrypt --output ' + vars.filename + '.gpg ' + vars.filename; execCommand(cmd,true); vars.filename=vars.filename + '.gpg'
-
Open the File transfer activity, then specify the SFTP server to which you want to send the file. Global concepts on how to configure the activity are available in the Campaign v8 documentation.
-
You can now run the workflow. Once it is executed, data target by the query will be exported to the SFTP server into an encrypted .gpg file.
Tutorial video video-encrypt
This video shows how to use a GPG key to encrypt data.
Unzip or decrypt a file before import unzipping-or-decrypting-a-file-before-processing
Adobe Campaign lets you import zipped or encrypted files. Before they can be read in a Data loading (file)) activity, you can define a pre-processing to unzip or to decrypt the file.
You can then use the desired pre-processing commands in your workflows:
- Add and configure a File transfer activity in your workflow.
- Add a Data loading (file) activity and define the file format.
- Check the Pre-process the file option.
- Select the pre-processing command you want to apply.
- Add other activities to manage data coming from the file.
- Save and execute your workflow.
An example is presented in the use case below.
Related topics:
Use case: Import data encrypted using a key generated by Control Panel use-case-gpg-decrypt
In this use case, we will build a workflow in order to import data that has been encrypted in an external system, using a key generated in the Control Panel.
The steps to perform this use case are as follows:
-
Use the Control Panel to generate a key pair (public/private). Detailed steps are available in Control Panel documentation.
- The public key will be shared with the external system, which will use it to encrypt the data to send to Campaign.
- The private key will be used by Campaign to decrypt the incoming encrypted data.
-
In the external system, use the public key downloaded from the Control Panel to encrypt the data to import into Campaign.
-
In Campaign, build a workflow to import the encrypted data and decrypt it using the private key that has been installed via the Control Panel. To do this, we will build a workflow as follows:
- File transfer activity: Transfers the file from an external source to Campaign. In this example, we want transfer the file from an SFTP server.
- Data loading (file) activity: Loads the data from the file into the database and decrypt it using the private key generated in the Control Panel.
-
Open the File transfer activity then specify the external account from which you want to import the encrypted .gpg file.
Global concepts on how to configure the activity are available in the Campaign v8 documentation.
-
Open the Data loading (file) activity, then configure it according to your needs. Global concepts on how to configure the activity are available in the Campaign v8 documentation.
Add a pre-processing stage to the activity, in order to decrypt the incoming data. To do this, select the Pre-process the file option, then select Decrypt from the Command drop-down list:
note NOTE If changes are needed to the available commands, you can reach out to Adobe Customer Care to adjust the preProcessCommand settings. -
Click OK to confirm the activity configuration.
-
You can now run the workflow. Once it is executed, you can check in the workflow logs that the decryption has been executed, and that data from the file have been imported.
Tutorial video video-decrypt
This video shows how to use a GPG key to decrypt data.