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
Mikaël JaffréMikaël Jaffré 

How to encrypt using AES ECB PKCS5 in Apex?

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

Deepali KulshresthaDeepali Kulshrestha
Hi Mikael,

Please refer link below for more information.
https://developer.salesforce.com/forums/?id=906F000000091rFIAQ
https://salesforce.stackexchange.com/questions/57896/aes-decyption-with-pkcs7-padding
https://salesforce.stackexchange.com/questions/198825/how-to-decrpt-the-mcrypt-rijndael-256-encrypted-value-in-salesforce

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.
Deepali Kulshrestha