TYPO3 API  SVNRelease
interface.tx_saltedpasswords_salts.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2009-2011 Marcus Krause <marcus#exp2009@t3sec.info>
00006 *  (c) 2009-2011 Steffen Ritter <info@rs-websystems.de>
00007 *  All rights reserved
00008 *
00009 *  This script is part of the TYPO3 project. The TYPO3 project is
00010 *  free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  The GNU General Public License can be found at
00016 *  http://www.gnu.org/copyleft/gpl.html.
00017 *  A copy is found in the textfile GPL.txt and important notices to the license
00018 *  from the author is found in LICENSE.txt distributed with these scripts.
00019 *
00020 *
00021 *  This script is distributed in the hope that it will be useful,
00022 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 *  GNU General Public License for more details.
00025 *
00026 *  This copyright notice MUST APPEAR in all copies of the script!
00027 ***************************************************************/
00028 /**
00029  * Contains interface "tx_saltedpasswords_salts" to be used in
00030  * classes that provide salted hashing.
00031  *
00032  * $Id: interface.tx_saltedpasswords_salts.php 10120 2011-01-18 20:03:36Z ohader $
00033  */
00034 
00035 
00036 /**
00037  * Interface with public methods needed to be implemented
00038  * in a salting hashing class.
00039  *
00040  * @author      Marcus Krause <marcus#exp2009@t3sec.info>
00041  * @author      Steffen Ritter <info@rs-websystems.de>
00042  *
00043  * @since       2009-09-06
00044  * @package     TYPO3
00045  * @subpackage  tx_saltedpasswords
00046  */
00047 interface tx_saltedpasswords_salts {
00048     /**
00049      * Method checks if a given plaintext password is correct by comparing it with
00050      * a given salted hashed password.
00051      *
00052      * @param   string      $plainPW:  plain-text password to compare with salted hash
00053      * @param   string      $saltedHashPW:  salted hash to compare plain-text password with
00054      * @return  boolean     TRUE, if plaintext password is correct, otherwise FALSE
00055      */
00056     public function checkPassword($plainPW, $saltedHashPW);
00057 
00058     /**
00059      * Returns length of required salt.
00060      *
00061      * @return  integer     length of required salt
00062      */
00063     public function getSaltLength();
00064 
00065     /**
00066      * Returns wether all prequesites for the hashing methods are matched
00067      *
00068      * @return  boolean     method available
00069      */
00070     public function isAvailable();
00071 
00072 
00073     /**
00074      * Method creates a salted hash for a given plaintext password
00075      *
00076      * @param   string      $password:  plaintext password to create a salted hash from
00077      * @param   string      $salt:  optional custom salt to use
00078      * @return  string      salted hashed password
00079      */
00080     public function getHashedPassword($password, $salt = NULL);
00081 
00082     /**
00083      * Checks whether a user's hashed password needs to be replaced with a new hash.
00084      *
00085      * This is typically called during the login process when the plain text
00086      * password is available.  A new hash is needed when the desired iteration
00087      * count has changed through a change in the variable $hashCount or
00088      * HASH_COUNT or if the user's password hash was generated in an bulk update
00089      * with class ext_update.
00090      *
00091      * @param   string      $passString  salted hash to check if it needs an update
00092      * @return  boolean     TRUE if salted hash needs an update, otherwise FALSE
00093      */
00094     public function isHashUpdateNeeded($passString);
00095 
00096     /**
00097      * Method determines if a given string is a valid salt
00098      *
00099      * @param   string      $salt: string to check
00100      * @return  boolean     TRUE if it's valid salt, otherwise FALSE
00101      */
00102     public function isValidSalt($salt);
00103 
00104     /**
00105      * Method determines if a given string is a valid salted hashed password.
00106      *
00107      * @param   string      $saltedPW: string to check
00108      * @return  boolean     TRUE if it's valid salted hashed password, otherwise FALSE
00109      */
00110     public function isValidSaltedPW($saltedPW);
00111 }
00112 
00113 
00114 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/saltedpasswords/classes/salts/interfaces/interface.tx_saltedpasswords_salts.php'])) {
00115     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/saltedpasswords/classes/salts/interfaces/interface.tx_saltedpasswords_salts.php']);
00116 }
00117 ?>