From: | Daniel Struck <struck(dot)d(at)retrovirology(dot)lu> |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: pgcrypto & php |
Date: | 2004-01-12 14:35:51 |
Message-ID: | 20040112153551.0335d931.struck.d@retrovirology.lu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Finally, it works :-)
$crypt=$test->result();
echo "<br />";
echo "crypted content from postgresql: " .$crypt;
echo "<br />";
$crypt=pg_unescape_bytea($crypt);
echo $crypt;
echo "<br />";
echo mcrypt_decrypt ( MCRYPT_RIJNDAEL_128 , "fooz", $crypt, cbc);
echo "<br />";
echo mcrypt_cbc (MCRYPT_RIJNDAEL_128, "fooz", $crypt , MCRYPT_DECRYPT);
OUTPUT:
crypted content from postgresql: g°ñ\220399ùû¹qyg®Û~
g°ñ399ùû¹qyg®Û~
daniel
daniel
You have to use the function "pg_unescape_bytea();" from PHP when you extract bytea data from postgresql. How stupid of me, should have known that the bytea data would be escaped ;-)
Daniel
From | Date | Subject | |
---|---|---|---|
Next Message | Douglas Douglas | 2004-01-12 22:46:07 | pg_connect socket creation error (0x0000273F) |
Previous Message | Daniel Struck | 2004-01-12 10:34:21 | pgcrypto & php |