[Also applies to v8]{class="badge positive" title="Also applies to Campaign v8"}
Zip or encrypt a file zipping-or-encrypting-a-file
ÃÛ¶¹ÊÓƵ 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.
To be able to do so:
-
Install a GPG key pair for your instance using the Control Panel.
note note NOTE Control Panel is restricted to Admin users, and available for certain Campaign versions only. Learn more -
If your installation of ÃÛ¶¹ÊÓƵ Campaign is hosted by ÃÛ¶¹ÊÓƵ, contact to have the necessary utilities installed on the server.
-
If your installation of ÃÛ¶¹ÊÓƵ Campaign is on premise, install the utility you want to use (for example: GPG, GZIP) as well as the necessary keys (encryption key) on the application server.
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.
Discover this feature in video
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 Classic, 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. For more on this, refer to this section.
-
Open the Data extraction (file) activity then configure it according to your needs. Global concepts on how to configure the activity are available in this section.
-
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 this section.
-
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
This video shows how to use a GPG key to encrypt data is also available in
Additional Campaign Classic how-to videos are available here.