[TASK] Re-work/simplify copyright header in PHP files - Part 8
[Packages/TYPO3.CMS.git] / typo3 / sysext / saltedpasswords / Classes / Salt / SaltInterface.php
1 <?php
2 namespace TYPO3\CMS\Saltedpasswords\Salt;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Interface with public methods needed to be implemented
19 * in a salting hashing class.
20 *
21 * @author Marcus Krause <marcus#exp2009@t3sec.info>
22 * @author Steffen Ritter <info@rs-websystems.de>
23 */
24 interface SaltInterface {
25 /**
26 * Method checks if a given plaintext password is correct by comparing it with
27 * a given salted hashed password.
28 *
29 * @param string $plainPW plain-text password to compare with salted hash
30 * @param string $saltedHashPW Salted hash to compare plain-text password with
31 * @return boolean TRUE, if plaintext password is correct, otherwise FALSE
32 */
33 public function checkPassword($plainPW, $saltedHashPW);
34
35 /**
36 * Returns length of required salt.
37 *
38 * @return integer Length of required salt
39 */
40 public function getSaltLength();
41
42 /**
43 * Returns whether all prequesites for the hashing methods are matched
44 *
45 * @return boolean Method available
46 */
47 public function isAvailable();
48
49 /**
50 * Method creates a salted hash for a given plaintext password
51 *
52 * @param string $password Plaintext password to create a salted hash from
53 * @param string $salt Optional custom salt to use
54 * @return string Salted hashed password
55 */
56 public function getHashedPassword($password, $salt = NULL);
57
58 /**
59 * Checks whether a user's hashed password needs to be replaced with a new hash.
60 *
61 * This is typically called during the login process when the plain text
62 * password is available. A new hash is needed when the desired iteration
63 * count has changed through a change in the variable $hashCount or
64 * HASH_COUNT or if the user's password hash was generated in an bulk update
65 * with class ext_update.
66 *
67 * @param string $passString Salted hash to check if it needs an update
68 * @return boolean TRUE if salted hash needs an update, otherwise FALSE
69 */
70 public function isHashUpdateNeeded($passString);
71
72 /**
73 * Method determines if a given string is a valid salt
74 *
75 * @param string $salt String to check
76 * @return boolean TRUE if it's valid salt, otherwise FALSE
77 */
78 public function isValidSalt($salt);
79
80 /**
81 * Method determines if a given string is a valid salted hashed password.
82 *
83 * @param string $saltedPW String to check
84 * @return boolean TRUE if it's valid salted hashed password, otherwise FALSE
85 */
86 public function isValidSaltedPW($saltedPW);
87
88 }