If no key is provided with command line options, check the default
 key location (which can be changed via Configuration class).
 In any case, attempt to initialize the key one way or another.
558475
def initialize_key_source
      detect_key_source
      if args.require_key? && !self.key
        log :error, 'Unable to determine the key, which appears to be required with current args'
        raise Sym::Errors::NoPrivateKeyFound, 'Private key is required when ' + (self.action ? self.action.to_s + 'ypting' : provided_flags.join(', '))
      end
      log :debug, "initialize_key_source: detected key ends with [...#{(key ? key[-5..-1] : 'nil').bold.magenta}]"
      log :debug, "opts: #{self.provided_value_options.to_s.green.bold}"
      log :debug, "flags: #{self.provided_flags.to_s.green.bold}"
    end
1367843
def key_provided?(key_or_default = nil, default_or_options = nil, maybe_options = nil, *others)
      return false if key_or_default.is_a?(Hash)
      return true if key_or_default.is_a?(Symbol) || key_or_default.nil? || key_or_default.is_a?(Array)
      raise ArgumentError.new("invalid key_or_default argument. expected String, Symbol, Array, Hash or nil, got #{key_or_default.class}") unless key_or_default.is_a?(String)
      return true if default_or_options.is_a?(String)
      return true if maybe_options
      return true if key_or_default =~ /\A\.?(\w+\.)+\w+\z/
      false
    end
1334675
def set_key(key: str, value: str) -> dict:
    
    if not _conf.path:
        return {}

    if "toml" in _conf.path:
        with open(_conf.path, "r") as f:
            parser = parse(f.read())
        parser["tool"]["commitizen"][key] = value
        with open(_conf.path, "w") as f:
            f.write(parser.as_string())
    else:
        parser = configparser.ConfigParser()
        parser.read(_conf.path)
        parser["commitizen"][key] = value
        with open(_conf.path, "w") as f:
            parser.write(f)

    return _conf.config
645735
def check_config(opts)
      return if %w[bcrypt init].include?(opts[:command])
      unless File.exists?(opts[:config])
        puts "No config file found at #{opts[:config]}"
        exit(1)
      end
    end
5166
@Override
    public void init(Configuration conf) {
        String rootName = conf.get(ConfigConstants.CONF_DELIMITED_ROOT_NAME, 
                DEFAULT_ROOT_NAME);
        rootStart = '<' + rootName + '>';
        rootEnd = "</" + rootName + '>';
        
    }
927706
def get_config(cls, key, default=None):
        
        return cls._app.config.get(key, default)
1267148
private CodecCipher setInit(Key key, AlgorithmParameters params, AlgorithmParameterSpec spec, SecureRandom random)
    {
        if (key == null)
        {
            throw new IllegalArgumentException("key is null.");
        }

        return setInit(key, params, spec, null, random);
    }
700001
public void initializeKeyStore(boolean reinitialize) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "initializeKeyStore");

        try {
            String initAtStartup = getProperty(Constants.SSLPROP_KEY_STORE_INITIALIZE_AT_STARTUP);
            boolean createIfMissing = LibertyConstants.DEFAULT_KEYSTORE_REF_ID.equals(getProperty("id"));

            if (Boolean.parseBoolean(initAtStartup) || reinitialize) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "Initializing keystore at startup.");
                getKeyStore(reinitialize, createIfMissing);
            }
        } catch (Exception e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Exception initializing KeyStore; " + e);
            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "initializeKeyStore");
    }
148172
def shell_config_cmd(argv):
    ""
    shell = supported_shell()
    if shell:
        print(pew_site / 'shell_config' / ('init.' + shell))
    else:
        err('Completions and prompts are unavailable for %s' %
            repr(os.environ.get('SHELL', '')))
