[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/Cipher/ -> BlockMode.php (source)

   1  <?php
   2  /**
   3   * The Horde_Cipher_BlockMode:: class provides a common abstracted
   4   * interface to various block mode handlers for ciphers.
   5   *
   6   * $Horde: framework/Cipher/Cipher/BlockMode.php,v 1.14.12.9 2006/01/01 21:28:10 jan Exp $
   7   *
   8   * Copyright 2002-2006 Mike Cochrane <mike@graftonhall.co.nz>
   9   *
  10   * See the enclosed file COPYING for license information (LGPL). If you
  11   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  12   *
  13   * @author  Mike Cochrane <mike@graftonhall.co.nz>
  14   * @since   Horde 2.2
  15   * @package Horde_Cipher
  16   */
  17  class Horde_Cipher_BlockMode {
  18  
  19      /**
  20       * The initialization vector.
  21       *
  22       * @var string
  23       */
  24      var $_iv = "\0\0\0\0\0\0\0\0";
  25  
  26      /**
  27       * Attempts to return a concrete Horde_Cipher_BlockMode instance based on
  28       * $mode.
  29       *
  30       * @param string $mode   The type of concrete Horde_Cipher_BlockMode
  31       *                       subclass to return.
  32       * @param array $params  A hash containing any additional parameters a
  33       *                       subclass might need.
  34       *
  35       * @return Horde_Cipher_BlockMode  The newly created concrete
  36       *                                 CipherBlockMode instance, or PEAR_Error
  37       *                                 on error.
  38       */
  39      function &factory($mode, $params = null)
  40      {
  41          $mode = basename($mode);
  42          if (@file_exists(dirname(__FILE__) . '/BlockMode/' . $mode . '.php')) {
  43              require_once dirname(__FILE__) . '/BlockMode/' . $mode . '.php';
  44          }
  45  
  46          $class = 'Horde_Cipher_BlockMode_' . $mode;
  47          if (class_exists($class)) {
  48              $blockmode = &new $class($params);
  49          } else {
  50              $blockmode = PEAR::raiseError('Class definition of ' . $class . ' not found.');
  51          }
  52  
  53          return $blockmode;
  54      }
  55  
  56      /**
  57       * Set the IV
  58       *
  59       * @param string $iv  The new IV.
  60       */
  61      function setIV($iv)
  62      {
  63          $this->_iv = $iv;
  64      }
  65  
  66  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7