Yii Encrypter
protected/extensions/encryper'import'=>array( //... 'application.extensions.encrypter.Encrypter', ),
'components'=>array( //... 'encrypter'=>array ( 'class'=>'Encrypter', 'key'=>'XXXXXXXXXXXXXXXX', ), ),
Access the encrypter object:
Yii::app()->encrypter
To encrypt:
$myEncryptedString = Yii::app()->encrypter->encrypt($myDecryptedString);
To decrypt
$myDecryptedString = Yii::app()->encrypter->decrypt($myEncryptedString);
Total 7 comments
Hello, Sorry for my naive question.. but what can this extension do to improve the security of my app? I hope you provided a brief description for it :) Thank you!
@rohit.28f:
1) This module, which is for encryption/decryption (not one-way hashing) is not needed, as it turns out. (Please see CSecurityManager, which contains similar encryption functionality).
2) One should only use a one-way hash for password storage, and not this type of extension. (Please see http://www.yiiframework.com/extension/phpass).
When i m trying to save encrypted password in post gress it is giving error , Characters are not recognised by UTF-8 and not allowing to save.Is there any customisation parameters are in extension to solve the problem.For responce thanx in advance
Can i change key dynamically ? I want to change the key every time the user login, so the generated encrypted string is vary every time user login.
Oh nice, thanks, that's exactly what I was looking for. :)
Like http://www.yiiframework.com/doc/api/1.1/CSecurityManager#encrypt-detail
The configuration can be simplified. Remove imports in general, and in the component, which specifies the class to write so:
Leave a comment
Please login to leave your comment.