Support Article

Base64Encode and Base64Decode are not inverse functions

SA-78788

Summary



The @Base64Decode(@Base64Encode(param.inputStr)) returns null for a string in the attachment.


Error Messages



Not Applicable


Steps to Reproduce

  1. Use the attached document to obtain the string.
  2. Execute a  simple activity with Encode-Decode.


Root Cause



A defect in Pegasystems’ code or rules: Pega's Base64 API.


Resolution



Perform the folloiwng local-change:

Use java.util.Base64 library in the Rule Utility Functions (RUF) instead of Pega's Base64.

For Encoding - new String(java.util.Base64.getEncoder().encode(nonFormatted.getBytes()))
For Decoding - new String(java.util.Base64.getDecoder().decode(encodedString.getBytes()))

 

Suggest Edit

Published April 30, 2019 - Updated September 9, 2019

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.