This is the second part of transferring the secured file over SFTP in Oracle Integration Cloud. In the previous blog, we showcased how to create encrypted files using Pretty Good Privacy (PGP) mechanism.

In the article, we’ll process the encrypted file, decrypt it and print the records into the logs.
Please check previous article before moving forward.To decrypt the file, we would be needing the PGP private key along with the password.

The PGP key private key needs to be uploaded into the FTP connection. Open the FTP connection and click on the Configure Security button. Notice the “PGP Private Key” field, click on the Checkbox and click on the Upload button.

Once we click on the Upload button, it will allow us browsing the file. Browser the PGP private key and click on the Upload button

Enter the PGP private key password

Once done, click on the Test connection button. If everything is OK, the connection should be tested successfully.

Let’s try to decrypt the PGP encrypted file.

Process of files decryption

  • Create a scheduler process with the name “DecryptFiles
To decrypt the file, we have to download the file into Oracle Integration Cloud staging area and decrypt it
  • Drop the FTP connection on Integration canvas, enter the endpoint name as “DecryptFile” and click on the Next button
  • Enter the below information and click on the Next button
    • Select Operation: Download File
    • Select a Transfer Mode: ASCII
    • Input Directory: Enter the directory(/home/opc/target) where the encrypted file resides
    • File Name: Enter the file name to be read(Encrypt.csv)
    • Check the Decrypt the File option
  • Finish the FTP wizard
  • File has been decrypted at Stage location of Integration Cloud. So to read the file from Staging there is Stage activity which allows to read files from Staging location. Drop the Stage File activity just below the FTP adapter
  • Enter the endpoint name as “ReadFile
  • Enter the below information and click on the Next button
    • Choose Stage File Operation: Read Entire File
    • Specify the File Name: Select Expression builder and drop fileName element of $DecryptFile object
    • Specify the directory to read from: Select Expression builder and drop directory element of $DecryptFile object
  • Select Create a new schema from a CSV file radio button
  • Enter the below information and finish the Wizard
    • Select the Delimited Data File: Choose the sample CSV file with below structure
    • Enter the Record Name: Enter as “Employee”
    • Enter the Recordset Name: Enter as “Employees”
    • Use First Row as a Column Header: This will be enabled only once the sample CSV file is browsed. This allows us to treat the First row as a header row or data row. If this is checked, which means the first row will be treated as a header(will not be picked up during reading) else data row. Uncheck this option as during encrypting the file we have not added header
FirstName,LastName,Qualification
Ankur,Jain,MCA
Tom,ghai,BED

Test Integration

We completed the configuration. Let’s save, activate and Submit the Integration now.

Open the Activity Stream of the instance and see the decrypted data should be shown of the Stage Read File Operation

The data can be looped over and can the processed as required.