Showing results for 
Search instead for 
Did you mean: 

How to PGP-Encrypt a file with a filename read from another branch

New Contributor

I am using a PGP Encrypt snap to encrypt an XML file, and this snap allows to define the "Encrypted filename" either fixed or based on a formula, but the snap only has one input.

How can I possibly set the filename using a value coming from another branch?

Basically, I don't know the filename of the original file "filename.xml" to encrypt, until the file appears on an SFTP folder. The pipeline is supposed to read the file using a Directory Browser and File Reader, create a PGP encrypted file named "filename.xml.pgp" and save it with a File Writer.

I could use a Copy after the Directory Browser to read the filename, add an output to the File Writer, connect it with a Join to the filename, and use a File Operation to rename the already encrypted file. However, I believe renaming a file after encryption actually breaks the encryption.

The File Writer does not allow a second input, and the only input is used by a XML Formatter, is there a way to include the filename in this input for use by the PGP Encrypt snap, without it  becoming also an XML element in the file itself?  


Contributor III

Hello @DMG,

One way to achieve this, is to wrap the File Reading and Encryption process in a child pipeline and from the Parent Pipeline you will pass the $Name field coming from the Directory Browser as a Pipeline Parameter. This will enable global access to the File Name in the child pipeline and you can use it in the File Writer Snap to set the final file name.

Or, you can use the Encrypted File name property in the PGP Encrypt Snap to set the file name coming from the File Name pipeline property, thus you will have to pass the $[‘encrypted-filename’] to the File Writer Snap as in the example in the docs.

Please refer to the attached skeleton pipeline for example, and let me know if this helps you! 🙂