Author: Michael Slusarz (slusarz@horde.org)
Inheritance: extends Horde_Crypt_Blowfish_Base
Example #1
0
 /**
  * @dataProvider vectorProvider
  */
 public function testOpensslDriver($vector)
 {
     if (!Horde_Crypt_Blowfish_Openssl::supported()) {
         $this->markTestSkipped();
     }
     $this->_doTest($vector, 0);
 }
Example #2
0
 public function testOpensslDriver()
 {
     if (!Horde_Crypt_Blowfish_Openssl::supported()) {
         $this->markTestSkipped('OpenSSL not installed.');
     } else {
         $this->_doTest(0);
     }
 }
Example #3
0
 /**
  * Constructor.
  *
  * @param string $key  Encryption key.
  * @param array $opts  Additional options:
  *   - cipher: (string) Either 'ecb' or 'cbc'.
  *   - ignore: (integer) A mask of drivers to ignore (IGNORE_* constants).
  *   - iv: (string) IV to use.
  */
 public function __construct($key, array $opts = array())
 {
     $opts = array_merge(array('cipher' => 'ecb', 'ignore' => 0, 'iv' => null), $opts);
     if (!($opts['ignore'] & self::IGNORE_OPENSSL) && Horde_Crypt_Blowfish_Openssl::supported()) {
         $this->_crypt = new Horde_Crypt_Blowfish_Openssl($opts['cipher']);
     } elseif (!($opts['ignore'] & self::IGNORE_MCRYPT) && Horde_Crypt_Blowfish_Mcrypt::supported()) {
         $this->_crypt = new Horde_Crypt_Blowfish_Mcrypt($opts['cipher']);
     } else {
         $this->_crypt = new Horde_Crypt_Blowfish_Php($opts['cipher']);
     }
     $this->setKey($key, $opts['iv']);
 }