X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4681BD1CA0E for ; Mon, 12 Jan 2004 14:57:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 74756-08 for ; Mon, 12 Jan 2004 10:56:38 -0400 (AST) Received: from neuron.admin.healthnet.lu (drill.healthnet.lu [158.64.36.2]) by svr1.postgresql.org (Postfix) with ESMTP id AB6FBD1B43F for ; Mon, 12 Jan 2004 10:56:33 -0400 (AST) Received: from control.dmz.chl.lu ([10.11.1.10]) by neuron.admin.healthnet.lu (8.9.3/8.8.8) with SMTP id PAA03783 for ; Mon, 12 Jan 2004 15:56:34 +0100 (MET) Received: from 172.20.1.22 by control.dmz.chl.lu (InterScan E-Mail VirusWall NT); Mon, 12 Jan 2004 15:32:10 +0100 Received: from gentoo.domain.local (pret040pcc.inf.chl.lu [172.20.54.4]) by gwia.inf.chl.lu; Mon, 12 Jan 2004 15:35:51 +0100 Date: Mon, 12 Jan 2004 15:35:51 +0100 From: Daniel Struck To: pgsql-php@postgresql.org Subject: Re: pgcrypto & php Message-Id: <20040112153551.0335d931.struck.d@retrovirology.lu> In-Reply-To: <20040112113421.02427893.struck.d@retrovirology.lu> References: <20040112113421.02427893.struck.d@retrovirology.lu> X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/8 X-Sequence-Number: 2524 Finally, it works :-) $crypt=3D$test->result(); echo "
"; echo "crypted content from postgresql: " .$crypt; echo "
"; $crypt=3Dpg_unescape_bytea($crypt); echo $crypt; echo "
"; echo mcrypt_decrypt ( MCRYPT_RIJNDAEL_128 , "fooz", $crypt, cbc); echo "
"; echo mcrypt_cbc (MCRYPT_RIJNDAEL_128, "fooz", $crypt , MCRYPT_DECRYPT); OUTPUT: crypted content from postgresql: g=B0=F1\220399=F9=FB=B9qyg=AE=DB~ g=B0=F1399=F9=FB=B9qyg=AE=DB~ daniel daniel=20 You have to use the function "pg_unescape_bytea();" from PHP when you extra= ct bytea data from postgresql. How stupid of me, should have known that the= bytea data would be escaped ;-) Daniel