We want to encrypt / encode URL parameters on our pages. I tried to encrypt a parameter using EncryptSymmetric() with AES algorithm as explained in the documentation

%%[SET @encData=EncryptSymmetric("test", "AES", @null, "1111", @null, "0000000000000000", @null, "00000000000000000000000000000000")
AES: %%=v(@encData)=%%

The result of this function is


Then I tried to decrypt the value using an online tool, but I always received an error message.

I suppose there is a difference between AES algorithm in Marketing Cloud and AES used in the online tool. Indeed if I encrypt the same word with an online tool (128-bit), I received this result


Do you have any deep information regarding this function? What could be the difference?

  • 1
    There are only certain types of SFMC encryption that you can decrypt outside of the platform. – Adam Spriggs Jan 26 '17 at 17:05
  • Can you please elaborate on this? Struggling with AES in the Marketing cloud as well right now. – Alex Mar 20 '17 at 23:31
  • Struggling with this as well but need to decrypt the string in C#. Anyone was able to accomplish that? – Azimuth Apr 30 '20 at 16:20

I have decrypted SFMC encrypted strings in C# outside of the platform. Credit for the method goes to Pato Sapir on Github for his et-encrypt-decrypt solution.

You should be able to decrypt the string outside of the platform with the code referenced above if you use parameters like this in your AMPScript:


Also...props to @brandt for his answer, which is what lead me to psapir's solution:

DecryptSymmetric with tripe DES errors

  • Thanks @Adam for the answer. However i would use the same algorythm used in Salesforce (where i have AES128, 192 and 256). But there is no matching with that used in Marketing Cloud. – cmbob Jan 27 '17 at 15:38
  • @robertc SFMC is fussy about algorithms and particularly around padding, salt and Iv lengths, so you'll need get SF CRM to fit in around it, rather than the other way around. – Macca Jan 31 '17 at 9:03
  • 1
    Just saw this. Thanks @Adam and Eliot for noticing the post. more info here: devsutd.com/encryption-and-decryption-with-ampscript – patosapir Feb 23 '17 at 21:44

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.