Encryption Sha256

Hi Mendix people, I would like to encrypt a variable (string) with sha256 and use the result as a parameter in a REST service call). How can I do that? I tried to store the variable in a hashed entity (after setting the Project settings hash algorithm to sha256). When I debug with a break point and look in the variables view the entity seems hashed okay. But I'm not able to use the entity; cannot select it as a parameter in the REST call, not able to add it to a new variable, not able to add it as a variable in a log message. Any idea how I should do this? Thanks in advance!
1 answers

Hi Diederik,

The community commons libary has this functionality. From the documentation:

*GenerateHMAC_SHA256_hash - Generates a base64 encoded asymmetric hash using the HMAC_SHA256 hash algorithm.

*GenerateHMAC_SHA256 - Generates a hexadecimal encoded asymmetric hash using the HMAC_SHA256 hash algorithm.


The module will provide java actions that will encrypt your string. In the microflow that does the rest call, you can encrypt your string and store in a variable, and then use that variable in the rest call.


Here is a link to the module: