PGP Decryption in Pega 25.1

Hi ,
We are trying to Decrypt the file from SFTP file path using File Listner and there are no OTB functions availble , hence we write a custom java code which is working fine in 24.2 but not in 25.1

If any one achived in 25.1 please do let us know the steps, I have attached the sample java code which is working in 24.2
All the PGP jars ar einplace and there are no compile time issues

Error Iam geteting

**File decryption failed, error generated:Invalid UTF-8 input and teh ObjectFactory object is getting empty**

Thanks in Advance.

DecryptSample.txt (5.69 KB)

The issue is in the way the private key and PGP objects are being created in your code. In Pega 25.1, you should treat the key and encrypted content as raw binary data, not as UTF-8 text, because converting the decoded private key back through getBytes(UTF_8) can corrupt it and cause the Invalid UTF-8 input error. Change the private key handling so the Base64 value is decoded directly into a byte[], then pass that byte array into ByteArrayInputStream, and create PGPObjectFactory with new JcaKeyFingerprintCalculator() instead of null. That keeps the decryption flow binary-safe and lets ObjectFactory read the PGP packet correctly. Once you remove the string-based conversion and use the proper fingerprint calculator, the same decryption logic should work in 25.1 as well.