Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AE7D437C6E4 for ; Fri, 10 Oct 2008 12:32:36 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 29468-01 for ; Fri, 10 Oct 2008 12:32:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from bay0-omc2-s17.bay0.hotmail.com (bay0-omc2-s17.bay0.hotmail.com [65.54.246.153]) by postgresql.org (Postfix) with ESMTP id B62BC37C6E0 for ; Fri, 10 Oct 2008 12:32:32 -0300 (ADT) Received: from hotmail.com ([65.54.162.79]) by bay0-omc2-s17.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 10 Oct 2008 08:32:31 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 10 Oct 2008 08:32:30 -0700 Message-ID: Received: from 190.3.112.90 by BAY108-DAV7.phx.gbl with DAV; Fri, 10 Oct 2008 15:32:28 +0000 X-Originating-IP: [190.3.112.90] X-Originating-Email: [elmarkivo@hotmail.com] X-Sender: elmarkivo@hotmail.com From: "elmarkivp" To: Subject: store data files encryptypted in database. Date: Fri, 10 Oct 2008 12:32:28 -0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0003_01C92AD4.42102F00" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 10 Oct 2008 15:32:30.0888 (UTC) FILETIME=[68B1FA80:01C92AED] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200810/1 X-Sequence-Number: 3898 This is a multi-part message in MIME format. ------=_NextPart_000_0003_01C92AD4.42102F00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable hi, i'm trying to store data files encryptypted in postgres 8.1 database = but i can`t make it works. this is what i'm doing. $link =3D pg_connect("host=3D$dbhost user=3D$dbuser password=3D$dbpwd = dbname=3D$dbname") or die(pg_last_error($link)); $fp =3D fopen($tmp_name, "rb"); $file=3D fread($fp, filesize($tmp_name)); fclose($fp); $file=3Dpg_escape_bytea($file); $sql =3D "INSERT INTO SOME_TABLE (bytea_file) VALUES = (pgp_sym_decrypt_bytea($file,somepass,cipher-algo=3Daes256))"; =20 pg_query($link, $sql) or die(pg_last_error($link)); this error appear... ERROR: column "content_of_bytea_file" does not exist ( = "content_of_bytea_file" is $file) it seems that whant to the $file be a column ... but thats not what the = documentation says... F.20.3.2. pgp_sym_decrypt() pgp_sym_decrypt(msg bytea, psw text [, options text ]) returns text pgp_sym_decrypt_bytea(msg bytea, psw text [, options text ]) returns = bytea Decrypt a symmetric-key-encrypted PGP message.=20 Decrypting bytea data with pgp_sym_decrypt is disallowed. This is to = avoid outputting invalid character data. Decrypting originally textual = data with pgp_sym_decrypt_bytea is fine.=20 The options parameter can contain option settings, as described below.=20 F.20.3.7. Options for PGP functions Options are named to be similar to GnuPG. An option's value should be = given after an equal sign; separate options from each other with commas. = For example:=20 pgp_sym_encrypt(data, psw, 'compress-algo=3D1, = cipher-algo=3Daes256') All of the options except convert-crlf apply only to encrypt = functions. Decrypt functions get the parameters from the PGP data.=20 The most interesting options are probably compress-algo and = unicode-mode. The rest should have reasonable defaults.=20 thanks ------=_NextPart_000_0003_01C92AD4.42102F00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
hi, i'm trying to store data files = encryptypted in=20 postgres 8.1 database but i can`t make it works.
this is what i'm doing.
 
$link =3D pg_connect("host=3D$dbhost = user=3D$dbuser=20 password=3D$dbpwd dbname=3D$dbname") or = die(pg_last_error($link));
$fp =3D fopen($tmp_name, = "rb");
$file=3D fread($fp,=20 filesize($tmp_name));
fclose($fp);
$file=3Dpg_escape_bytea($file);
$sql =3D "INSERT INTO SOME_TABLE=20 (bytea_file)  VALUES=20 (pgp_sym_decrypt_bytea($file,somepass,cipher-algo=3Daes256))";  = ;    =20
pg_query($link, $sql) or=20 die(pg_last_error($link));
 
this error appear...
 
ERROR: column "content_of_bytea_file" does not=20 exist     ( "content_of_bytea_file" is $file)
 
it seems that whant to = the $file be a=20 column ... but thats not what the documentation says...
 
 

F.20.3.2. pgp_sym_decrypt()

 =
  pgp_sym_decrypt(msg bytea, psw text [, options text ]) returns text
   pgp_sym_decrypt_bytea(msg bytea, psw text [, options text ]) returns =
bytea
 

Decrypt a symmetric-key-encrypted PGP message.

Decrypting bytea data with pgp_sym_decrypt is=20 disallowed. This is to avoid outputting invalid character data. = Decrypting=20 originally textual data with pgp_sym_decrypt_bytea=20 is fine.

The options parameter can contain option = settings,=20 as described below.

 

F.20.3.7. Options for PGP = functions

Options are named to be similar to GnuPG. An option's value should be = given=20 after an equal sign; separate options from each other with commas. For = example:=20

    pgp_sym_encrypt(data, psw, =
'compress-algo=3D1, cipher-algo=3Daes256')
   

All of the options except convert-crlf apply = only to=20 encrypt functions. Decrypt functions get the parameters from the PGP = data.

The most interesting options are probably compress-algo and unicode-mode. The=20 rest should have reasonable defaults.

 

thanks

------=_NextPart_000_0003_01C92AD4.42102F00--