예제 #1
0
 public function testGetMode()
 {
     $factory = new \CryptLib\Cipher\Factory();
     $aes = $factory->getBlockCipher('rijndael-128');
     $mode = new CryptLib\Cipher\Block\Mode\CBC($aes, 'foobarbazbizbuz');
     $this->assertEquals('cbc', $mode->getMode());
 }
예제 #2
0
 /**
  * @dataProvider provideTestEncryptVectors
  * @group Vectors
  */
 public function testDecrypt($cipher, $key, $iv, $expected, $data)
 {
     $cipher = new \CryptLib\Cipher\Block\Cipher\AES($cipher);
     $cipher->setKey(pack('H*', $key));
     $mode = new \CryptLib\Cipher\Block\Mode\CBC($cipher, pack('H*', $iv));
     $dec = $mode->decrypt(pack('H*', $data));
     $dec .= $mode->finish();
     $this->assertEquals($expected, strtoupper(bin2hex($dec)));
 }