I am trying to send over an encrypted URL and then decode it at the other end. Now the call I make is passed over but my decryption returns null.
Here's some of my code.
$this->_app_url . '?key=' . $this->_api_key . '&request=' .base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->_api_key, json_encode($url), MCRYPT_MODE_ECB));
The url is just a standard url, the key is a 32bit string so you can imagine it as anything. The $url variable is an array of stuff to be sent over. So that when I decrypt I have that array outright.
So at the other end I am trying to decode:
$key = $_REQUEST["key"];
$encrypted = $_REQUEST["request"];
$decrypted = json_decode(rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($encrypted), MCRYPT_MODE_ECB)));
This simply returns NULL
, I can echo out the key and request and I get what i'm expecting but I just can't decrypt it.