1

We want to encrypt a text in Apex using provided key having 48 bytes.

Text = 'some xml';

Key = 'TEXT_KEY_REMOVED';

How can we encrypt the text using the provided key? Salesforce supports AES128, AES192, AES256 algorithms for 16, 24, or 32 bytes respectively. But the private key which I have has 48 bytes and there is no equivalent algorithm in Salesforce for 48 bytes key. Would you please suggest me any workaround?

  • You need to find out exactly how the encryption is implemented on the other side of this integration. The key you provided (which I edited out; never include secret values here!) appears to be plain text rather than a hexadecimal representation. This makes me think it's likely being hashed to a different key size. AES is only defined for 128, 192, and 256-bit keys. – David Reed Mar 1 '18 at 13:59
  • @David, Thanks, The key which I mentioned is not the genuine. The other side of the integration system will use 3DES to decrypt. Does salesfroce support 3DES? Thanks! – user755806 Mar 1 '18 at 14:31
2

Salesforce does not support 3DES. The only supported encryption algorithms in the Apex Crypto class are AES128, AES192, or AES256. An exception will be thrown if any algorithm value other than those three is provided.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.