MySQL Forums
Forum List  »  Security

Searching on Encryption (FULLTEXT on AES?)
Posted by: Ismail Said
Date: December 01, 2006 10:51AM

I have some data that needs to be encrypted, but that data needs to be full-text searchable also. How can I do this other than the method below?

What I am doing is creating a new table that decrypts the encrypted field. Then performing a fulltext search on this newly created table, then dropping it when done. This is obviously going to have a performance hit. Is there a way to have Mysql Decrypt before performing the search?

Thanks in Advance

-----------------------

<?php
include('./images/db.php');
mysql_select_db("ctscan");

$setupQ="drop table if exists tempdata;
CREATE TABLE `ctscan`.`tempdata` (
`data` VARCHAR(255),
FULLTEXT `Index_2`(`data`)
)
ENGINE = MYISAM;";
mysql_query($setupQ) or die("error".mysqlerror());


$insertQ="INSERT INTO tempdata (data) select AES_DECRYPT(data,'123') from testaes";
mysql_query($insertQ) or die("errorINS".mysql_error());

$search="SELECT * from tempdata WHERE MATCH (data) AGAINST ('nn') OR data LIKE '%nn%'";
$result=mysql_query($search) or die("errorSEL".mysql_error());
while($row=mysql_fetch_object($result))
{
echo"$row->data <br />";
}

$dropQ="drop table if exists tempdata";
mysql_query($dropQ) or die("errorDEL".mysql_error());


?>

Options: ReplyQuote


Subject
Views
Written By
Posted
Searching on Encryption (FULLTEXT on AES?)
4219
December 01, 2006 10:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.