+ /**
+ * calculate the derivedk
+ *
+ * @param string $password
+ * @return string
+ */
+ private function getDerviedk ($password) {
+ $derivedk = '';
+
+ // calculate derivedk
+ if (!function_exists('hash_pbkdf2')) {
+ require_once 'CryptLib/CryptLib.php';
+ $pbkdf2 = new CryptLib\Key\Derivation\PBKDF\PBKDF2(array('hash' => 'sha1'));
+ $derivedk = bin2hex($pbkdf2->derive(hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32));
+ $derivedk = substr($this->derivedk, 0, 32);
+ }
+ else {
+ $derivedk = hash_pbkdf2('sha1', hash('sha256', $password), substr($this->challenge, 0, 16), 1000, 32);
+ }
+
+ return $derivedk;
+ }
+
+ /**
+ * get cookie from header data
+ *
+ * @param array $data
+ * @return string
+ */
+ private function getCookie ($data) {
+ if (isset($data['header']['Set-Cookie']) && !empty($data['header']['Set-Cookie'])) {
+ preg_match('/^.*(SessionID_R3=[a-z0-9]*).*/i', $data['header']['Set-Cookie'], $match);
+ if (isset($match[1]) && !empty($match[1])) {
+ return $match[1];
+ }
+ }
+
+ throw new RouterExeption('unable to get the session cookie from the router');
+ }
+