Jer
Posts: 25
|
| Posted: 10/29/2008, 5:18 PM |
|
We have application that needs to have encryption added.
is has 40 tables and on average 20 fields that need to be encrypted and decrypted using AES.
I'm thinking it may be faster to manually edit the code to apply the changes, as many tables use the same field names.
The problem is, I'm not where I'd add the AES_ENCRYPT and AES_DECRYPT statements.
Any help appreciated.
Thanks,
Jer
|
 |
 |
melvyn
Posts: 333
|
| Posted: 10/29/2008, 6:00 PM |
|
Let's say your form name is "my_test_form" and theres a field called "my_field_1" which you need to encrypt.
Click the form, go to properties then events, before insert. Click on symbol +, custom code and edit as following:
$Component->my_test_form->SetValue(your_crypt_function($Component->my_test_form->GetValue())).
A more detailed way is:
$my_value = $Component->my_test_form->GetValue(); // Get the component value
$my_value = your_crypt_function($my_value); // let's encrypt it.
$Component->my_test_form->SetValue($my_value); // let's send this crypted value to the DB.
The above code is valid in before insert and before update.
When show in the grid is almost the same
$Component->my_test_form->SetValue(your_decrypt_function( $Component->my_test_form->GetValue()));
Hope this help.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
Jer
Posts: 25
|
| Posted: 10/29/2008, 6:08 PM |
|
Hi Melvyn,
Thanks for the response. I left out one key piece of info.
AES_DECRYPT and AES_ENCRYPT are built-in MySQL functions.
That's where my confusion is coming from. I need to decrypt when the SELECT is done, and encrypt at INSERT and UPDATE time.
Thanks,
Jer
|
 |
 |
|