PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Decrypt filter

The Decrypt filter allows to decrypt a encrypted file.

This filter makes use of Zend_Filter_Decrypt. It supports the Mcrypt and OpenSSL extensions from PHP. Please read the related section for details about how to set the options for decryption and which options are supported.

This filter supports one additional option which can be used to save the decrypted file with another filename. Set the filename option to change the filename where the decrypted file will be stored. If you suppress this option, the decrypted file will overwrite the original encrypted file.

Example 431. Using the Decrypt filter with Mcrypt

<?php
$upload 
= new Zend_File_Transfer_Adapter_Http();

// Adds a filter to decrypt the uploaded encrypted file
// with mcrypt and the key mykey
$upload->addFilter('Decrypt',
    array(
'adapter' => 'mcrypt''key' => 'mykey'));

Example 432. Using the Decrypt filter with OpenSSL

<?php
$upload 
= new Zend_File_Transfer_Adapter_Http();

// Adds a filter to decrypt the uploaded encrypted file
// with openssl and the provided keys
$upload->addFilter('Decrypt',
    array(
'adapter' => 'openssl',
          
'private' => '/path/to/privatekey.pem',
          
'envelope' => '/path/to/envelopekey.pem'));

Zend Framework