Author: Michael Meyer (mmeyer2k) (m.meyer2k@gmail.com)
Inheritance: extends Cryptobase
Exemplo n.º 1
0
 public function testVector()
 {
     $input = 'hello world';
     $pass = '******';
     $vector = \base64_decode('eZu2DqB2gYhdA2YkjagLNJJVMVo1BbpJ75tW/PO2bGIY98XHD+Gp+YlO5cv/rHzo45LHMCxL2qOircdST1w5hg==');
     $this->assertEquals($input, Aes::decrypt($vector, $pass));
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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);
     }
 }