Re: Storing encrypted data in a database with
| From: | Evan Nemerson | Date: | Tue, 23 Mar 2004 22:52:10 +0000 |
| Subject: | Re: Storing encrypted data in a database with | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181327@lists.php.net to get a copy of this message | ||
What version of mysql are you using? IIRC, there is support for AES in newer
(4+?) versions. If I were you, I'd handle are the encryption and decryption
in the database, if possible.
Yep, http://www.mysql.com/doc/en/Encryption_functions.html
On Tuesday 23 March 2004 02:04 pm, Jay Blanchard wrote:
> Good afternoon!
>
> I am storing some encrypted data using PHP to do the encryption and a MySQL
> database. I have encountered a couple of times where I get back a query
> sytax error.
>
> INSERT INTO
test.tblEncTest
> (encAlg, encMode,
> encIV, reqName,
> reqSSN, reqEMail) VALUES (
> 'blowfish', 'cbc', '–3I®¼}ñÀ', 'Î ÑpÎ_9',
> '‘ˆký¬fè×?Q½þgÖ·', '-›%·+AœêR'—HX‹ýÚÈppT
> Äþì7 GH©ŽŒÕõý' )
>
> You have an error in your SQL syntax near 'HX‹ýÚÈppT Äþì7 GH©ŽŒÕõý' )
> '
> at line 1
>
> Now, if you look closely you can see and additional single quote in
> êR'—HX‹. I cannot use addslashes() here can I? Or should I base64_encode
> each item and then decode on the way back out. Any thoughts would be
> appreciated.
>
> TVMIA!
--
Evan Nemerson
evan@coeus-group.com
http://coeusgroup.com/en
--
"Only the other day, historically speaking, the 'holy inquisition' burned or
silenced scientists. The discovery of the microscope and telescope, for
instance, was delayed for a long time because the inventor, in fear of
priestly persecution, was afraid to write his scientific discoveries in plain
language. He had to write them in cipher- a fact discovered only a few years
ago. Those afflicted with diseases can easily realize where our science in
general, and medical science in particular, might be today if not for the
holy zeal of powerful enemies of science who vehemently and ruthlessly
sponsored ignorance, old s.r, and so disease."
-Alfred Korzybski