28 $this->hashService = new \TYPO3\CMS\Extbase\Security\Cryptography\HashService();
29 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'] =
'Testing';
37 $hash = $this->hashService->generateHmac(
'asdf');
38 $this->assertTrue(is_string($hash));
46 $hash = $this->hashService->generateHmac(
'asdf');
47 $this->assertNotEquals(sha1(
'asdf'), $hash);
55 $hash1 = $this->hashService->generateHmac(
'asdf');
56 $hash2 = $this->hashService->generateHmac(
'blubb');
57 $this->assertNotEquals($hash1, $hash2);
66 $hash = $this->hashService->generateHmac(NULL);
75 $hash = $this->hashService->generateHmac($string);
76 $this->assertTrue($this->hashService->validateHmac($string, $hash));
86 $this->assertFalse($this->hashService->validateHmac($string, $hash));
94 $this->hashService->appendHmac(NULL);
101 $string =
'This is some arbitrary string ';
102 $hashedString = $this->hashService->appendHmac($string);
103 $this->assertSame($string, substr($hashedString, 0, -40));
111 $this->hashService->validateAndStripHmac(NULL);
119 $this->hashService->validateAndStripHmac(
'string with less than 40 characters');
127 $this->hashService->validateAndStripHmac(
'string with exactly a length 40 of chars');
135 $this->hashService->validateAndStripHmac(
'some Stringac43682075d36592d4cb320e69ff0aa515886eab');
142 $string =
' Some arbitrary string with special characters: öäüß!"§$ ';
143 $hashedString = $this->hashService->appendHmac($string);
144 $actualResult = $this->hashService->validateAndStripHmac($hashedString);
145 $this->assertSame($string, $actualResult);
appendHmacThrowsExceptionIfNoStringGiven()
validateAndStripHmacThrowsExceptionIfGivenStringHasNoHashAppended()
generateHmacReturnsHashStringWhichContainsSomeSalt()
appendHmacAppendsHmacToGivenString()
validateAndStripHmacThrowsExceptionIfTheAppendedHashIsInvalid()
generateHmacThrowsExceptionIfNoStringGiven()
validateAndStripHmacThrowsExceptionIfNoStringGiven()
generateHmacReturnsHashStringIfStringIsGiven()
validateAndStripHmacThrowsExceptionIfGivenStringIsTooShort()
validateAndStripHmacReturnsTheStringWithoutHmac()
generateHmacReturnsDifferentHashStringsForDifferentInputStrings()
generatedHmacCanBeValidatedAgain()
generatedHmacWillNotBeValidatedIfHashHasBeenChanged()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]