protected function randomKey($length)
    {
        $string = '';
        while (($len = mb_strlen($string)) < $length) {
            $size = $length - $len;
            $bytes = random_bytes($size);
            $string .= mb_substr(str_replace(['\\', '/', '"', '\''], '', base64_encode($bytes)), 0, $size, 'UTF-8');
        }
        return $string;
    }