Create buffer with binary data.
From base64 encoded string:
new Buffer(b64str, "base64");
Original Message:
Sent: Wed January 31, 2024 10:13 AM
From: R K
Subject: Symmetric Encryption in Gateway script
Dear Hermann,
Is there any way to save the hex or base 64 string and save the file in .key to refer as Sharedsecret key. ?
------------------------------
R K
Original Message:
Sent: Wed January 31, 2024 07:47 AM
From: Hermann Stamm-Wilbrandt
Subject: Symmetric Encryption in Gateway script
You need to store binary data in the key file.
The data from buffer or buffers structure:
https://www.ibm.com/docs/en/datapower-gateway/10.0.1?topic=gatewayscript-key-object-usage
If you store hex string, they key file has twice the size needed.
------------------------------
Hermann Stamm-Wilbrandt
Compiler Level 3 support, IBM DataPower Gateways
IBM
Boeblingen Germany
Original Message:
Sent: Tue January 30, 2024 10:43 AM
From: R K
Subject: Symmetric Encryption in Gateway script
I am trying to use symmetric encryption using a shared secret key. Whenever I am saving the hex string directly in stylesheet parameter, it is working.
However, when I am storing the string in a .key file and creating shared secret key object, I am receiving error saying that key length is not matching with algorithm.
I am using createcipherIv function available in crypto module of Gateway script. Please let me know how can we store the Hex string in key file and refer the same shared secret key in GW script.
------------------------------
R K
------------------------------