This topic is locked

Encryped Database Issues

11/26/2010 11:02:46 AM
PHPRunner General questions
R
Redshift author

Hi,

I am using the pure PHP solution to encrypt some fields in the database two in particular are causing issues
1; I have a Client address field which works well with encryption but the problem is google maps cant read the address if it's encrypted in the database. works fine if not encrypted.
2; I have a notes field for which I want to use the rich text editor, but if I use select to use Rich Text then only the encrypted data is displayed if I use a normal field it works fine.
I've tried messing about with events but I cant seem to get these two to work.
I would appreciate any suggestions

Sergey Kornilov admin 11/26/2010

The better approach is to use 'List page: Before record processed' event instead of 'View as: Custom'.
Add the following code to this event and remove code from 'View as: Custom'.

$data["FieldName"]=decrypt($data["FieldName"]);


I'll update the article accordingly.

R
Redshift author 11/26/2010

While that is a tidier approach it doesn't seem solve the problems I mentioned.

It appears that Google Maps and the Rich text Editor are pulling the encrypted text direct from the database and skipping the event handling

Sergey Kornilov admin 11/26/2010

You are correct in regards to rich text editor - on the edit page it displays editor in iframe and thus pulls data using rte.php file. As a quick and dirty workaround you can modify this file to decrypt data.
In regards to Google maps - it works the same way as all other fields. Do you store parts of address in different fields and concatenate them in SQL query? Let me know how you store address and I'll suggest a workaround.

R
Redshift author 11/28/2010

Ok the google maps works ok on new records but not existing ones for some reason but that doesn't matter since it's only a test database probably just something silly.
I am having problems with displaying the master record on child tables. The master record is clients and details table is cases although when I view the client record directly the record is decrypted but when I view the cases for a client the master details at the top are encrypted, the same happens with a look up field on the cases table which is linked to a Client ID field on the Clients table when I open a case record the Client ID is encrypted.
I've tried to decrypt the field but that just ends up showing the content of the link field which is just the ID of master record it breaks the actual look up

Sergey Kornilov admin 11/29/2010

In regards to Google Maps field - do you store parts of address in different fields and concatenate them in SQL query? I need to understand what is your setup in order to help.
As a personal advice - do not encrypt those fields that don't carry important information. This is especially true for special fields like primary/foreign keys.

R
Redshift author 11/29/2010



In regards to Google Maps field - do you store parts of address in different fields and concatenate them in SQL query? I need to understand what is your setup in order to help.
As a personal advice - do not encrypt those fields that don't carry important information. This is especially true for special fields like primary/foreign keys.


I store the address as a single field but as I mentioned google maps is working perfectly now and I am only encrypting actual client details information.

My problem now displaying the master record on the child table view, the master details at the top over the child records do not decrypt.

Sergey Kornilov admin 11/29/2010

I see what you saying. There is a bit of issue here as there is no 'Before record processed' event for master table info. You can use 'View as' Custom there, however this won't work with Google Maps.
Unfortunately we do not have a solution that fits all scenarios (rather than using built-in MySQL encryption/decryption routine).

R
Redshift author 11/30/2010



I see what you saying. There is a bit of issue here as there is no 'Before record processed' event for master table info. You can use 'View as' Custom there, however this won't work with Google Maps.
Unfortunately we do not have a solution that fits all scenarios (rather than using built-in MySQL encryption/decryption routine).


Thanks for your help, I will investigate the MYSQL option instead.