php - API encrypting url and can't decrypt with mcrypt as it returns null -


i trying send on encrypted url , decode @ other end. call make passed on decryption returns null.

here's of 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 standard url, key 32bit string can imagine anything. $url variable array of stuff sent over. when decrypt have array outright.

so @ other end trying decode:

$key = $_request["key"]; $encrypted = $_request["request"];  $decrypted = json_decode(rtrim(mcrypt_decrypt(mcrypt_rijndael_256, $key, base64_decode($encrypted), mcrypt_mode_ecb))); 

this returns null, can echo out key , request , i'm expecting can't decrypt it.


Comments