Encrypt files before exporting

AG20
Tera Contributor
We have a requirement where records from a few HR tables need to be sent to a third-party system, in CSV format using a mid-server. This can be achieved via Export Sets.
 
The catch is the CSV files need to be encrypted in transit and at rest throughout. 
 
Some pointers we got is generate the file and attach it to a record, then using Column Level Encryption, encrypt the attachment. Then send it via SFTP step in flow designer. But we are not sure if this is achievable.
 
Another idea was to write a custom post-script in the Export Schedule to encrypt it using MID Server Script Includes. This will be a completely custom solution though, but not sure if the files will stay encrypted as soon as they are generated or there will be a few moments where they will be unencrypted.
 
Anyone ever come across a similar requirement or have any ideas? Thanks in advance for your assistance.
1 REPLY 1

Community Alums
Not applicable

Hi @AG20 ,

 try following approach:

1) allow export set to run

2) in the scheduled export set there is an option executed post export script

3) in that call mid server script include

4) in that mid server script include function have a java code which would pick the latest csv from the export set folder; have encryption

But the main thing if you do encryption then it is the 3rd party team's responsibility to decrypt it.

but with whatever key you do encryption how would you tell them the key to decrypt. for this you will have to share the key to them and always do encryption with the same key so that they can use same key to decrypt

https://coderanch.com/t/562936/java/File-encryption-decryption-retaining-line

https://www.oodlestechnologies.com/blogs/Encrypt-And-Decrypt-A-File-In-Java