You would like to encrypt a string with a keyed-hash authentication code via an ABSL script from your SAP Cloud Applications Studio add-on.
- SAP Cloud Applications Studio
- SAP Business ByDesign
You may achieve this encoding or encryption of a string using ABSL, with the use of Hash.EncryptString() reuse library function, from library PlatinumEngineering.
The encoding alrorighitms "AES128", "AES192", "AES256" are supported.
Please refer to the below sample code which you can try on your script:
var StringToBeEncrypted : XPEString;
StringToBeEncrypted = "test-123";
var Secretkey : XPEString;
Secretkey = "ExactlyThisLeng!" ; // the secretkey must have exactly this length
var EncryptedString = Hash.EncryptString("AES128",StringToBeEncrypted,Secretkey); // "AES128", "AES192", "AES256" can be used
Please be aware that the functions under PlatinumEngineering are internal functions from SAP so they are not revised by the documentation team yet and they are not released for general uses, hence they cannot be supported via incidents.
Please refer to the below blog for more details about the library:
PDI, SDK, hash, EncryptString, PlatinumEngineering, reuse, library , KBA , AP-RC-BDS-SCR , ByDesign Studio Scripting (ABSL) , AP-XPE , Custom Specific Development , How To