PGP Encryption of documents in Pega - Solution

Hi @jwalak58

We have implemented this solution in cloud infrastructure only.

@Arun Sankar J

Hi Arun,

have you created function with code written in Pega Java Code.txt file. and call that function in your activity.

@GuhanathanV4521 Hi Guhan, Which version of Pega have you implemented? I tried in 24.2.2 and the product documentation says it does not support additional version of bouncycastle jar cannot be imported. Also was it on pegacloud, if so how did you mention the public/private key path?

I tried to rebuild the same using the latest version of jar and converted the filepath to use file content.

@VishantC I’m also getting the FileNotFoundException , I don’t find an issue with the location, I’m using the pega cloud repository and the same file location is working with the data sets. anything else which you feel could be the issue?

Error encrypting/decrypting filejava.io.FileNotFoundException: file:/pegacloudfilestorage:/sftp/outbound/mandatorycommsfile_PR30003_2025-05-19_063301-pegacdhuniversal66bfc9f68bnm6x80301747636388308 (No such file or directory)

@VishantC , @DileepBalaga , I can only see below error.No additional error in logs

Error encrypting/decrypting filejava.io.FileNotFoundException: file:/web:/StaticContent/global/ServiceExport/test.txt

@VishantC Hi VishantC, Could you please explain what will be the expected input and output ? what we need to send in input and what will be the output? we have a requirement to do the pgp encryption before sending it to SFTP from cloud repository. Will the solution works for this scenario and will this work for the files which are in repository ?

@VishantC

Yes…Created function

Installed bcprov-jdk18on-1.80.jar in Tomcat, now its working fine

Hi @VishantC,

I already have the jar installed in the server which Arun mentioned in his post.

@Harshil8888

Hi, Any luck with the above error. I am also facing same issue with 24.2.2 Version. Any suggesstion would help.

@jwalak58 Please check the file location properly. it seems like issue with the location of input file.

@VishantC Hi, I am doing pgp decryption on my Pega Cloud 3 (Pega 25) . I imported your jar file and created function successfully but it failed at runtime, So I imported bcprov-jdk18on-1.83.jar and bcutil-jdk18on-1.83.jar but still failed as below. Do you have any idea?

java.lang.NoSuchFieldError: Class org.bouncycastle.asn1.nist.NISTObjectIdentifiers does not have member field 'org.bouncycastle.asn1.ASN1ObjectIdentifier id_Kmac128'