Ensure all required RSA parameters are present in dictionary
171875
def ensure_rsa_params(jwk_dict, private):
    """"""
    provided = frozenset(jwk_dict.keys())
    if private is not None and private:
        required = RSA_PUBLIC_REQUIRED | RSA_PRIVATE_REQUIRED
    else:
        required = RSA_PUBLIC_REQUIRED
    return ensure_params('RSA', provided, required)
807191
def check_params(**kwargs):
    

    missing_params = []
    check = True

    for param in kwargs:
        if kwargs[param] is None:
            missing_params.append(param)

    if len(missing_params) > 0:
        print("POT - Warning: following necessary parameters are missing")
        for p in missing_params:
            print("\n", p)

        check = False

    return check
778305
def _validate_and_get_value(options, options_name, key, _type):
  
  if isinstance(options, dict):
    has = lambda k: k in options
    get = lambda k: options[k]
  elif isinstance(options, object):
    has = lambda k: hasattr(options, k)
    get = lambda k: getattr(options, k)
  else:
    raise ImproperlyConfigured(
        '`{}` must be a dictionary-like object.'.format(options_name))

  if not has(key):
    raise ImproperlyConfigured(
        '`{}` must be specified in `{}`'.format(key, options_name))

  value = get(key)
  if not isinstance(value, _type):
    raise ImproperlyConfigured(
        '`{}` in `{}` must be a {}'.format(key, options_name, repr(_type)))

  return value
52932
def _get_parameter_dictionary(self, base_name, dictionary, sorted_keys, parameter):
        

        # assemble the key for this parameter
        k = base_name + "/" + parameter.name()

        # first add this parameter (if it has a value)
        if not parameter.value()==None:
            sorted_keys.append(k[1:])
            dictionary[sorted_keys[-1]] = parameter.value()

        # now loop over the children
        for p in parameter.children():
            self._get_parameter_dictionary(k, dictionary, sorted_keys, p)
521819
def format_parameters(self, params):
        # type: (Dict[str, str]) -> None
        
        query = urlparse(self.url).query
        if query:
            self.url = self.url.partition('?')[0]
            existing_params = {
                p[0]: p[-1]
                for p in [p.partition('=') for p in query.split('&')]
            }
            params.update(existing_params)
        query_params = ["{}={}".format(k, v) for k, v in params.items()]
        query = '?' + '&'.join(query_params)
        self.url = self.url + query
366597
def _complete_parameters(param, variables):
    
    if isinstance(param, list):
        return [_complete_parameters(x, variables) for x in param]
    elif isinstance(param, dict):
        return {key: _complete_parameters(value, variables) for key, value in param.items()}
    elif isinstance(param, str):
        try:
            return Template(param).substitute(variables)
        except KeyError as exc:
            raise RecipeVariableNotPassed("Variable undefined in recipe", undefined_variable=exc.args[0])

    return param
138371
def set_param(self, key, value):
        
        self.__dict__[key] = value
        self._parameters[key] = value
369903
def _ensureRequired(self):
        

        for configName, configDict in self.configs.items():
            if configDict['required']:
                if getattr(self._config, configName) is None:
                    raise MissingConfigurationException(configName)
269039
def _check_member_parameters(self, **kwargs):
        """"""
        if 'fqdn' in kwargs:
            kwargs['fqdn'].pop('autopopulate', '')
            kwargs['fqdn'].pop('addressFamily', '')
        if 'fqdn' in self.__dict__:
            self.__dict__['fqdn'].pop('autopopulate', '')
            self.__dict__['fqdn'].pop('addressFamily', '')
        if 'state' in kwargs:
            if kwargs['state'] != 'user-up' and kwargs['state'] != \
                    'user-down':
                kwargs.pop('state')
        if 'state' in self.__dict__:
            if self.__dict__['state'] != 'user-up' and self.__dict__['state'] \
                    != 'user-down':
                self.__dict__.pop('state')
        if 'session' in kwargs:
            if kwargs['session'] != 'user-enabled' and kwargs['session'] != \
                    'user-disabled':
                kwargs.pop('session')
        if 'session' in self.__dict__:
            if self.__dict__['session'] != 'user-enabled' and \
                    self.__dict__['session'] != 'user-disabled':
                self.__dict__.pop('session')
        # Until we implement sanity checks for __dict__ this needs to stay here
        self.__dict__.pop('ephemeral', '')
        self.__dict__.pop('address', '')
        return kwargs
786974
def validate_input parameters
				unless parameters.is_a?(Hash)
					raise StockException, 'Given parameters have to be a hash.'
				end

				# Check if stock symbol is specified.
				unless parameters.has_key?(:symbol)
					raise StockException, 'No stock symbol specified.'
				end
				# Check if stock symbol is a string.
				unless parameters[:symbol].is_a?(String)
					raise StockException, 'Stock symbol must be a string.'
				end

				# Use today date if :end_date is not specified.
				unless parameters.has_key?(:end_date)
					parameters[:end_date] = Date.today.strftime("%Y-%m-%d")
				end

				unless parameters.has_key?(:start_date)
					raise StockException, 'Start date must be specified.'
				end
	 			
				unless DATE_REGEX.match(parameters[:start_date])
					raise StockException, 'Invalid start date specified. Format YYYY-MM-DD.'
				end

				unless DATE_REGEX.match(parameters[:end_date])
					raise StockException, 'Invalid end date specified. Format YYYY-MM-DD.'
				end

				unless parameters[:start_date].to_date < parameters[:end_date].to_date
					raise StockException, 'End date must be greater than the start date.'
				end

				unless parameters[:start_date].to_date < Date.today
					raise StockException, 'Start date must not be in the future.'
				end

				# Set to default :type if key isn't specified.
				parameters[:type] = :daily if !parameters.has_key?(:type)

				unless TYPE_CODES_ARRAY.has_key?(parameters[:type])
					raise StockException, 'Invalid type specified.'
				end
			end
338542
private void validateParameters(String filePath, String password, int validity, String subjectDN, int keySize, String sigAlg) {
        if (!validateFilePath(filePath)) {
            throw new IllegalArgumentException("filePath must be a valid filePath within the file system.");
        }
        if (password == null || password.length() < MINIMUM_PASSWORD_LENGTH) {
            throw new IllegalArgumentException("The password must be at least " +
                                               MINIMUM_PASSWORD_LENGTH +
                                               " characters in length.");
        }
        if (validity < MINIMUM_VALIDITY) {
            throw new IllegalArgumentException("The validity period must be at least " +
                                               MINIMUM_VALIDITY + " days.");
        }

        List<String> validSigAlg = VALID_SIG_ALG;
        if (!validSigAlg.contains(sigAlg)) {
            throw new IllegalArgumentException("The signagure algorithm values include " + VALID_SIG_ALG);
        }

        String type = getKeyFromSigAlg(sigAlg);
        if (type.equals(KEYALG_RSA_TYPE)) {
            List<Integer> validKeySizes = VALID_RSA_KEYSIZE;
            if (!validKeySizes.contains(keySize)) {
                throw new IllegalArgumentException("The key sizes for an RSA key include " + VALID_RSA_KEYSIZE);
            }
        } else {
            List<Integer> validKeySizes = VALID_EC_KEYSIZE;
            if (!validKeySizes.contains(keySize)) {
                throw new IllegalArgumentException("The key sizes for an EC key include " + VALID_EC_KEYSIZE);
            }
        }

        validateSubjectDN(subjectDN);
    }
1000769
def validate_config_parameters(config_json, allowed_keys, allowed_types):
    """"""
    custom_fields = config_json.get(defs.PARAMETERS, [])
    for field in custom_fields:
        validate_field(field, allowed_keys, allowed_types)
        default = field.get(defs.DEFAULT)
        field_type = field.get(defs.TYPE)
        if default:
            validate_field_matches_type(field[defs.VALUE], default, field_type)
286632
def dict_from_locals(self, name, params: List[Parameter], not_specified_literal=Constants.VALUE_NOT_SET):
        
        code = self.block(f"{name} = {{}}")
        for p in params:
            code.add(
                self.block(f"if {p.name} is not {not_specified_literal}:").of(
                    f"{name}[{p.name!r}] = {p.name}"
                ),
            )
        return code
984298
function (certparams) {
    var keys = forge.pki.rsa.generateKeyPair(2048);
    this.publicKey = keys.publicKey;
    this.privateKey = keys.privateKey;
    this.cert = this.createCertificate(certparams);
    this.keycred = null;
    this.digest = null;
}
289738
def x509_rsa_load(txt):
    
    pub_key = import_rsa_key(txt)
    if isinstance(pub_key, rsa.RSAPublicKey):
        return [("rsa", pub_key)]
1314642
def _pv_required(opts, key, is_required=true)
        if is_required
          if (opts.has_key?(key.to_s) && !opts[key.to_s].nil?) ||
              (opts.has_key?(key.to_sym) && !opts[key.to_sym].nil?)
            true
          else
            raise ValidationFailed, "Required argument #{key} is missing!"
          end
        end
      end
1012559
def _check_command_parameters(self, **kwargs):
        
        rset = self._meta_data['required_command_parameters']
        check = _missing_required_parameters(rset, **kwargs)
        if check:
            error_message = 'Missing required params: %s' % check
            raise MissingRequiredCommandParameter(error_message)