Check the key

@throws \Ukey1\Exceptions\AppException
504947
private function checkKey()
    {
        $keyResource = openssl_get_publickey($this->secretKey);
        $details = openssl_pkey_get_details($keyResource);

        if (!isset($details["key"]) || $details["type"] !== OPENSSL_KEYTYPE_RSA) {
             throw new AppException("Provided Secret Key is invalid");
        }
    }
1190238
private function validateKeys(array $keys)
    {
        foreach (['block_id', 'page_id', 'manager', 'updated_at'] as $key) {
            if (!isset($keys[$key])) {
                throw new \RuntimeException(sprintf('Please define a `%s` key, provided: %s', $key, json_encode(array_keys($keys))));
            }
        }
    }
387378
private function checkConfig()
    {
        if (empty($this->config['api_key'])) {
            throw new Exception("`api_key' must be configured");
        }

        if (empty($this->config['host'])) {
            throw new Exception("`host' must be configured");
        }

        if (empty($this->config['port'])) {
            $this->config['port'] = !empty($this->config['secure']) ? 443 : 80;
        }

        if (!isset($this->config['secure'])) {
            $this->config['secure'] = ($this->config['port'] == 443);
        }

        if (empty($this->config['hostname'])) {
            $this->config['hostname'] = gethostname() ? gethostname() : '<unknown>';
        }

        if (empty($this->config['project_root'])) {
            $this->config['project_root'] = dirname(__FILE__);
        }

        if (empty($this->config['environment_name'])) {
            $this->config['environment_name'] = 'development';
        }

        if (!isset($this->config['params_filters'])) {
            $this->config['params_filters'] = array('/password/');
        }

        if (!isset($this->config['connect_timeout'])) {
            $this->config['connect_timeout'] = 3;
        }

        if (!isset($this->config['write_timeout'])) {
            $this->config['write_timeout'] = 3;
        }

        if (!isset($this->config['backtrace_filters'])) {
            $this->config['backtrace_filters'] = array(
                sprintf('/^%s/', preg_quote($this->config['project_root'], '/')) => '[PROJECT_ROOT]'
            );
        }

        if (!isset($this->config['skipped_exceptions'])) {
            $this->config['skipped_exceptions'] = array();
        }

        if (!isset($this->config['default_writer'])) {
            $this->config['default_writer'] = 'Errbit\Writer\SocketWriter';
        }

        if (!isset($this->config['agent'])) {
            $this->config['agent'] = 'errbitPHP';
        }
        if (!isset($this->config['async'])) {
            $this->config['async'] = false;
        }
        if (!isset($this->config['ignore_user_agent'])) {
            $this->config['ignore_user_agent'] = array();
        }
    }
431284
public function key() {
        $set = $this->getConsole()->setKey();
        return $set ? Colors::GREEN."Application key set successfully." : Colors::RED."Error: Key is not set.";
    }
301293
protected function hasRsaKey()
    {
        $hasKey = (isset($this->auth['key']) && trim($this->auth['key']) != '');

        return $hasKey || (isset($this->auth['keytext']) && trim($this->auth['keytext']) != '');
    }
1092795
protected function validateKey()
    {
        if (\is_string($key = $this->key)) {
            if (\substr($key, 0, 7) !== 'file://') {
                $key = 'file://' . $key;
            }

            $this->key = \openssl_get_privatekey($key, $this->passphrase ?: '');
        }

        if (!\is_resource($this->key)) {
            throw new JWTException('Invalid key: Should be resource of private key', static::ERROR_KEY_INVALID);
        }
    }
1236702
protected function keyIsAlreadyInstalled()
    {
        $key = 'APP_KEY=base64:';
        $output = $this->execSSH("cd $this->domain;cat .env");
        if (str_contains($output, $key)) {
            return true;
        }
        return false;
    }
137318
private function parseKey()
    {
        $parts = explode('.', $this->argument('key'), 2);

        $this->file = $parts[0];

        $this->key = isset($parts[1]) ? $parts[1] : null;

        if (Str::contains($this->file, '::')) {
            try {
                $parts = explode('::', $this->file);

                $this->manager->setPathToVendorPackage($parts[0]);
            } catch (\ErrorException $e) {
                $this->error('Could not recognize the package.');

                return;
            }
        }
    }
1158799
protected function checkDeprecatedKeys() {
    $deprecated_keys = [
      'project.hash_salt',
      'project.profile.contrib',
      'project.vendor',
      'project.description',
      'project.themes',
      'hosting',
    ];
    $deprecated_keys_exist = FALSE;
    $outcome = [];
    foreach ($deprecated_keys as $deprecated_key) {
      if ($this->getConfigValue($deprecated_key)) {
        $outcome[] = "The '$deprecated_key' key is deprecated. Please remove it from blt.yml.";
        $deprecated_keys_exist = TRUE;
      }
    }

    if ($deprecated_keys_exist) {
      $this->logProblem(__FUNCTION__ . ':keys', $outcome, 'comment');
    }
  }
1153895
private function validateKey(string $key): void
    {
        $key_pattern = $this->cache->getOptions()->getKeyPattern();

        if ($key === '') {
            throw new InvalidKeyException('An empty key is not allowed');
        } elseif (!empty($key_pattern && !preg_match($key_pattern, $key))) {
            throw new InvalidKeyException(
                sprintf('The key "%s" does not match against pattern "%s"', $key, $key_pattern)
            );
        }
    }
598561
private function validateKeys(array $keys)
    {
        foreach (['block_id', 'page_id', 'manager', 'updated_at'] as $key) {
            if (!isset($keys[$key])) {
                throw new \RuntimeException(sprintf('Please define a `%s` key', $key));
            }
        }
    }
1085712
function __isset($key)
    {
        $isset = false;
        try {
            $isset = (parent::__get($key) !== null);
        } catch(\Exception $e) { }

        return $isset;
    }
1193024
public static function checkOnDisk()
    {
        $args = func_get_args();
        if (count($args) == 2)
            $module = $args[0] . DIRECTORY_SEPARATOR . $args[1];
        elseif (count($args) == 1)
            $module = $args[1];
        else
            throw  new \Exception();
        $module = str_replace('\\', DIRECTORY_SEPARATOR, $module);
        return (bool)app('files')->exists(app_path('Modules') . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Module.php');
    }
651574
private int checkKey(Object key) {
	if (key == null) {
	    throw new NullPointerException("key cannot be null");
	} else if (!(key instanceof Integer)) {
	    throw new IllegalArgumentException("key must be an Integer");
	}
	else {
	    return ((Integer)key).intValue();
	}
    }
972292
public function key()
    {
        return isset( $this->packageNames[$this->index] )
            ? $this->packageNames[$this->index]
            : null;
    }
1088947
public function key()
    {
        if (!self::$session) {
            Exception::i()->setMessage(self::ERROR_NOT_STARTED)->trigger();
        }

        return key($_SESSION);
    }
627869
private function _checkBinds()
    {
        if ($this->_fetch_sty!=\PDO::FETCH_BOUND) {
            return;
        }
        foreach ($this->_binds as $key => &$value) {
            if (is_numeric($key)) {
                $key --;
            } else {
                $key = strtoupper($key);
            }
            if (!array_key_exists($key, $this->_current)) {
                continue;
            }
            $value = $this->_current[$key];
        }
    }