Encryption of Form Fields Elements | Community
Skip to main content
New Participant
June 16, 2023
Solved

Encryption of Form Fields Elements

  • June 16, 2023
  • 1 reply
  • 533 views

Hi All,

 

We have a requirement to encrypt some of the form fields like Credit Card Number and Account Number when submitted over Custom Submit network call.(internalSubmit.jsp) POST call.

 

We are using Custom Submit Action of AEM Forms.

Expectation is that the value of the Credit card number should be encrypted in the Request Body (as part of afdata) when it is send to  internalSubmit.jsp POST call.

 

Can this be done or implemented.

 

 

 

 

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

@sb2512 : 

 

Yes it can be done. You can encrypt any value.

 

1) Open the rule editor of the credit card field . and select the value commit and write the following code . 

var  creditcardNumber = this.value;

 

To encrypt:

var encrypted = CryptoJS.AES.encrypt("creditcardNumber", "Secret Passphrase");

creditcardNumber = encrypted.

 

"Secret Passphrase" : You can give some secretkey here, without this secret key , you cannot decrypt to proper value.

 

To Decrypt:

var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase");

Thanks 

Siva

1 reply

SivakumarKanoori
SivakumarKanooriAccepted solution
New Participant
June 22, 2023

@sb2512 : 

 

Yes it can be done. You can encrypt any value.

 

1) Open the rule editor of the credit card field . and select the value commit and write the following code . 

var  creditcardNumber = this.value;

 

To encrypt:

var encrypted = CryptoJS.AES.encrypt("creditcardNumber", "Secret Passphrase");

creditcardNumber = encrypted.

 

"Secret Passphrase" : You can give some secretkey here, without this secret key , you cannot decrypt to proper value.

 

To Decrypt:

var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase");

Thanks 

Siva

Thanks,Siva