Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old April 13th, 2007, 03:25 PM
Paul
Guest
 
Posts: n/a
Default help encrypting field with MySQL AES_encrypt before Adodb query

I encrypted a database field using MySQL AES_ENCRYPT() from a mysql command
prompt. But I need to encrypt and decrypt at will in the php code as
records are added and viewed.

I can easily decrypt it because the code specifies a Query. But the INSERT
is an ADODB insert:

$_POST['is_here'] = 83;
....
runQuery($db ->GetInsertSQL($rs, $_POST, true));

I need to use MySQL AES_ENCRYPT() one of the $POST fields before it goes
into this but I don't see how? Mcrypt is not installed on server so MySQL
functions are what I need to use. Is there a way to have something like :
$_POST['field'] = "AES_ENCRYPT('text', 'password')";

It is a live system and I am hesitent to make changes without researching
it.

Any ideas?


  #2  
Old April 14th, 2007, 03:35 AM
petersprc
Guest
 
Posts: n/a
Default Re: help encrypting field with MySQL AES_encrypt before Adodb query

Hi,

You could generate the encrypted value:

$_POST['field'] = $db->GetOne(
'select AES_ENCRYPT(?, ?)',
array($_POST['field'], 'password'));


On Apr 13, 10:24 am, "Paul" <l...@invalid.comwrote:
Quote:
I encrypted a database field using MySQL AES_ENCRYPT() from a mysql command
prompt. But I need to encrypt and decrypt at will in the php code as
records are added and viewed.
>
I can easily decrypt it because the code specifies a Query. But the INSERT
is an ADODB insert:
>
$_POST['is_here'] = 83;
....
runQuery($db ->GetInsertSQL($rs, $_POST, true));
>
I need to use MySQL AES_ENCRYPT() one of the $POST fields before it goes
into this but I don't see how? Mcrypt is not installed on server so MySQL
functions are what I need to use. Is there a way to have something like :
$_POST['field'] = "AES_ENCRYPT('text', 'password')";
>
It is a live system and I am hesitent to make changes without researching
it.
>
Any ideas?

  #3  
Old April 16th, 2007, 10:25 PM
Paul
Guest
 
Posts: n/a
Default Re: help encrypting field with MySQL AES_encrypt before Adodb query

beautiful - thanks!


"petersprc" <petersprc@gmail.comwrote in message
news:1176517941.711079.277500@d57g2000hsg.googlegr oups.com...
Quote:
Hi,
>
You could generate the encrypted value:
>
$_POST['field'] = $db->GetOne(
'select AES_ENCRYPT(?, ?)',
array($_POST['field'], 'password'));
>
>
On Apr 13, 10:24 am, "Paul" <l...@invalid.comwrote:
Quote:
>I encrypted a database field using MySQL AES_ENCRYPT() from a mysql
>command
>prompt. But I need to encrypt and decrypt at will in the php code as
>records are added and viewed.
>>
>I can easily decrypt it because the code specifies a Query. But the
>INSERT
>is an ADODB insert:
>>
> $_POST['is_here'] = 83;
> ....
> runQuery($db ->GetInsertSQL($rs, $_POST, true));
>>
>I need to use MySQL AES_ENCRYPT() one of the $POST fields before it goes
>into this but I don't see how? Mcrypt is not installed on server so MySQL
>functions are what I need to use. Is there a way to have something like
>:
>$_POST['field'] = "AES_ENCRYPT('text', 'password')";
>>
>It is a live system and I am hesitent to make changes without researching
>it.
>>
>Any ideas?
>
>

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles