steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher Cipher.php, NONE, 1.1 package.xml, NONE, 1.1
cvs at intevation.de
cvs at intevation.de
Fri Oct 14 16:33:05 CEST 2005
- Previous message: steffen: server/kolab-horde-framework/kolab-horde-framework/Cache Cache.php, NONE, 1.1 package.xml, NONE, 1.1
- Next message: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher BlockMode.php, NONE, 1.1 blowfish.php, NONE, 1.1 cast128.php, NONE, 1.1 des.php, NONE, 1.1 rc2.php, NONE, 1.1 rc4.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: steffen
Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Cipher
Added Files:
Cipher.php package.xml
Log Message:
Separated Horde Framework from kolab-resource-handlers
--- NEW FILE: Cipher.php ---
<?php
/**
* The Horde_Cipher:: class provides a common abstracted interface to
* various Ciphers for encryption of arbitrary length pieces of data.
*
* Copyright 2002-2004 Mike Cochrane <mike at graftonhall.co.nz>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
* $Horde: framework/Cipher/Cipher.php,v 1.16 2004/01/01 15:14:08 jan Exp $
*
* @author Mike Cochrane <mike at graftonhall.co.nz>
* @version $Revision: 1.1 $
* @since Horde 2.2
* @package Horde_Cipher
*/
class Horde_Cipher {
/**
* The block mode for the cipher chaining
* @var string $_blockMode
*/
var $_blockMode = 'CBC';
/**
* The initialization vector
* @var string $_iv
*/
var $_iv = null;
/**
* Set the block mode for cipher chaining
*
* @param String $blockMode The new blockmode
*/
function setBlockMode($blockMode)
{
$this->_blockMode = $blockMode;
}
/**
* Set the iv
*
* @param String $iv The new iv.
*/
function setIV($iv)
{
$this->_iv = $iv;
}
/**
* Encrypt a string
*
* @param String $plaintext The data to encrypt
*
* @return String The encrypted data
*/
function encrypt($plaintext)
{
require_once dirname(__FILE__) . '/Cipher/BlockMode.php';
$blockMode = &Horde_Cipher_BlockMode::factory($this->_blockMode);
if (!is_null($this->_iv)) {
$blockMode->setIV($this->_iv);
}
return $blockMode->encrypt($this, $plaintext);
}
/**
* Decrypt a string
*
* @param String $ciphertext The data to decrypt
*
* @return String The decrypted data
*/
function decrypt($ciphertext)
{
require_once dirname(__FILE__) . '/Cipher/BlockMode.php';
$blockMode = &Horde_Cipher_BlockMode::factory($this->_blockMode);
if (!is_null($this->_iv)) {
$blockMode->setIV($this->_iv);
}
return $blockMode->decrypt($this, $ciphertext);
}
/**
* Attempts to return a concrete Cipher instance based on $driver.
*
* @access public
*
* @param mixed $cipher The type of concrete Cipher subclass to
* return.
* @param optional array $params A hash containing any additional
* parameters a subclass might need.
*
* @return object Cipher The newly created concrete Cipher instance, or PEAR_Error
* on an error.
*/
function &factory($cipher, $params = null)
{
$driver = basename($cipher);
if (@file_exists(dirname(__FILE__) . '/Cipher/' . $cipher . '.php')) {
require_once dirname(__FILE__) . '/Cipher/' . $cipher . '.php';
}
$class = 'Horde_Cipher_' . $cipher;
if (class_exists($class)) {
return $ret = &new $class($params);
} else {
return PEAR::raiseError('Class definition of ' . $class . ' not found.');
}
}
}
--- NEW FILE: package.xml ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- $Horde: framework/Cipher/package.xml,v 1.10 2003/12/13 05:28:49 chuck Exp $ -->
<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1">
<package version="1.0">
<name>Horde_Cipher</name>
<summary>Cipher API</summary>
<description>This package provides a Block Mode Cipher API, supporting the following ciphers:
* Blowfish
* Cast128
* DES
* RC2
* RC4
And supporting the following block modes:
* CBC
* ECB
* CFB64
* OFB64
</description>
<license>LGPL</license>
<maintainers>
<maintainer>
<user>mac</user>
<role>lead</role>
<name>Mike Cochrane</name>
<email>mike at graftonhall.co.nz</email>
</maintainer>
</maintainers>
<release>
<version>0.0.1</version>
<state>alpha</state>
<date>2003-07-03</date>
<notes>Initial Release.</notes>
<filelist>
<file name="Cipher.php" role="php" baseinstalldir="/Horde"/>
<dir name="Cipher" role="php" baseinstalldir="/Horde">
<file name="BlockMode.php"/>
<file name="blowfish.php"/>
<file name="cast128.php"/>
<file name="des.php"/>
<file name="rc2.php"/>
<file name="rc4.php"/>
<dir name="BlockMode" role="php">
<file role="php" name="cbc.php"/>
<file role="php" name="cfb64.php"/>
<file role="php" name="ecb.php"/>
<file role="php" name="ofb64.php"/>
</dir>
</dir>
<dir name="tests" role="test">
<file name="Cipher1.phpt"/>
<file name="Cipher2.phpt"/>
<file name="Cipher3.phpt"/>
<file name="Cipher4.phpt"/>
<file name="Cipher5.phpt"/>
<file name="Cipher6.phpt"/>
</dir>
</filelist>
<deps>
<dep type="php" rel="ge" version="4.2.0+" />
</deps>
</release>
<changelog>
<release>
<version>0.0.1</version>
<state>alpha</state>
<date>2003-07-03</date>
<notes>Initial release as a PEAR package</notes>
</release>
</changelog>
</package>
- Previous message: steffen: server/kolab-horde-framework/kolab-horde-framework/Cache Cache.php, NONE, 1.1 package.xml, NONE, 1.1
- Next message: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher BlockMode.php, NONE, 1.1 blowfish.php, NONE, 1.1 cast128.php, NONE, 1.1 des.php, NONE, 1.1 rc2.php, NONE, 1.1 rc4.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list