CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 AES_ENCRYPT and AES_DECRYPT

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.