X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 48DB59F9F27 for ; Sun, 16 Jul 2006 22:11:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 04703-02 for ; Sun, 16 Jul 2006 22:11:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgate1.pacific.net.sg (smtpgate1.pacific.net.sg [203.120.90.31]) by postgresql.org (Postfix) with SMTP id 18EEF9F9840 for ; Sun, 16 Jul 2006 22:11:16 -0300 (ADT) Received: (qmail 20798 invoked from network); 17 Jul 2006 01:11:13 -0000 Received: from ppp235.dyn73.pacific.net.sg (HELO ?127.0.0.1?) (debraneys@210.24.73.235) by smtpgate1.pacific.net.sg with (DHE-RSA-AES256-SHA encrypted) ESMTPA; 17 Jul 2006 01:11:11 -0000 Message-ID: <44BAE3B0.8060403@debraneys.com> Date: Mon, 17 Jul 2006 09:11:12 +0800 From: John Tregea User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Storing encrypted data? References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------050701050608010402000602" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.097 tagged_above=0 required=5 tests=AWL, BAYES_50, HTML_40_50, HTML_MESSAGE, OBSCURED_EMAIL X-Spam-Level: X-Archive-Number: 200607/222 X-Sequence-Number: 25796 This is a multi-part message in MIME format. --------------050701050608010402000602 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi, Does anyone have experience with storing encrypted data into pgSQL? I have a pgSQL database which uses UTF8 encoding. I am encrypting plain text in my (GUI) application and sending it to a field (with data type 'text') in my database. I get an error back saying "invalid byte sequence for encoding UTF8; oxd733" I am using blowfish at 128bit to encrypt the string. The encrypted string comes out looking like this Salted__ë±9r^(TM)LZPÃOG¤u--¨ékTz~6Ëpi^(TM)|O +Lϰ îX@ûñÙÁl£ðOE...¢53P9×ð"á6kUÆ¢÷ÍìMNÉA.---ä![^j"Ø|¨\X--ÛÜu?ªÅÜ-ÎáBæºñȦbF >\Z(v/ÞÎ.&ó«[=bný?Kr°óË2U×ZI©âVc°sn=¤Õg«^q0Ã8ý<Êh?;"¨"?[S(ç+u[£ --è---='±ú3³?ì¯,Za@LU'T¸oeÖgoeË?PÛ<...H---8ÃbÙÉZ(NÙí>ÇL]í¶²--âOEÿ/Ínz¶å Õ?Îcµ^$í¿W-^(TM)óà¢ey÷àÞ¬oe¤CðÏjX"ÃGÄ"·º?ë0L'Ù++Æz(<&^{ªìëá/Ç}k9?ÄX1â<²T½Hõ5Ôgÿ§yÈy..._---ú$lA~©î1úëùññðÑÝS(z(gÕþÊ/«¦...8?¯þ >ü,fEUR--aÈÉ"iG0/00}¹²#À I enclose that in single quotes and send it in an insert statement to pgSQL. The statement has been working, until I got to a string that generated the above encrypted data, then it broke. Alternatively, can anyone suggest an encryption algorithm that will only return characters that are valid UTF8 encoded? Thanks in advance John T --------------050701050608010402000602 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi,

Does anyone have experience with storing encrypted data into pgSQL? I have a pgSQL database which uses UTF8 encoding. I am encrypting plain text in my (GUI) application and sending it to a field (with data type 'text') in my database.

I get an error back saying "invalid byte sequence for encoding UTF8; oxd733"

I am using blowfish at 128bit to encrypt the string.

The encrypted string comes out looking like this

Salted__ë±9r™LZPÃOG¤u–¨ékTz~6Ëpi™|O +Lϰ‹r°ô9•mµ�á%€©õP{:‚Àªd
îX@ûñÙÁl£ðŒ…¢53P9×ð“á6kUÆ¢÷ÍìMNÉA•—ä![ˆj”Ø|¨\X–ÛÜu�ªÅÜ-ÎáBæºñȦbF >\Žv/ÞÎ.&ó«[=bný�Kr°óË2U×ZI©âVc°sn=¤Õg«^q0Ã8ý<Êh�;”¨"�[Šç+u[£    –è—=‘±ú3³�ì¯,Za@LU‘T¸œÖgœËPÛ<…H—8ÃbÙÉŽNÙí>ÇL]í¶²–âŒÿ/Ínz¶å
Õ?Îcµˆ$í¿W-™óà¢ey÷àÞ¬œ¤CðÏjX”ÃGÄ„·º?ë0L‘هƞ‹&ˆ{ªìëá/Ç}k9?ÄX1⋲T½Hõ5Ôgÿ§yÈy…_—ú$lA~©î1úëùññðÑÝŠžgÕþÊ/«¦…8�¯þ    >ü‚ƒ€–aÈÉ„iG‰}¹²#À


I enclose that in single quotes and send it in an insert statement to pgSQL.

The statement has been working, until I got to a string that generated the above encrypted data, then it broke.

Alternatively, can anyone suggest an encryption algorithm that will only return characters that are valid UTF8 encoded?

Thanks in advance

John T


--------------050701050608010402000602--