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?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x