Encrypt Data Files and Push to SFTP (How to) | Community
Skip to main content
Level 3
July 6, 2017
Solved

Encrypt Data Files and Push to SFTP (How to)

  • July 6, 2017
  • 6 replies
  • 8284 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vraghav

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

6 replies

vraghav
Adobe Employee
vraghavAdobe EmployeeAccepted solution
Adobe Employee
July 7, 2017

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

guillermoL
Level 4
July 7, 2017

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);
}
Level 3
July 22, 2017

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

derrickr8850025
Level 2
October 23, 2017

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?

guillermoL
Level 4
December 4, 2017

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

Jean-Serge_Biro
Level 10
December 5, 2017

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