assertSame(33, strlen($csrfToken->getEncryptedValue())); $this->assertSame(':', $csrfToken->getEncryptedValue()[16]); } public function testGetEncryptedValueStaysSameOnSecondRequest() { $csrfToken = new \OC\Security\CSRF\CsrfToken('MyCsrfToken'); $tokenValue = $csrfToken->getEncryptedValue(); $this->assertSame($tokenValue, $csrfToken->getEncryptedValue()); $this->assertSame($tokenValue, $csrfToken->getEncryptedValue()); } public function testGetDecryptedValue() { $a = 'abc'; $b = 'def'; $xorB64 = 'BQcF'; $tokenVal = sprintf('%s:%s', $xorB64, base64_encode($a)); $csrfToken = new \OC\Security\CSRF\CsrfToken($tokenVal); $this->assertSame($b, $csrfToken->getDecryptedValue()); } }