PGP Decryption in MuleSoft


Vendor can share their public key either in asc (Text) or gpg (Binary) extension to their clients so that they can do the decryption and send the decrypted data/files to Vendor. Once vendor receive the decrypted message then they can use their Private Key to decrypt the message. Let’s see how PGP decryption works in MuleSoft.

Before that if you want to understand PGP from starting then please go through below tutorials.

PGP Decryption – We need two things to decrypt in MuleSoft

  • Private Key in gpg format
  • Passphrase
  • Fingerprint

For this POC we will use Private Key we created in our earlier Tutorial – Generate Private Public PGP key

Let’s create a project in MuleSoft


Add the Crypto connector in Mule Palette – Checkout this tutorial on how to add module in Anypoint studio

Drag and drop PGP decrypt and Logger into the flow

Add Private_4232E6BD7151FF89D9F755807AC70C45987C59AA.gpg – PGP private key in resources


Click on PGP decrypt connector and click on add configuration


Populate Private keyring with Private key name we place in resources

  • Click Add symbol to add key detail
  • Add Key id, Fingerprint and Passphrase detail

Click Finish

PGP Decryption in MuleSoft


Configuration will be like below

PGP Decryption in MuleSoft


In logger we will capture the decrypted payload

PGP Decryption in MuleSoft


Now run the application and test the endpoint in SOAP UI, will use the encrypted payload we generated in link

PGP Decryption in MuleSoft


We can see the decrypted message in response

PGP MuleSoft application – pgp-sample-service

PGP SOAP UI application – PGP-Sample-soapui-project

Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.

Share this:
Notify of
Inline Feedbacks
View all comments