Question


Boubyan
KW
Last activity: 21 Dec 2017 5:04 EST
Encrypt / Decrypt a single value
Dear all
I have a requirement to encrypt a property and decrypted again in another section.
Please help??
Thanks in advance
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution


Aaseya IT Services Pvt Ltd
KW
We have figured the way to decrypt the same with the help of Utilities.decryptPW() OOTB function passing the encrypted property as param.
This perfectly decrypts any value encrypted by the function tools.getPRCrypto().encrypt(theValue) which you have specified from inside edit input
Appreciate the support
Thanks


Pegasystems Inc.
US
Hi Loay,
You can have a look into EncryptTextPropertyValue Edit Input rule and ShowTextEncryptedPropertyValue control which might help you.
Regards
Mahesh


Boubyan
KW
thanks Mahesh_Midthuru
but how to decrypt the value


EPAM Systems, Inc.
ES
Hi LoayA,
Adding to my colleague's suggestion, refer this. :- https://community.pega.com/sites/default/files/help_v72/procomhelpmain.htm for implementation and usage details.
Hope it helps you in implementation.
Regards,
Asif


EPAM Systems, Inc.
ES
Adding to the previous comment, I ain't sure below link is what you are looking at:-
Hope it helps please notify.


Pegasystems Inc.
US
@LoayA700 actually i found the methods for encryption/decryption in the Public API as follows,
tools.getPRCrypto().encrypt(value);
tools.getPRCrypto().decrypt(value);
May be you can try with these methods which might help you.


Pegasystems Inc.
US
1. If you are using site cipher mechanism then EncryptTextPropertyValue Edit Input rule to perform encryption and ShowTextEncryptedPropertyValue control can be used to perform the decryption of the property value to be displayed in UI.
2. If you are not using site cipher mechanism then you can write an Edit Input rule with below code for encryption,
tools.getPRCrypto().encrypt(value);
For decryption of the property in the UI you can write a custom control with the help of ShowTextEncryptedPropertyValue control to decrypt the property value and display it in UI with the help of below code,
tools.getPRCrypto().decrypt(value);
Hope this approaches might help you to achieve your requirement.


Boubyan
KW
We are not using any Cipher and we followed your second approach.
Good thing is that the encryption is working fine with the edit input and the function-tools.getPRCrypto().encrypt(value);
But it is not getting decrypted with the function-tools.getPRCrypto().decrypt(value);. We have tried with writing controls, funtions.
We have also tried calling the decrypt function from another edit input(pass the encrypted value in property) just to make sure if the function was working fine or not.
EG: we tried decrypting this value for an instance {pr}ZFEKxj5VsPhOPqBZJfg5Rel8ll1bnD1xta/MFSpRVhE=, and it was not working.
Thanks


Pegasystems Inc.
US
@LoayA700 i had not tried this at my end to confirm you regarding this query, by looking into the Public API i found these two methods and suggested you. As per the Public API if encrypt method is working fine then decrypt should also work as expected.
Accepted Solution


Aaseya IT Services Pvt Ltd
KW
We have figured the way to decrypt the same with the help of Utilities.decryptPW() OOTB function passing the encrypted property as param.
This perfectly decrypts any value encrypted by the function tools.getPRCrypto().encrypt(theValue) which you have specified from inside edit input
Appreciate the support
Thanks
-
odelu mothukuri


Pegasystems Inc.
US
Good to see that you have achieved your requirement with this function and thanks for sharing this information to us.