PGP Encryption in Apex

We have a use case in which we need to be able to perform PGP encryption on a piece of data, natively in Salesforce in Apex code. Does anyone know if there is an open source Apex project or a managed package that offers an Apex API that does PGP encryption?


I’ve never seen one, and I think you will probably have a tough time implementing PGP support natively in Apex. The Crypto API only supports symmetric encryption using AES, and unless I’m forgetting something, PGP needs both symmetric and asymmetric encryption using a couple algorithms. Unless there is some incarnation of PGP you can use that only needs AES encryption, you’d have to implement your own implementation of one of the asymmetric algorithms from scratch, which is going to be difficult-to-impossible using Apex since Apex has basically non-existent support for byte array manipulation.

Your best bet would be to set up a secure web service for doing PGP encryption and call that from Apex. There are numerous good open source PGP implementations in all the major languages.

Source : Link , Question Author : bobbyt , Answer Author : jkraybill

Leave a Comment