CSecurityManager help

I would like to use the encryption methods and functions found in CSecurityManager but i can seem to find how they work can anyone help me?

the code in which I want to use them:


<?php


class AuthenticationController extends CController

{	

	public function actionLogin()

	{

		$form = new SignInForm;

		// collect user input data

		if(isset($_POST['SignInForm']))

		{

			$form->attributes=$_POST['SignInForm'];


				if($form->validate('signin') && !$form->errorCode) 

				{

					$identity = new UserIdentity($form->username,$form->password);

					$identity->authenticate();

					Yii::app()->user->login($identity);

					$this->redirect(Yii::app()->homeUrl);

				} 

		}

		// display the login form

		$this->render('login', array('form'=>$form));

	}


	public function actionLogout()

	{

		Yii::app()->user->logout();

		$this->redirect(Yii::app()->homeUrl);

	}

	

	public function actionFailed()

	{

		$this->render('failed');

	}

}


class Identities extends CActiveRecord

{

	/**

	 * The followings are the available columns in table 'identities':

	 * @var integer $identityId

	 * @var string $identityName

	 * @var string $identityPassword

	 * @var string $identitySalt

	 * @var integer $identityStatus

	 */


	/**

	 * Returns the static model of the specified AR class.

	 * @return CActiveRecord the static model class

	 */

	public static function model($className=__CLASS__)

	{

		return parent::model($className);

	}


	/**

	 * @return string the associated database table name

	 */

	public function tableName()

	{

		return 'identities';

	}


	/**

	 * @return array validation rules for model attributes.

	 */

	public function rules()

	{

		return array(

			array('identityName','length','max'=>1024),

			array('identityPassword','length','max'=>1024),

			array('identitySalt','length','max'=>1023),

			array('identityName, identityPassword', 'required', 'on'=>'login'),

			array('identityStatus', 'numerical', 'integerOnly'=>true),

		);

	}


	/**

	 * @return array relational rules.

	 */

	public function relations()

	{

		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array();

	}


	/**

	 * @return array customized attribute labels (name=>label)

	 */

	public function attributeLabels()

	{

		return array(

			'identityId' => 'Identity',

			'identityName' => 'Identity Name',

			'identityPassword' => 'Identity Password',

			'identitySalt' => 'Identity Salt',

			'identityStatus' => 'Identity Status',

		);

	}

	

	public function getIdentity($identityName)

	{

		$Criteria = new CDbCriteria();

		$criteria->select ="identityId, identityName, identityPassword";

		$Criteria->condition = "identityName = :identityName";

		$Criteria->params = array (":identityName" => $identityName);

		

		$user =  self::model()->find($Criteria);

		return $user;

	}

}


<?php


/**

 * UserIdentity represents the data needed to identity a user.

 * It contains the authentication method that checks if the provided

 * data can identity the user.

 */

class UserIdentity extends CUserIdentity

{

	const ERROR_NONE = 0;

	const ERROR_INVALID_USERNAME = 1;

	const ERROR_INVALID_PASSWORD = 2;

	

	private $_id;


	/**

	 * Authenticates a user.

	 * @return boolean whether authentication succeeds.

	 */

	public function authenticate()

	{

		$user=Identities::model()->getIdentity($this->username);

		if(!$user)

			$this->errorCode=self::ERROR_INVALID_USERNAME;

		else if($this->password!==$user->identityPassword)

			$this->errorCode=self::ERROR_INVALID_PASSWORD;

		else

		{

			$this->_id=$user->identityId;

			$this->username = $user->identityName;

			$this->errorCode=self::ERROR_NONE;

		}

		return $this->errorCode;

	}


	/**

	 * @return integer the ID of the user record

	 */

	public function getId()

	{

		return $this->_id;

	}

}

Please help me i already have to encryption and validationKey configured in the configuration

could someone please, please explain in a short ‘howto’ how I am supposed to use CSecurityManager?

Yii::app()->getSecurityManager()->encrypt($variable);