public function decrypt($data)
    {
        $this->cwsDebug->titleH2('Decrypt data');

        if (empty($this->encryptionKey)) {
            $this->error = 'You have to set the encryption key...';
            $this->cwsDebug->error($this->error);

            return;
        }

        if (empty($data)) {
            $this->error = 'Data empty...';
            $this->cwsDebug->error($this->error);

            return;
        }

        $this->cwsDebug->labelValue('Encryption key', $this->encryptionKey);
        $this->cwsDebug->dump('Encrypted data', strval($data));

        $result = null;
        $td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CFB, '');

        $ivsize = mcrypt_enc_get_iv_size($td);
        $iv = substr($data, 0, $ivsize);
        $key = $this->validateKey($this->encryptionKey, mcrypt_enc_get_key_size($td));

        if ($iv) {
            $data = substr($data, $ivsize);
            mcrypt_generic_init($td, $key, $iv);
            $decryptData = mdecrypt_generic($td, $data);
            $result = $this->decode($decryptData);
        }

        $this->cwsDebug->dump('Data', $result);

        return $result;
    }
public function decrypt($data)
    {
        $this->cwsDebug->titleH2('Decrypt data');

        if (empty($this->encryptionKey)) {
            $this->error = 'You have to set the encryption key...';
            $this->cwsDebug->error($this->error);

            return;
        }

        if (empty($data)) {
            $this->error = 'Data empty...';
            $this->cwsDebug->error($this->error);

            return;
        }

        $this->cwsDebug->labelValue('Encryption key', $this->encryptionKey);
        $this->cwsDebug->dump('Encrypted data', strval($data));

        $result = null;
        $td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CFB, '');

        $ivsize = mcrypt_enc_get_iv_size($td);
        $iv = substr($data, 0, $ivsize);
        $key = $this->validateKey($this->encryptionKey, mcrypt_enc_get_key_size($td));

        if ($iv) {
            $data = substr($data, $ivsize);
            mcrypt_generic_init($td, $key, $iv);
            $decryptData = mdecrypt_generic($td, $data);
            $result = $this->decode($decryptData);
        }

        $this->cwsDebug->dump('Data', $result);

        return $result;
    }
public function decrypt ( $ data ) { $ this -> cwsDebug -> titleH2 ( 'Decrypt data' ) ; if ( empty ( $ this -> encryptionKey ) ) { $ this -> error = 'You have to set the encryption key...' ; $ this -> cwsDebug -> error ( $ this -> error ) ; return ; } if ( empty ( $ data ) ) { $ this -> error = 'Data empty...' ; $ this -> cwsDebug -> error ( $ this -> error ) ; return ; } $ this -> cwsDebug -> labelValue ( 'Encryption key' , $ this -> encryptionKey ) ; $ this -> cwsDebug -> dump ( 'Encrypted data' , strval ( $ data ) ) ; $ result = null ; $ td = mcrypt_module_open ( MCRYPT_BLOWFISH , '' , MCRYPT_MODE_CFB , '' ) ; $ ivsize = mcrypt_enc_get_iv_size ( $ td ) ; $ iv = substr ( $ data , 0 , $ ivsize ) ; $ key = $ this -> validateKey ( $ this -> encryptionKey , mcrypt_enc_get_key_size ( $ td ) ) ; if ( $ iv ) { $ data = substr ( $ data , $ ivsize ) ; mcrypt_generic_init ( $ td , $ key , $ iv ) ; $ decryptData = mdecrypt_generic ( $ td , $ data ) ; $ result = $ this -> decode ( $ decryptData ) ; } $ this -> cwsDebug -> dump ( 'Data' , $ result ) ; return $ result ; }
Return the decrypted string generated from the encrypt method.

@param string $data : The encrypted string

@return null|string : The decrypted string
Return the decrypted string generated from the encrypt method .