TYPO3
7.6
|
Public Member Functions | |
generateHmac ($string) | |
appendHmac ($string) | |
validateHmac ($string, $hmac) | |
validateAndStripHmac ($string) | |
A hash service which should be used to generate and validate hashes.
It will use some salt / encryption key in the future.
http://www.gnu.org/licenses/lgpl.html GNU Lesser Public License, version 3 or later
Definition at line 24 of file HashService.php.
appendHmac | ( | $string | ) |
Appends a hash (HMAC) to a given string and returns the result
string | $string | The string for which a hash should be generated |
Definition at line 53 of file HashService.php.
References HashService\generateHmac().
generateHmac | ( | $string | ) |
Generate a hash (HMAC) for a given string
string | $string | The string for which a hash should be generated |
\TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException | if something else than a string was given as parameter |
Definition at line 33 of file HashService.php.
References $GLOBALS.
Referenced by HashService\appendHmac(), and HashService\validateHmac().
validateAndStripHmac | ( | $string | ) |
Tests if the last 40 characters of a given string $string matches the HMAC of the rest of the string and, if true, returns the string without the HMAC. In case of a HMAC validation error, an exception is thrown.
string | $string | The string with the HMAC appended (in the format 'string<HMAC>') |
\TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException | if the given string is not well-formatted |
\TYPO3\CMS\Extbase\Security\Exception\InvalidHashException | if the hash did not fit to the data. |
Definition at line 84 of file HashService.php.
References HashService\validateHmac().
validateHmac | ( | $string, | |
$hmac | |||
) |
Tests if a string $string matches the HMAC given by $hash.
string | $string | The string which should be validated |
string | $hmac | The hash of the string |
Definition at line 66 of file HashService.php.
References HashService\generateHmac().
Referenced by HashService\validateAndStripHmac().