I'm sending encrypted data from Flash to PHP using LoadVars. While still in Flash, I'm using the RC4 class of Meychi's ASCrypt package to encrypt said data. The encrypted data is being received by PHP successfully, and my key is correct. I'm having trouble decrypting the data, though. I think the root of my problem comes down to the nature of the arguments (hexadecimal v. binary). After some playing around, I've been able to reproduce ASCrypt's output using PHP's RC4Crypt, but I still can't seem to figure out how to decrypt it.
Here's a PHP script I've made that reproduces the encrypted data coming from Flash. Could anyone show me how to go about decrypting it???
require_once("scripts/rc4crypt.php");
$data = "The secret message is flewdendybewdendybop.";
$key = "1234567890";
$encryptedData = bin2hex(rc4crypt::encrypt($key, $data, 0));
$decryptedData = rc4crypt::decrypt($key, $encryptedData, 0); //<== part that needs fixed
echo "<b>data:</b><br />$data<br /><br />";
echo "<b>key:</b><br />$key<br /><br />";
echo "<b>encryptedData:</b><br />$encryptedData<br /><br />";
echo "<b>decryptedData:</b><br />$decryptedData<br /><br />";
Meychi's ASCrypt
http://www.jek2k.com/wp//wp/wp-content/uploads/2007/05/ascrypt_sample.zip
RC4Crypt
http://sourceforge.net/projects/rc4crypt/