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