0

I want to send an Email to my salesforce Account and the update Account informations given in the Email. My problem now: The Email is Encrypted. So i wrote an Apex class and now I'm trying to implement the decryption. Before, it already worked sending an Email an creating an test-Task, but now, while trying to decode the Email, i get an Email back with the following

Error: System.SecurityException: update() failed.

(System Code) Class.UpdateLeadsWithHomeReporting.Decrypt: line 27, column 1
             Class.UpdateLeadsWithHomeReporting.handleInboundEmail: line 13, column 1 
11:42:04.102 (102347358)|FATAL_ERROR|System.SecurityException: update() failed

My Code:

    String encodedAesKey = 'mySecretAESKey';
    Blob key = EncodingUtil.base64Decode(encodedAesKey);

    Blob input = Blob.valueof('MyEncryptedString');

    Blob ivBlob = EncodingUtil.convertFromHex('myIVInHex');
    Blob output = Crypto.decrypt('AES256', key, ivBlob , input);

What am I doing wrong? Does anyone know?

  • (System Code) Class.UpdateLeadsWithHomeReporting.Decrypt: line 27, column 1 Class.UpdateLeadsWithHomeReporting.handleInboundEmail: line 13, column 1 11:42:04.102 (102347358)|FATAL_ERROR|System.SecurityException: update() failed. – Lukas Nov 28 '14 at 10:51
0

I now know what my problem was, so I guess that's why the error message was thrown. I forgot to encode my input String from base64, I do it now and everything works perfectly.

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.