4

I read elsewhere in StackExchange that it's not possible to decrypt AES strings originating from AMPScript in PHP. Is this true? It seems that it should be possible with mcrypt.

Also, part two for this question... if AES isn't possible, then should we go with DES or TripleDES? We need to be able to decrypt data generated in ExactTarget's EncryptSymmetric() function in a clients's PHP environment.

  • This is on topic as it pertains to ExactTarget. – Kelly J Andrews Jun 4 '14 at 22:24
  • @those who vote to close, can you at least leave a comment ? – Samuel De Rycke Jun 7 '14 at 16:48
  • any luck with this? – dchayka Mar 14 '16 at 16:38
1

I was able to get it to work with DES Still working on AES.

Use the example on the documentation for DES https://code.exacttarget.com/content-scripting/ampscript/encryption/EncryptSymmetric.html

Then use functions like like these

function decryptEtDES($key,$string)
{
    $string = base64_decode(str_replace(' ', "+", $string));
    $rtn = mcrypt_decrypt(MCRYPT_DES, $key, $string, MCRYPT_MODE_ECB);
    $rtn = rtrim($rtn, "\0\4");
    return($rtn);
}

function encryptEtDES($key,$string)
{
    $rtn = mcrypt_encrypt(MCRYPT_DES, $key, $string, MCRYPT_MODE_ECB);
    $rtn = base64_encode($rtn);
    return($rtn);
}
0

Each individual algorithm is slightly unique between programming language, and ExactTarget's is based on C#.

In order to use PHP, you would need to recreate the algorithm that C# uses in PHP.

The simplest way to overcome this would be to create a landing page that uses AMPscript and pass the data to the page to be encrypted/decrypted.

  • Thanks Kelly. What about just using DES instead, though? It's early enough in the process that we could try something like that. – James Jun 4 '14 at 22:30
  • I've not gotten it to work in any method, but this makes me want to attempt again just to make sure. – Kelly J Andrews Jun 4 '14 at 22:43
  • This page seems to give me some hope, but not able to reproduce from exact target yet. stackoverflow.com/questions/6130989/… – James Jun 6 '14 at 20:08
  • @KellyJAndrews were you able to create a PHP script to decrypt C#'s encryption from ExactTarget's side? – dchayka Mar 14 '16 at 16:54
  • @dchayka not successfully, no – Kelly J Andrews Mar 14 '16 at 17:15

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.