Decrypts our auth cookie payload if it is set.

@return array
509036
protected function parseCookie()
    {
        if (!$cookie = openssl_decrypt($this->getCookie(), $this->cipher, $this->config->secret, false, $this->vector)) {
            return false;
        }

        return (object) json_decode($cookie, true);
    }
409817
public static function getAll() : array
    {
        return [
            self::RSA_SHA256,
            self::RSA_SHA384,
            self::RSA_SHA512,
            self::SHA256,
            self::SHA384,
            self::SHA512
        ];
    }
1118859
public function cookieValues()
    {
        $headers = $request->headers();
        return isset($headers['Cookie']) ? CookieValues::toArray($headers['Cookie']->value()) : [];
    }
62665
private function getCookies()
    {
        $cookieConfiguration = $this->getCookieConfiguration();

        $cookies = [
            $cookieConfiguration['visit_cookie_name'] ?? null,
            $cookieConfiguration['visitor_cookie_name'] ?? null,
        ];

        return array_filter($cookies);
    }
1337177
public function decrypt()
    {
        if ($this->encryption == 'XOR') {
            $this->encrypted_data = $this->simplexor();
        } elseif ($this->encryption == 'MCRYPT') {
            $this->encrypted_data = $this->mcrypt();
        }

        return $this;
    }
1252799
public function toArray(): array
    {
        $cookies = [];

        foreach ($this->responseCookies as $key => $cookie) {
            $cookie['expires'] = is_string($cookie['expires']) ?
                        strtotime($cookie['expires']) :
                        (int) $cookie['expires'];

            $cookies[] = ['key' => $key] + $cookie;
        }

        return $cookies;
    }
335795
public function load()
    {
        if (!file_exists($this->file)) {
            return []; // File doesn't exist yet.
        }
        $data = file_get_contents($this->file);
        if (strlen($data) === 0) {
            return [];
        }
        if ($this->isEncrypted()) {
            $data = Crypto::decryptWithPassword($data, $this->key, true);
        }
        return json_decode($data, true);
    }
501754
public function getCookies()
    {
        $result = array();
        foreach ($this->_cookies as $path)
        {
            foreach ($path as $cookies)
            {
                foreach ($cookies as $cookie) {
                    $result[] = $cookie;
                }
            }
        }

        return $result;
    }
834687
protected function decryptArray(array $cookie)
    {
        $decrypted = [];
        
        foreach ($cookie as $key => $value) {
            try {
                $decrypted[$key] = $this->encrypter->decrypt(urldecode($value));
            } catch (Exception $e) {
                $decrypted[$key] = $this->encrypter->decrypt($value);
            }
        }
        
        return $decrypted;
    }
1252027
public function createAndSetCsrfCookie($val)
    {
        $masked = $this->client->maskToken($val);
        $name = $this->client->getCsrfParamName();
        $this->setCookie($name, $val);
        return [$name, $masked];
    }
500355
public function cookies($request)
    {
        $headers = $response->headers();
        if (!isset($headers['Set-Cookie'])) {
            return [];
        }
        $setCookies = [];
        foreach ($headers['Set-Cookie'] as $setCookieHeader) {
            $setCookie = Cookie::fromString($setCookieHeader);
            if (!$setCookie->domain()) {
                $setCookie->domain($request->hostname());
            }
            if (strpos($setCookie->path(), '/') !== 0) {
                $setCookie->path($this->_pathFrom($request));
            }
            $setCookies[] = $setCookie;
        }
        return $setCookies;
    }
47175
public function getAuthKeyRules()
    {
        if (!is_string($this->authKeyAttribute) || empty($this->authKeyAttribute)) {
            return [];
        }
        if (empty($this->authKeyRules)) {
            $this->authKeyRules = [
                [[$this->authKeyAttribute], 'required'],
                [[$this->authKeyAttribute], 'string', 'max' => 40],
            ];
        }
        return $this->authKeyRules;
    }
291122
public function getResponseCookies()
    {
        if (!is_array($this->responseCookies)) {
            $cookies = $this->getResponseHeader('SET-COOKIE', false);
            $this->responseCookies = array();
            foreach ($cookies as $cookie) {
                $this->responseCookies += $this->parseCookie($cookie);
            }
        }
        return $this->responseCookies;
    }
456418
public function getCookies()
    {
        $cookies = [];
        $pattern = '#Set-Cookie: (.*?)=(.*?);#im';
        if (preg_match_all($pattern, $this->header . $this->body, $match)) {
            foreach ($match[1] as $co => $vo) {
                if (strtoupper($match[2][$co]) != 'EXPIRED') {
                    $cookies[$vo] = $match[2][$co];
                }
            }
        }
        return $cookies;
    }
611902
private function decryptCookies(Cookies $reqCookies)
    {
        $resCookies = [];

        foreach ($reqCookies->getAll() as $cookie) {
            $name = $cookie->getName();

            if (in_array($name, $this->unencryptedCookies)) {
                continue;
            }

            $decrypted = $this->encryption->decrypt($cookie->getValue());
            if (is_string($decrypted)) {
                $reqCookies = $reqCookies->with($cookie->withValue(new OpaqueProperty($decrypted)));
            } else {
                $reqCookies = $reqCookies->without($name);
                if ($this->deleteInvalid) {
                    $resCookies[] = SetCookie::createExpired($name);
                }
            }
        }

        return [$reqCookies, $resCookies];
    }
1095777
public function getCookieParams() : array
    {
        $r = [];
        foreach ($this->cookies->toArray(false) as $k => $v) {
            $r[$k] = $v->getValue();
        }
        return $r;
    }
234108
public function decryptSecureCookie($value)
    {
        $cookieValues = explode('|', $value, 4);
        if ((count($cookieValues) === 4) && ($cookieValues[1] == 0 || $cookieValues[1] >= time())) {
            $userid = $cookieValues[0];
            $expire = $cookieValues[1];
            $encrValue = $cookieValues[2];

            $key = hash_hmac('sha1', $userid.$expire, $this->key);
            $value = $this->decrypt(base64_decode(str_replace(' ', '+', $encrValue)), md5($expire));

            if ($this->includeSSLKey == true && ($sslKey = $this->Request->getServerAttribute('SSL_SESSION_ID')))
                $verifyKey = hash_hmac('sha1', $userid . $expire . $value . $sslKey, $key);
            else
                $verifyKey = hash_hmac('sha1', $userid . $expire . $value, $key);

            if (strcmp($verifyKey, $cookieValues[3]) === 0)
                return $value;
        }
        return false;
    }