How can we use additional encryption that required xml file to encrypt data that will be sent in Action body?

We have this Data Action named "GPF Integration-WSDA002 (VerifyUserID)" that will send API request in form of POST request.

We want to attach Json data within its body with format of:

{
"data": "(its value)"
}

But the value we will put in it will be the one from Input Contract "userid" that will get encrypted by using xml file as reference first. Then encoded with base64 format, before getting use as actual value of data field in Json body.

This is how the encryption with xml file looks like in CS code. The public Key is in the file public_key.xml

byte[] EncryptData(string payload, string publicKeyPath = "public_key.xml")
{
byte[] encryptedData;
using (RSA rsa = RSA.Create())
{
// Load the public key of Service B
string publicKeyXml = File.ReadAllText(publicKeyPath);
rsa.FromXmlString(publicKeyXml);

// Encrypt the data (convert string to byte array first)
byte[] dataToEncrypt = Encoding.UTF8.GetBytes(payload);
encryptedData = rsa.Encrypt(dataToEncrypt, RSAEncryptionPadding.Pkcs1);
}
return encryptedData;
}

This encryptedData will then be encoded as base64 format. Then used as value in Json.

Problem is, how can we correctly do this in Genesys Cloud? Where can we write this encoding that needs xml file as reference for it so we can use this data for integration API?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.