I want to encrypt a field value in AEM Forms, How can we encrypt a field in AEM forms | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SivakumarKanoori

@dasarinikhil 

In the rule editor -> value commit event you can use below.

This key can be used to encrypt and decrypt.

var key = "encrypkey";

 

encrypting:

 

var encrypted = CryptoJS.AES.encrypt(value, key);
// console.log("encrypted ==>"+encrypted);

 

decrypting:

var decrypted = CryptoJS.AES.decrypt(encrypted , key);
var decryptedValue = decrypted.toString(CryptoJS.enc.Utf8)

 

hope this helps

Thanks,

Siva

1 reply

SivakumarKanoori
Community Advisor
SivakumarKanooriCommunity AdvisorAccepted solution
Community Advisor
March 9, 2023

@dasarinikhil 

In the rule editor -> value commit event you can use below.

This key can be used to encrypt and decrypt.

var key = "encrypkey";

 

encrypting:

 

var encrypted = CryptoJS.AES.encrypt(value, key);
// console.log("encrypted ==>"+encrypted);

 

decrypting:

var decrypted = CryptoJS.AES.decrypt(encrypted , key);
var decryptedValue = decrypted.toString(CryptoJS.enc.Utf8)

 

hope this helps

Thanks,

Siva

Thanks,Siva
Level 9
November 25, 2024

Hi @sivakumarkanoori  wont the key be visible in js ? And how would we decrypt in Java with this route ?