yii-encrypt

Encryption component using mcrypt
12 followers

Yii Encrypter

Yii-Encrypter is a simple encryption module, using mcrypt.

Requirements

  • Yii 1.0 or better
  • PHP 5
  • mcrypt module for PHP

Installation

  • Extract the release file under protected/extensions/encryper
  • Add a line to your configuration file to import the extension, inside the import array:
'import'=>array(
    //...
    'application.extensions.encrypter.Encrypter',
),
  • Add to your main.php file within your Yii project, inside the components array:
'components'=>array(
    //...
    'encrypter'=>array (
        'class'=>'Encrypter',
        'key'=>'XXXXXXXXXXXXXXXX',
    ),
),

Usage

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

#12252 report it
beesho at 2013/03/09 04:56pm
Used for?

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!

#9257 report it
yiier at 2012/07/31 11:15pm
re: Encrypt Password saing error in Postgres??

@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).

#9256 report it
Rohit.28f at 2012/07/31 10:51pm
Encrypt Password saing error in Postgres??

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

#7170 report it
moysoft at 2012/02/29 11:51pm
Can i change key dynamically?

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.

#7144 report it
yiier at 2012/02/27 12:54pm
re: What's the difference to Yii's built-in methods?

Oh nice, thanks, that's exactly what I was looking for. :)

#7142 report it
schmunk at 2012/02/27 09:17am
What's the difference to Yii's built-in methods?

Like http://www.yiiframework.com/doc/api/1.1/CSecurityManager#encrypt-detail

#7140 report it
Gismo at 2012/02/27 06:50am
config

The configuration can be simplified. Remove imports in general, and in the component, which specifies the class to write so:

'components'=>array(
    //...
    'encrypter'=>array (
        'class'=>'ext.encrypter.Encrypter',
        'key'=>'XXXXXXXXXXXXXXXX',
    ),
),

Leave a comment

Please to leave your comment.

Create extension