I was just wondering how to decrypt/encrypt form data in cakephp by creatin开发者_开发知识库g a behavior?
What I have so far:
$key = Configure::read('Security.cipherSeed'); Security::cipher($encrypt,$key)
debug($key);
function encrypt { var $autoEncrypt= 'true';}
function decrypt {}
Other than this I really could use some help.
It's not really clear what you're asking... you provided some code; is it working? Is it not working? What happens when you try to use it? Are there error messages? If so, what are they?
A shot in the dark anyway: have you considered using automatic decryption?
<?php
class User extends AppModel
{
var $name = 'User';
var $actsAs = array('Cipher' => array('autoDecypt' => true));
}
?>
There is a lot of info on the cipher-behavior here: http://bakery.cakephp.org/articles/view/cipher-behavior
精彩评论