pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Tregea <john@debraneys.com>
To: pgsql-sql@postgresql.org
Subject: Storing encrypted data?
Date: Mon, 17 Jul 2006 09:11:12 +0800
Message-ID: <44BAE3B0.8060403@debraneys.com> (raw)
In-Reply-To: <A70AE049E81A6A40879D5DC0AC8C38C9069508ED@venus.infics.com>
References: <A70AE049E81A6A40879D5DC0AC8C38C9069508ED@venus.infics.com>

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

view thread (8+ messages)  latest in thread

Message-ID: <44BAE3B0.8060403@debraneys.com>
Permalink:  ../44BAE3B0.8060403@debraneys.com/
Also on:    postgresql.org/message-id/44BAE3B0.8060403@debraneys.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: john@debraneys.com
  Subject: Re: Storing encrypted data?
  In-Reply-To: <44BAE3B0.8060403@debraneys.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox