private function encryptAndRenderCookies($resCookies)
    {
        $renderable = [];

        foreach ($resCookies as $cookie) {
            if (is_string($cookie)) {
                $cookie = SetCookie::fromSetCookieString($cookie);
            }

            if ($cookie instanceof SetCookie) {
                $val = $cookie->getValue();
                if ($val instanceof OpaqueProperty) {
                    $val = $val->getValue();
                }

                if (!in_array($cookie->getName(), $this->unencryptedCookies)) {
                    $val = $this->encryption->encrypt($val);
                }

                $renderable[$cookie->getName()] = (string) $cookie->withValue($val);
            }
        }

        return $renderable;
    }