steffen: server/kolab-horde-framework/kolab-horde-framework/Crypt Crypt.php, NONE, 1.1 package.xml, NONE, 1.1
cvs at intevation.de
cvs at intevation.de
Fri Oct 14 16:33:06 CEST 2005
- Previous message: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/tests Cipher1.phpt, NONE, 1.1 Cipher2.phpt, NONE, 1.1 Cipher3.phpt, NONE, 1.1 Cipher4.phpt, NONE, 1.1 Cipher5.phpt, NONE, 1.1 Cipher6.phpt, NONE, 1.1 cipherTest.php, NONE, 1.1
- Next message: steffen: server/kolab-horde-framework/kolab-horde-framework/Compress/Compress dbx.php, NONE, 1.1 gzip.php, NONE, 1.1 tar.php, NONE, 1.1 tnef.php, NONE, 1.1 zip.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: steffen
Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Crypt
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Crypt
Added Files:
Crypt.php package.xml
Log Message:
Separated Horde Framework from kolab-resource-handlers
--- NEW FILE: Crypt.php ---
<?php
/**
* The Horde_Crypt:: class provides an API for various cryptographic
* systems used by Horde applications.
*
* $Horde: framework/Crypt/Crypt.php,v 1.26 2004/04/29 20:05:01 slusarz Exp $
*
* Copyright 2002-2004 Michael Slusarz <slusarz at bigworm.colorado.edu>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
* @author Michael Slusarz <slusarz at bigworm.colorado.edu>
* @version $Revision: 1.1 $
* @since Horde 3.0
* @package Horde_Crypt
*/
class Horde_Crypt {
/**
* The temporary directory to use.
*
* @var string $_tempdir
*/
var $_tempdir;
/**
* Attempts to return a concrete Horde_Crypt instance based on $driver.
*
* @access public
*
* @param mixed $driver The type of concrete Crypt subclass to
* return. This is based on the storage
* driver ($driver). The code is dynamically
* included. If $driver is an array, then we
* will look in $driver[0]/lib/Crypt/ for
* the subclass implementation named
* $driver[1].php.
* @param optional array $params A hash containing any additional
* configuration or parameters a subclass
* might need.
*
* @return object Horde_Crypt The newly created concrete Horde_Crypt
* instance, or false on an error.
*/
function &factory($driver, $params = array())
{
if (is_array($driver)) {
list($app, $driver) = $driver;
}
/* Return a base Crypt object if no driver is specified. */
$driver = basename($driver);
if (empty($driver) || (strcmp($driver, 'none') == 0)) {
return $ret = &new Horde_Crypt();
}
if (!empty($app)) {
require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Crypt/' . $driver . '.php';
} elseif (@file_exists(dirname(__FILE__) . '/Crypt/' . $driver . '.php')) {
require_once dirname(__FILE__) . '/Crypt/' . $driver . '.php';
} else {
@include_once 'Horde/Crypt/' . $driver . '.php';
}
$class = 'Horde_Crypt_' . $driver;
if (class_exists($class)) {
return $ret = &new $class($params);
} else {
return PEAR::raiseError('Class definition of ' . $class . ' not found.');
}
}
/**
* Attempts to return a reference to a concrete Crypt instance
* based on $driver. It will only create a new instance if no
* Crypt instance with the same parameters currently exists.
*
* This should be used if multiple crypto backends (and, thus,
* multiple Crypt instances) are required.
*
* This method must be invoked as: $var = &Crypt::singleton()
*
* @access public
*
* @param mixed $driver The type of concrete Crypt subclass to
* return. This is based on the storage
* driver ($driver). The code is dynamically
* included. If $driver is an array, then
* we will look in $driver[0]/lib/Crypt/ for
* the subclass implementation named
* $driver[1].php.
* @param optional array $params A hash containing any additional
* configuration or connection parameters a
* subclass might need.
*
* @return object Crypt The concrete Crypt reference, or false on an error.
*/
function &singleton($driver, $params = array())
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
$signature = serialize(array($driver, $params));
if (!isset($instances[$signature])) {
$instances[$signature] = &Crypt::factory($driver, $params);
}
return $instances[$signature];
}
/**
* Outputs error message if we are not using a secure connection.
*
* @access public
*
* @return object PEAR_Error Returns a PEAR_Error object if there is no
* secure connection.
*/
function requireSecureConnection()
{
global $browser;
if (!$browser->usingSSLConnection()) {
return PEAR::raiseError(_("The encryption features require a secure web connection."));
}
}
/**
* Encrypt the requested data.
* This method should be provided by all classes that extend Horde_Crypt.
*
* @access public
*
* @param string $data The data to encrypt.
* @param optional array $params An array of arguments needed to encrypt
* the data.
*
* @return array The encrypted data.
*/
function encrypt($data, $params = array())
{
return $data;
}
/**
* Decrypt the requested data.
* This method should be provided by all classes that extend Horde_Crypt.
*
* @access public
*
* @param string $data The data to decrypt.
* @param optional array $params An array of arguments needed to decrypt
* the data.
*
* @return array The decrypted data.
*/
function decrypt($data, $params = array())
{
return $data;
}
/**
* Create a temporary file that will be deleted at the end of this
* process.
*
* @access private
*
* @param optional string $descrip Description string to use in filename.
* @param optional boolean $delete Delete the file automatically?
*
* @return string Filename of a temporary file.
*/
function _createTempFile($descrip = 'horde-crypt', $delete = true)
{
return Util::getTempFile($descrip, $delete, $this->_tempdir, true);
}
}
--- NEW FILE: package.xml ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- $Horde: framework/Crypt/package.xml,v 1.6 2003/12/31 21:59:51 slusarz Exp $ -->
<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1">
<package version="1.0">
<name>Horde_Crypt</name>
<summary>Horde Cryptography API</summary>
<description>
The Horde_Crypt:: class provides an API for various cryptographic systems
</description>
<license>LGPL</license>
<maintainers>
<maintainer>
<user>slusarz</user>
<name>Michael Slusarz</name>
<email>slusarz at bigworm.colorado.edu</email>
<role>lead</role>
</maintainer>
<maintainer>
<user>mac</user>
<role>developer</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 role="php" baseinstalldir="/Horde" name="Crypt.php" />
<dir name="Crypt" baseinstalldir="/Horde" role="php">
<file name="pgp.php" />
<file name="smime.php" />
</dir>
</filelist>
</release>
<deps>
<dep type="ext" rel="has" optional="yes">gettext</dep>
<dep type="pkg" rel="has">Horde_MIME</dep>
<dep type="pkg" rel="has">Horde_Util</dep>
</deps>
<changelog>
<release>
<version>0.0.1</version>
<date>2003-07-03</date>
<state>alpha</state>
<notes>Initial release as a PEAR package</notes>
</release>
</changelog>
</package>
- Previous message: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/tests Cipher1.phpt, NONE, 1.1 Cipher2.phpt, NONE, 1.1 Cipher3.phpt, NONE, 1.1 Cipher4.phpt, NONE, 1.1 Cipher5.phpt, NONE, 1.1 Cipher6.phpt, NONE, 1.1 cipherTest.php, NONE, 1.1
- Next message: steffen: server/kolab-horde-framework/kolab-horde-framework/Compress/Compress dbx.php, NONE, 1.1 gzip.php, NONE, 1.1 tar.php, NONE, 1.1 tnef.php, NONE, 1.1 zip.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list