function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pranjal GawaiPranjal Gawai 

Decryption of cipher text encrypted by AES(128) bit , ECB mode alogithm in Salesforce

I am aware that SFDC supports decryption using AES(128 bit) using CBC mode. But I have a requirement where I need to decrypt a cipher text encrypted using AES(128 bit) ECB mode.

One way of doing this is using Javascript. But this approach presents issues on security front.

Is there some other way to accomplish the same?
KevinPKevinP
ECB is less secure than CBC, so I doubt that Salesforce supports decryption of ECB in Apex.

While you could do it in Javascript, I think a more complex, but more secure solution would be to call out to a custom Heroku service that decrypts the ECB to plaintext, then returns a CBC encrypted block for decryption in apex. 
Mikaël JaffréMikaël Jaffré
Hi,
My client asks me to use AES ECB PKCS5 128 encrypting method. I found a way to do it via JavaScript but that can presents some security issues.

Unfortunately, ECB mode is not supported in Salesforce (only CBC). I would like to find a way to do it in Apex. Maybe is there any solutions on AppExchange?

Thanks,
​​​​​​​Mik Jaf