Need Technical Guidance - PGP Encryption/Decryption Solution

Hello,

Has anyone worked with PGP encryption and decryption for file data extraction. We are currently looking to build a solution that can decrypt PGP-encrypted files, and I would greatly appreciate any guidance or assistance you might be able to provide.

I see there was previously a UiPath custom activity available; however, it appears to have been deprecated and is no longer a viable option for our current needs.
PGP Encryption - RPA Component | UiPath Marketplace | Overview

If you have worked with PGP file decryption before or have knowledge of alternative approaches/tools that we could implement, I would be very grateful if you can share the knowledge here.

Thank you.

Hello @anuradha_puligoti,

Not worked directly with PGP decryption in UiPath.
Have seen tutorials using Gpg4Win with command line integration through UiPath.
Approach is to call gpg.exe with arguments for decryption and manage keys securely.
Decrypted output can then be processed in UiPath workflow.

Hello @anuradha_puligoti

I have not worked on PGP Encryption, but here is what I found

Option 1: Use GnuPG (GPG) with PowerShell

This approach uses a reliable, open-source tool for PGP operations and integrates it into your UiPath workflow via a script.

Prerequisites

  1. Install GnuPG: Download and install GPG4Win from the official website on the machine running your UiPath Robot. During installation, choose the “GnuPG” and “GPGME” components.
  2. Import your PGP private key: You must import the private key and its associated passphrase into GnuPG for the decryption to work. You can do this with the following command:
gpg --import "C:\path\to\your\privatekey.asc"
  1. Trust the key: To avoid warnings and automate the decryption process, you may need to set the trust level for your key. In GPG, use gpg --edit-key <key_id>, then use the trust command and set it to level 5 (ultimate).

UiPath automation steps

  1. Use the Invoke Power Shell activity: Add this activity to your workflow.
  2. Configure the script: Paste the following PowerShell script into the body of the activity.
  3. Define parameters: For best practice, create UiPath variables for the file paths and passphrase instead of hardcoding them in the script.

powershell

# Required parameters for the script
$encryptedFilePath = "C:\Your\Encrypted\File.pgp"
$decryptedFilePath = "C:\Your\Decrypted\File.txt"
$privateKeyPassphrase = "YourSecurePassphrase"
$gpgCommand = "C:\Program Files (x86)\GnuPG\bin\gpg.exe"

# Configure the GPG command
$arguments = "--batch --passphrase `"$privateKeyPassphrase`" --decrypt --output `"$decryptedFilePath`" `"$encryptedFilePath`""

# Execute the command
Start-Process -FilePath $gpgCommand -ArgumentList $arguments -Wait -NoNewWindow

Note: This method requires storing the private key’s passphrase, so you should handle it securely, such as using UiPath Orchestrator Assets.

Option 2: Use a .NET library with the Invoke Code activity

1 Like

Hi @anuradha_puligoti

Could you please let me know what led you to this conclusion? The above-linked component is published on our marketplace, which means it is not supported, but it is marked as compatible with the Windows-type projects in Studio. This means that it should work just fine, at least in theory.


One thing I will leave here for anyone who would like to work with us on this :slight_smile:

We are happy to take a PR on the above repository to add the PGP encryption activities to the official package. We have this on our radar, but there is currently no associated timeline to deliver this capability as an improvement.