fork download
  1. <?php
  2. $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"}';
  3. $response = json_decode($json);
  4.  
  5.  
  6. $signature = md5("5aafc741ff855d9e".strtolower("Tools/SubscriberCampaignActivation"));
  7.  
  8. $rsa = new RSA();
  9.  
  10.  
  11.  
  12. $rsa->loadKey($response['PublicKey'], RSA::PUBLIC_FORMAT_XML);
  13.  
  14. $ciphertext = $rsa->encrypt($signature);
  15. $byte_array = unpack('C*', $ciphertext);
  16. $length = count($byte_array);
  17. // return $length;
  18. $i = 0;
  19. $sb = '';
  20. foreach ($byte_array as $x) {
  21. $i++;
  22. // sb.Append(x);
  23. $sb .= $x;
  24.  
  25. if ($i < $length)
  26. $sb .= ',';
  27. }
  28.  
  29.  
  30. // $result = implode(',', $byte_array);
  31. return $sb;
  32.  
  33.  
  34.  
  35. print_r($response);
Runtime error #stdin #stdout #stderr 0.02s 24452KB
stdin
Standard input is empty
stdout
b1b33f289f2fe34e40347341311f1819
stderr
PHP Fatal error:  Uncaught Error: Class 'RSA' not found in /home/htvvOf/prog.php:8
Stack trace:
#0 {main}
  thrown in /home/htvvOf/prog.php on line 8