I really need help, have spent hours trying to get this working to no avail.
I have data encrypted with AES.
Block size = 128
KeySize = 256
Mode = CBC
Padding = PKCS7
It comes as a POST to my script.
What I have so far is:
$encrypted = $_POST;
foreach ($encrypted as $k => $v) {
$encrypted = trim($k);
}
$myKey = "FKQ5sTfotEDF7W07IpvyPFZ0IXeegs4b";
$myIV = "RFajS7JcDJDuAGAT"
$crypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $myKey, $encrypted , MCRYPT_MODE_CBC, $myIV);
echo $crypttext;
Doesn't work. What am I missing here?
From the way you are calling $_POST
it looks like you want the raw post data. the $_POST
variable contains an array of posted key=>value pairs. You should use
$encrypted = file_get_contents("php://input");
Reference: http://us.php.net/manual/en/wrappers.php.php