public function testVector() { $input = 'hello world'; $pass = '******'; $vector = \base64_decode('eZu2DqB2gYhdA2YkjagLNJJVMVo1BbpJ75tW/PO2bGIY98XHD+Gp+YlO5cv/rHzo45LHMCxL2qOircdST1w5hg=='); $this->assertEquals($input, Aes::decrypt($vector, $pass)); }
public static function repoDecodeWeb($repo) { $ret = \Dcrypt\Aes::decrypt(base32_decode($repo), self::key . \Session::getId() . self::githubId()); if ($ret === false) { \App::abort(500); } return $ret; }
public function testCrossDecryptFailure() { $pw = 'password'; $encrypted = \Dcrypt\Aes::encrypt('hello world', $pw); try { \Dcrypt\AesCtr::decrypt($encrypted, $pw); $this->assertTrue(false); } catch (\Exception $ex) { $this->assertTrue(true); } try { \Dcrypt\Mcrypt::decrypt($encrypted, $pw); $this->assertTrue(false); } catch (\Exception $ex) { $this->assertTrue(true); } $encrypted = \Dcrypt\AesCtr::encrypt('hello world', $pw); try { \Dcrypt\Aes::decrypt($encrypted, $pw); $this->assertTrue(false); } catch (\Exception $ex) { $this->assertTrue(true); } }