Expand my Community achievements bar.

SOLVED

Encrypt Data Files and Push to SFTP (How to)

Avatar

Level 3

I am trying to push the data in a file to a SFTP location but I want that file to be encrypted.

Is there any activity / componennt in AC v7 which has a provision to specify encryption command before it pushes the file to SFTP server ?

Also, is there a utility in AC which can be invoked from workflow to unzip the files before ingesting ?

Your help is all appreciated.

Sid

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi Sid,

If your instance is hosted by Adobe, ask support to install GPG utility on the server.

Get public private key pair generated for outbound transfer.

While doing export, inside the JS code activity, you can encrypt the file on Campaign server and also provide the public key to external sFTP server team for decrypting the file.

Regards,
Vipul

View solution in original post

6 Replies

Avatar

Correct answer by
Employee

Hi Sid,

If your instance is hosted by Adobe, ask support to install GPG utility on the server.

Get public private key pair generated for outbound transfer.

While doing export, inside the JS code activity, you can encrypt the file on Campaign server and also provide the public key to external sFTP server team for decrypting the file.

Regards,
Vipul

Avatar

Level 4

Hi Sid,

After setting gpg on the server and importing the public key as Vipul said, a function like this below can help within the workflow:

function encryptFile(file) {   
  var systemCommand = "gpg --encrypt --recipient  recipientToEncryptTo " + file;  
  var result = execCommand(systemCommand, true);
}

Avatar

Level 3

Thank You Everyone. It worked, appreciate all your help here.

Avatar

Level 2

Morning

What's the inverse of that?

Say you have a file that is encrypted and you need A.Campaign to decrypt it.

How do you specify the key to you?

Also, what if your instance has multiple keys? Say BrandA has keyA and BrandB uses keyB.

How do you handle that situation?

Avatar

Level 4

Hi,

Sorry for the delay. The inverse is:

function decryptImportFile(file) {

  var fullName = file.fullName.toString();

  var outputFile = 'decryptedFile.xxx';

  var systemCommand = "gpg --output " + outputFile + " --decrypt " + fullName;

  var result = execCommand(cmd, true);

}

To handle multiple keys you will need to import all of them into your gpg and the use one or another to encrypt by using the switch -r or --recipient when calling gpg.

I hope it makes sense.

Thanks

Guillermo

Avatar

Level 10

Hi Sid,

Regarding the compression/uncompression method, it is provided OOTB by Adobe Campaign unfortunately.

So you must call an operation system script activity (command line) in your import workflow in order to do the unzip job.


If Linux server, you can use gunzip command.
If Windows server, I do recommend you to install 7Zip tool (free and very powerful, and all compression algorithms supported).

Please take care that recent AC build prohibits use of system script activity in workflow, so you would have to allow the commands to allow (unzip, gpg) on the server themselves (or ask to Adobe for configuration level if they can accept it, if not hosted On Premise).

Regards.

Jean-Serge