Hi All,
I'm trying to implement encryption to protect data in my database. I
started by experimenting with the following code, just to make sure I
know how to encrypt and then decrypt but for some reaqson when I add
the line "$plaintext = mcrypt_decrypt( ..." etc Apache crashes.
I'm using:
- PHP 4.3.2
- Apache 1.3.24
- Windows XP
Following is an except of my code:
$myqs=mysql_que ry($myq);
$iv_size = mcrypt_get_iv_s ize(MCRYPT_RIJN DAEL_256, MCRYPT_MODE_ECB );
$iv = mcrypt_create_i v($iv_size, MCRYPT_RAND);
$key = "This is a very secret key";
while ($myqr = mysql_fetch_arr ay($myqs)){
$text = $myqr["entry"];
$crypttext = mcrypt_encrypt( MCRYPT_RIJNDAEL _256, $key, $text,
MCRYPT_MODE_ECB , $iv);
$plaintext = mcrypt_decrypt( MCRYPT_RIJNDAEL _256, $key,
$crypttext, MCRYPT_MODE_ECB );
echo $plaintext."<p> ";
}
If I remove the line "$plaintext = mcrypt_decrypt( .." Apache doesn't
crash.
Anyone have any idea why this might be crashing?
Many thanks in advance!
Much warmth,
Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.