Wednesday, May 20, 2020

How to Encrypt / Decrypt Files in OIC using PGP

How to Encrypt / Decrypt Files in OIC using PGP

Oracle Integration Cloud provides Pretty Good Privacy (PGP) mechanism to encrypt or decrypt the files which allow us to read/write files in a secure manner.

We need PGP public and private keys to achieve this,

  • PGP public key is used to encrypt the file
  • PGP private key is used to decrypt the file
I have used the below online tool to generate the PGP keys.

A public key is published and enables any sender to perform encryption and the private key is kept secret by the receiver and enables only him to perform correct decryption.

In below example, we would assume sender and receiver both are us(OIC).

How to Encrypt the File

Create FTP Connection with below details,


Choose one of the following security policies,
  • FTP Server Access Policy—This policy uses the user name and password for authentication.
  • FTP Public Key Authentication—This policy connects to the sFTP server using a key. This is used only for sFTP connections. 
  • FTP Multi Level Authentication—This policy uses multiple independent credentials to log in to the server. 

I have selected FTP Public Key Authentication. The simpler one is "FTP Server Access Policy" which just allows you to connect with plain username/password.

ASCII-Armor Encryption Format:

Select to format the encrypted message in ASCII armor. ASCII armor is a binary-to-textual encoding converter. ASCII armor formats encrypted messaging in ASCII. This enables messages to be sent in a standard messaging format. This selection impacts the visibility of message content. If not selected, the message is sent in binary format.

I have selected as "Yes", it depends on your requirement.

Cipher Algorithm : 

Select the symmetric cryptographic algorithm to use. Symmetric-key algorithms for cryptography use the same cryptographic keys for both encryption of plain text and decryption of cipher text.

  • CAST5
  • 3DES
  • AES128
  • AES192
  • AES256




Now let's create the integration and drag/drag the FTP connection created above.


Make sure to select "Perform PGP Encryption on the file to be sent to external FTP Server".



How to Decrypt the File

To Decrypt the file, you would need to use the private key. I will use the same FTP Connection created above, update the private key and its password(if applicable).


And Create a new integration to download the file and decrypt.


Select operation as "Download file".
And Make sure to select "Perform PGP Decryption on an encrypted file downloaded from external FTP Server".



3 comments: