function testSessionTokenVerifySignature() { $data = time(); $token = $this->cryptoManager->createSessionToken($data, $this->privateKey); list($timestamp, $hash) = explode(':', $token, 2); // change data $timestamp += 100; $token = $timestamp . ':' . $hash; $this->assertFalse($this->cryptoManager->verifySessionToken($token, $this->privateKey)); }
/** * Create a session token * * @param string $clientHostAddress * @return string */ public function createSessionToken($clientHostAddress) { if (strlen($this->clientHostAddressRestriction) && $clientHostAddress != $this->clientHostAddressRestriction) { return FALSE; } return $this->cryptoManager->createSessionToken(time(), $this->privateKey); }