2

I am currently working on a requirement where I am developing Apex REST callouts to an external data providers. Here the complexity lies within the encryption/decryption methods that they are using: Java 8 libraries.

Are there any ways we can encrypt/decrypt the request/response using their AES-GCM (A256GCM) algorithm (i.e. JCA: AES/GCM/NoPadding) in our Apex? I have tried our Apex Crypto Class methods, but that didn't really helped. If anyone have done/know something like this, can I get some insights of how to do it? Any references, articles or examples would be really appreciated.

1 Answer 1

5

I don't think you'll be able to do this in Apex.

Crypto is documented to use only CBC mode:

These algorithms are all industry standard Advanced Encryption Standard (AES) algorithms with different size keys. They use cipher block chaining (CBC) and PKCS5 padding.

Even though Apex does support AES-256, you won't be able to do any reasonable implementation of GCM mode in pure Apex, and it's not supported by the standard library. You might look at a connector on Heroku or something to decrypt the remote data and provide it in a format Apex can handle.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .