public function testEncryptDecrypt() { $key = 'foobar'; $data = 'very secret'; $iv = Crypt::getiv(); $encrypted = Crypt::encrypt($data, $key, $iv); $this->assertNotEquals($data, $encrypted); $decrypted = Crypt::decrypt($encrypted, $key, $iv); $this->assertEquals($data, $decrypted); }
/** * Get a value from the storage. * * @required public function get($offset) */ public function get($offset) { if (isset($this->deleted[$offset])) { return null; } if (isset($this->cache[$offset])) { return $this->cache[$offset]; } if (strlen($this->iv) && isset($this->cookie['scs-' . $offset])) { return Crypt::decrypt($this->cookie['scs-' . $offset], Conf::f('secret_key'), $this->iv); } return null; }