33 if (!is_string($string)) {
34 throw new \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException(
'A hash can only be generated for a string, but "' . gettype($string) .
'" was given.', 1255069587);
36 $encryptionKey =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'];
37 if (!$encryptionKey) {
38 throw new \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException(
'Encryption Key was empty!', 1255069597);
40 return hash_hmac(
'sha1', $string, $encryptionKey);
53 return $string . $hmac;
81 if (!is_string($string)) {
82 throw new \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException(
'A hash can only be validated for a string, but "' . gettype($string) .
'" was given.', 1320829762);
84 if (strlen($string) < 40) {
85 throw new \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException(
'A hashed string must contain at least 40 characters, the given string was only ' . strlen($string) .
' characters long.', 1320830276);
87 $stringWithoutHmac = substr($string, 0, -40);
88 if ($this->
validateHmac($stringWithoutHmac, substr($string, -40)) !== TRUE) {
89 throw new \TYPO3\CMS\Extbase\Security\Exception\InvalidHashException(
'The given string was not appended with a valid HMAC.', 1320830018);
91 return $stringWithoutHmac;
validateHmac($string, $hmac)
validateAndStripHmac($string)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]