Ejemplo n.º 1
0
 /**
  * @dataProvider zeroValuesProvider
  */
 public function testEncryptDecryptUsingZero($value)
 {
     $this->blockCipher->setKey('test');
     $this->blockCipher->setKeyIteration(1000);
     foreach ($this->blockCipher->getCipherSupportedAlgorithms() as $algo) {
         $this->blockCipher->setCipherAlgorithm($algo);
         $encrypted = $this->blockCipher->encrypt($value);
         $this->assertTrue(!empty($encrypted));
         $decrypted = $this->blockCipher->decrypt($encrypted);
         $this->assertEquals($value, $decrypted);
     }
 }
Ejemplo n.º 2
0
 public function testEncryptDecryptUsingBinary()
 {
     $this->blockCipher->setKey('test');
     $this->blockCipher->setKeyIteration(1000);
     $this->blockCipher->setBinaryOutput(true);
     foreach ($this->blockCipher->getCipherSupportedAlgorithms() as $algo) {
         $this->blockCipher->setCipherAlgorithm($algo);
         $encrypted = $this->blockCipher->encrypt($this->plaintext);
         $this->assertTrue(!empty($encrypted));
         $decrypted = $this->blockCipher->decrypt($encrypted);
         $this->assertEquals($decrypted, $this->plaintext);
     }
 }