Storing encrypted data?

From: John Tregea <john(at)debraneys(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Storing encrypted data?
Date: 2006-07-17 01:11:12
Message-ID: 44BAE3B0.8060403@debraneys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)ûñÙÁl£ðOE(dot)(dot)(dot)¢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(at)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2006-07-17 03:07:05 Re: Storing encrypted data?
Previous Message Nate Teller 2006-07-17 01:09:48 Re: How to find entries missing in 2nd table?