Beispiel #1
0
 /**
  * Ensures that the filter follows expected behavior
  *
  * @return void
  */
 public function testBasicMcrypt()
 {
     if (!extension_loaded('mcrypt')) {
         $this->markTestSkipped('Mcrypt extension not installed');
     }
     $filter = new DecryptFilter(array('adapter' => 'BlockCipher'));
     $valuesExpected = array('STRING' => 'STRING', 'ABC1@3' => 'ABC1@3', 'A b C' => 'A B C');
     $enc = $filter->getEncryption();
     $filter->setKey('1234567890123456');
     foreach ($valuesExpected as $input => $output) {
         $this->assertNotEquals($output, $filter($input));
     }
 }
Beispiel #2
0
 /**
  * Ensures that the filter allows setting options de/encryption
  *
  * @return void
  */
 public function testGetSetEncryption()
 {
     if (!extension_loaded('mcrypt')) {
         $this->markTestSkipped('Mcrypt extension not installed');
     }
     $filter = new DecryptFilter(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
     $filter->setVector('testvect');
     $filter->setEncryption(array('mode' => MCRYPT_MODE_ECB, 'algorithm' => MCRYPT_3DES));
     $this->assertEquals(array('mode' => MCRYPT_MODE_ECB, 'algorithm' => MCRYPT_3DES, 'key' => 'testkey', 'algorithm_directory' => '', 'mode_directory' => '', 'vector' => 'testvect', 'salt' => ''), $filter->getEncryption());
 }