Re: Encrypted field

From: Date: Fri, 10 Dec 2004 11:38:54 +0000
Subject: Re: Encrypted field
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16156@lists.php.net to get a copy of this message
Rodrigo Alvarez wrote:
Hi PEARs, I'm using formbuilder and as showed in wiki example I must encrypt some data in database. But I'cant use md5 because data must be recoverable. Which type of encryption should I use? I can use MySQL functions, php functions or any external clases (RSA or something). And, how would you do this? Is the example at the wiki the unique way? I have a lot of entities and I it could ble clearer to use some kind of function, instead of copy-paste-modify. Thank U, Rodrigo.
I'm using this in all my create-update forms, as you can see, for language purposes: class DB_DataObject_MyFormBuilder extends DB_DataObject_FormBuilder { function &create(&$do) { $fb = &parent::create($do); $fb->ruleViolationMessage = 'El valor introducido no es válido.'; $fb->requiredRuleMessage = 'El campo %s es obligatorio.'; return $fb; } } Can I implement some methods here to filter fields marked as encrypted in my DAOs, for example: class DAO_Addon extends DB_DataObject {
    ###START_AUTOCODE
    /* the code below is auto generated do not remove the above tag */
    /* the code above is auto generated do not remove the tag below */
    ###END_AUTOCODE
    var $fb_encryptedFields = array('price');
} So DB_DataObject_MyFormBuilder encrypts and decrypts all $fb_encryptedFields? Thanks.

« previous php.pear.general (#16156) next »