Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AES CBC encryption

Avatar

Level 2

Hi

 

I need to implement a crypting function which will use "encryption_aescbcEncrypt" 

It's the first time I implement it so i'm a bite lost of how to done it in the console.

Could you please help me with the code i need to use ? I've already the Key but i don't know if i must create a JS Code and call the parameter in the delivery in order to encrypt the information I want.

 

Any help would be appreciated

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Lise,

 

The crypt function is the one to go in ACC and the documentaiton provided is correct

https://experienceleague.adobe.com/developer/campaign-api/api/f-cryptString.html

Calling JS in the HTML has its own syntax and I suspect that's what you're facing. Could you do the following test if not alredy done

If a workflow: use a JS Code activity and place the following code and you'll have a result

denisb91363072_0-1641467914676.png

 

Then in the HTML the way to call a JS function is Adobe specific using <% %> element

At the top of the delivery, put the following

 

<% include(put the JS library internal name where you have created the wallet function);
var cryptParams = WalletEncryption(targetData.LOYALTYCARDNUMBER)
%>
Then you will have yout HTML body as expected and if you want to print the value of the variable cryptParams you use the following
<%= cryptParams %>

That should work.

Thanks

Denis

View solution in original post

7 Replies

Avatar

Level 2

Thanks David

 

But it not help me. We have developped a js code and on our html we have call the function but i get an error each time i test it.

 

Here is our code:

function WalletEncryption(CarteFid)
{
// Initialisation des paramètres de cryptage
var key = "xxxxx";

// Cryptage des paramètres données
var cryptParams = cryptString(CarteFid, key);

return cryptParams;
}

 

And what we have added on our html:

 

eval(yr_gene:WalletEncryption.js.data);


var cryptParams =  cryptString(targetData.LOYALTYCARDNUMBER, key);

 

Avatar

Level 2

hi David,

 

Your document are related to ACS not ACC .

So is there any people who could help me or who have already implemented an AEC CBC encryption ?

 

Rgds

Avatar

Correct answer by
Employee Advisor

Hi Lise,

 

The crypt function is the one to go in ACC and the documentaiton provided is correct

https://experienceleague.adobe.com/developer/campaign-api/api/f-cryptString.html

Calling JS in the HTML has its own syntax and I suspect that's what you're facing. Could you do the following test if not alredy done

If a workflow: use a JS Code activity and place the following code and you'll have a result

denisb91363072_0-1641467914676.png

 

Then in the HTML the way to call a JS function is Adobe specific using <% %> element

At the top of the delivery, put the following

 

<% include(put the JS library internal name where you have created the wallet function);
var cryptParams = WalletEncryption(targetData.LOYALTYCARDNUMBER)
%>
Then you will have yout HTML body as expected and if you want to print the value of the variable cryptParams you use the following
<%= cryptParams %>

That should work.

Thanks

Denis

Avatar

Level 2

Hi Denis

 

Thanks for your help but is there is a need to convert the key in base 64 ?

 

Because the conversion is not working properly we have a redirection from our NL to Wallet and the cryted parameters seems to be not the right one.

 

Thanks

Avatar

Employee Advisor

Hi Lise,

You might want to try to use the MemoryBuffer class which allow to convert into base64

You would

  • Load the key in the memory buffer  (FromString)
  • Convert into base64 (toBase64)
  • Dispose the memory buffer (dispose)

DO NOT FORGET to invoke the "dispose" function otherwise you will never release resources (memory) and you will jam your instance up to a point it crashes

https://experienceleague.adobe.com/developer/campaign-api/api/c-MemoryBuffer.html

 

It might work,

Thanks

Denis