<?php
$json = '{"PublicKey":"<RSAKeyValue><Modulus>wEyodsTjUtDbb8A652Dh/ZPwLoZKAA9N20T5hiUNtGFxnSRWh9xB1WIAwtnz9FDLsT73PiiPyiBLhmI511cyAC+upKqKCtk7OR0fHzlRaH/h7H71X4PAxxes0xYLuEaPwNcanLSB1Tb5e84/JqrZhSqkIxaV5CgNVlRwiU7V5WM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>","PublicKeyExpiration":"2019-12-20T16:49:17","code":0,"msg":"OK","ResponseCode":"","ResponseText":"","timeStamp":"2019-12-10T11:49:17.6372291Z"}';
$response = json_decode($json);


 $signature = md5("5aafc741ff855d9e".strtolower("Tools/SubscriberCampaignActivation"));

        $rsa = new RSA();

		

        $rsa->loadKey($response['PublicKey'], RSA::PUBLIC_FORMAT_XML);

        $ciphertext = $rsa->encrypt($signature);
        $byte_array = unpack('C*', $ciphertext);
        $length = count($byte_array);
//        return $length;
        $i = 0;
        $sb = '';
        foreach ($byte_array as $x) {
            $i++;
//        sb.Append(x);
            $sb .= $x;

            if ($i < $length)
                $sb .= ',';
        }


//        $result = implode(',', $byte_array);
        return $sb;



print_r($response);