public function testGetMode() { $factory = new \CryptLib\Cipher\Factory(); $aes = $factory->getBlockCipher('rijndael-128'); $mode = new CryptLib\Cipher\Block\Mode\CFB($aes, 'foobarbazbizbuz'); $this->assertEquals('cfb', $mode->getMode()); }
/** * @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\CFB($cipher, pack('H*', $iv)); $dec = $mode->decrypt(pack('H*', $data)); $dec .= $mode->finish(); $this->assertEquals($expected, strtoupper(bin2hex($dec))); }