193083
private static synchronized KeyManager[] getDefaultKeyManager() throws KeyStoreException, NoSuchProviderException,
    IOException, CertificateException, NoSuchAlgorithmException, UnrecoverableKeyException {
    final String defaultKeyStore = System.getProperty("javax.net.ssl.keyStore", "");
    String defaultKeyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
    String defaultKeyStoreProvider = System.getProperty("javax.net.ssl.keyStoreProvider", "");

    logDebug("keyStore is : " + defaultKeyStore);
    logDebug("keyStore type is : " + defaultKeyStoreType);
    logDebug("keyStore provider is : " + defaultKeyStoreProvider);

    if (P11KEYSTORE.equals(defaultKeyStoreType) && !NONE.equals(defaultKeyStore)) {
      throw new IllegalArgumentException("if keyStoreType is " + P11KEYSTORE + ", then keyStore must be " + NONE);
    }

    KeyStore ks = null;
    String defaultKeyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword", "");
    char[] passwd = defaultKeyStorePassword.isEmpty() ? null : defaultKeyStorePassword.toCharArray();

    // Try to initialize key store.
    if (!defaultKeyStoreType.isEmpty()) {
      logDebug("init keystore");
      if (defaultKeyStoreProvider.isEmpty()) {
        ks = KeyStore.getInstance(defaultKeyStoreType);
      } else {
        ks = KeyStore.getInstance(defaultKeyStoreType, defaultKeyStoreProvider);
      }
      if (!defaultKeyStore.isEmpty() && !NONE.equals(defaultKeyStore)) {
        try (FileInputStream fs = new FileInputStream(defaultKeyStore)) {
          ks.load(fs, passwd);
        }
      } else {
        ks.load(null, passwd);
      }
    }

    // Try to initialize key manager.
    logDebug("init keymanager of type " + KeyManagerFactory.getDefaultAlgorithm());
    KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

    if (P11KEYSTORE.equals(defaultKeyStoreType)) {
      // do not pass key passwd if using token
      kmf.init(ks, null);
    } else {
      kmf.init(ks, passwd);
    }

    return kmf.getKeyManagers();
  }
173633
def check_settings!
      required_keys = %w(
        org
        project
      )

      required_keys.each do |key|
        unless Settings.send key
          error = "Config is missing required key '#{key}'. Please add it " \
            "to #{config_path} and try again."
          error += "\n\nFor more info, see https://github.com/jutonz/dctl_rb#required-keys"
          puts Rainbow(error).red
          exit 1
        end
      end
    end
236632
@Override
	public void init(Key key, IvParameterSpec iv) throws InvalidKeyException {
		if(!(key instanceof SecretKey))
			throw new InvalidKeyException();
		int ivLength = iv.getIV().length;
		if(key.getEncoded().length < MIN_KEY_SIZE || key.getEncoded().length < ivLength)
			throw new InvalidKeyException("Key must be longer than " + MIN_KEY_SIZE + " bytes and key must be longer than IV.");
		this.key = key.getEncoded();
		this.iv = iv;
		prehash = Misc.XORintoA(this.key.length == ivLength ? iv.getIV() : Arrays.copyOf(iv.getIV(), this.key.length), this.key);
		blockNo = 0;
		buffer = new ByteQueue(getBlockSize()*2);
		buffer.setResizable(true);
		cfg = true;
	}
845060
def _check_key(self, key):
        
        self.setup_schema()
        if key not in self._attrs and key not in self:
            raise KeyError(key)
754188
def get(self, key: str, default: Any = DEFAULT):
        
        if default is self.DEFAULT:
            try:
                value = self.params.get(key)
            except KeyError:
                raise ConfigurationError("key \"{}\" is required at location \"{}\"".format(key, self.history))
        else:
            value = self.params.get(key, default)
        return self._check_is_dict(key, value)
863536
public void setKey(String key) {
        if (!isValidParamKey(key)) {
            throw ExceptionUtils.buildRuntime("param.key", key, "key can not start with "
                + RpcConstants.HIDE_KEY_PREFIX + " and " + RpcConstants.INTERNAL_KEY_PREFIX);
        }
        this.key = key;
    }
212888
function init() {
  // Retrieve any arguments passed in via the command line
  args = cliConfig.getArguments();

  // Supply usage info if help argument was passed
  if (args.help) {
    console.log(cliConfig.getUsage());
    process.exit(0);
  }

  getClientAuth(function(data) {
    parseClientAuth(data, function(err, data) {
      if (err) {
        console.error(err.message);
        process.exit(0);
      }
      writeEdgerc(data, function(err) {
        if (err) {
          if (err.errno == -13) {
            console.error("Unable to access " + err.path + ". Please make sure you " +
              "have permission to access this file or perhaps try running the " +
              "command as sudo.");
            process.exit(0);
          }
        }
        console.log("The section '" + args.section + "' has been succesfully added to " + args.path + "\n");
      });
    });
  });
}
1099971
def in_config(self, key):
        
        # if the requested key is an alias, then return the proper key
        key = self._real_key(key)

        exists = self._config.get(key)
        return exists