Expand my Community achievements bar.

SOLVED

Encryption of Form Fields Elements

Avatar

Level 3

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.

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@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