java.security.Provider.propertyNames()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中java.security.Provider.propertyNames()方法的一些代码示例,展示了Provider.propertyNames()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Provider.propertyNames()方法的具体详情如下:
包路径:java.security.Provider
类名称:Provider
方法名:propertyNames

Provider.propertyNames介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Returns value for the specified algorithm with the specified name.
 *
 * @param algName
 *            the name of the algorithm.
 * @param propName
 *            the name of the property.
 * @return value of the property.
 * @deprecated Use {@link AlgorithmParameters} and {@link KeyFactory} instead.
 */
@Deprecated
public static String getAlgorithmProperty(String algName, String propName) {
  if (algName == null || propName == null) {
    return null;
  }
  String prop = "Alg." + propName + "." + algName;
  Provider[] providers = getProviders();
  for (Provider provider : providers) {
    for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
      String propertyName = (String) e.nextElement();
      if (propertyName.equalsIgnoreCase(prop)) {
        return provider.getProperty(propertyName);
      }
    }
  }
  return null;
}

代码示例来源:origin: robovm/robovm

/**
 * Returns the property with the specified key in the provider properties.
 * The name is not case-sensitive.
 */
private String getPropertyIgnoreCase(String key) {
  String res = getProperty(key);
  if (res != null) {
    return res;
  }
  for (Enumeration<?> e = propertyNames(); e.hasMoreElements(); ) {
    String propertyName = (String) e.nextElement();
    if (key.equalsIgnoreCase(propertyName)) {
      return getProperty(propertyName);
    }
  }
  return null;
}

代码示例来源:origin: kaikramer/keystore-explorer

private String[] getServiceAlgorithms(String serviceType, Provider provider) {
  /*
   * Match provider property names that start "<service type>." and do not
   * contain a space. What follows the '.' is the algorithm name
   */
  String match = serviceType + ".";
  ArrayList<String> algorithmList = new ArrayList<String>();
  for (Enumeration<?> names = provider.propertyNames(); names.hasMoreElements();) {
    String key = (String) names.nextElement();
    if (key.startsWith(match) && key.indexOf(' ') == -1) {
      String algorithm = key.substring(key.indexOf('.') + 1);
      algorithmList.add(algorithm);
    }
  }
  String[] algorithms = algorithmList.toArray(new String[algorithmList.size()]);
  Arrays.sort(algorithms);
  return algorithms;
}

代码示例来源:origin: kaikramer/keystore-explorer

private String getAlgorithmClass(String algorithm, String serviceType, Provider provider) {
  /*
   * Looking for the property name that matches
   * "<service type>.<algorithm>". The value of the property is the class
   * name
   */
  String match = serviceType + "." + algorithm;
  for (Enumeration<?> names = provider.propertyNames(); names.hasMoreElements();) {
    String key = (String) names.nextElement();
    if (key.equals(match)) {
      return provider.getProperty(key);
    }
  }
  return null;
}

代码示例来源:origin: kaikramer/keystore-explorer

private String[] getAlgorithmAttributes(String algorithm, String serviceType, Provider provider) {
  /*
   * Looking for property names matching "<service type>.<algorithm> ".
   * The attribute name if the text following the ' ' while the attribute
   * value is the value of the property. Return in alpha order by name.
   * Returned value is 'name=value'
   */
  String matchAttr = serviceType + "." + algorithm + " ";
  TreeMap<String, String> attributeMap = new TreeMap<String, String>();
  for (Enumeration<?> names = provider.propertyNames(); names.hasMoreElements();) {
    String key = (String) names.nextElement();
    if (key.startsWith(matchAttr)) {
      String attrName = key.substring(key.indexOf(' ') + 1);
      String attributeDisplay = MessageFormat.format(res.getString("DProviderInfo.AttributeNode.text"),
          attrName, provider.getProperty(key));
      attributeMap.put(attrName, attributeDisplay);
    }
  }
  ArrayList<String> attributes = new ArrayList<String>();
  for (String key : attributeMap.keySet()) {
    attributes.add(attributeMap.get(key));
  }
  return attributes.toArray(new String[attributes.size()]);
}

代码示例来源:origin: kaikramer/keystore-explorer

private String[] getAlgorithmAliases(String algorithm, String serviceType, Provider provider) {
  /*
   * Looking to match property names with key "Alg.Alias.<service type>."
   * and value of algorithm. The alias is the text following the '.' in
   * the property name. Return in alpha order
   */
  String matchAlias = "Alg.Alias." + serviceType + ".";
  ArrayList<String> aliasList = new ArrayList<String>();
  for (Enumeration<?> names = provider.propertyNames(); names.hasMoreElements();) {
    String key = (String) names.nextElement();
    if (provider.getProperty(key).equals(algorithm)) {
      if (key.startsWith(matchAlias)) {
        String alias = key.substring(matchAlias.length());
        aliasList.add(alias);
      }
    }
  }
  String[] aliases = aliasList.toArray(new String[aliasList.size()]);
  Arrays.sort(aliases);
  return aliases;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns the property with the specified key in the provider properties.
 * The name is not case-sensitive.
 */
private String getPropertyIgnoreCase(String key) {
  String res = getProperty(key);
  if (res != null) {
    return res;
  }
  for (Enumeration<?> e = propertyNames(); e.hasMoreElements(); ) {
    String propertyName = (String) e.nextElement();
    if (key.equalsIgnoreCase(propertyName)) {
      return getProperty(propertyName);
    }
  }
  return null;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns value for the specified algorithm with the specified name.
 *
 * @param algName
 *            the name of the algorithm.
 * @param propName
 *            the name of the property.
 * @return value of the property.
 * @deprecated Use {@link AlgorithmParameters} and {@link KeyFactory} instead.
 */
@Deprecated
public static String getAlgorithmProperty(String algName, String propName) {
  if (algName == null || propName == null) {
    return null;
  }
  String prop = "Alg." + propName + "." + algName;
  Provider[] providers = getProviders();
  for (Provider provider : providers) {
    for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
      String propertyName = (String) e.nextElement();
      if (propertyName.equalsIgnoreCase(prop)) {
        return provider.getProperty(propertyName);
      }
    }
  }
  return null;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Returns value for the specified algorithm with the specified name.
 *
 * @param algName
 *            the name of the algorithm.
 * @param propName
 *            the name of the property.
 * @return value of the property.
 * @deprecated Use {@link AlgorithmParameters} and {@link KeyFactory} instead.
 */
@Deprecated
public static String getAlgorithmProperty(String algName, String propName) {
  if (algName == null || propName == null) {
    return null;
  }
  String prop = "Alg." + propName + "." + algName;
  Provider[] providers = getProviders();
  for (Provider provider : providers) {
    for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
      String propertyName = (String) e.nextElement();
      if (propertyName.equalsIgnoreCase(prop)) {
        return provider.getProperty(propertyName);
      }
    }
  }
  return null;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns value for the specified algorithm with the specified name.
 *
 * @param algName
 *            the name of the algorithm.
 * @param propName
 *            the name of the property.
 * @return value of the property.
 * @deprecated Use {@link AlgorithmParameters} and {@link KeyFactory} instead.
 */
@Deprecated
public static String getAlgorithmProperty(String algName, String propName) {
  if (algName == null || propName == null) {
    return null;
  }
  String prop = "Alg." + propName + "." + algName;
  Provider[] providers = getProviders();
  for (Provider provider : providers) {
    for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
      String propertyName = (String) e.nextElement();
      if (propertyName.equalsIgnoreCase(prop)) {
        return provider.getProperty(propertyName);
      }
    }
  }
  return null;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Returns the property with the specified key in the provider properties.
 * The name is not case-sensitive.
 */
private String getPropertyIgnoreCase(String key) {
  String res = getProperty(key);
  if (res != null) {
    return res;
  }
  for (Enumeration<?> e = propertyNames(); e.hasMoreElements(); ) {
    String propertyName = (String) e.nextElement();
    if (key.equalsIgnoreCase(propertyName)) {
      return getProperty(propertyName);
    }
  }
  return null;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns value for the specified algorithm with the specified name.
 *
 * @param algName
 *            the name of the algorithm.
 * @param propName
 *            the name of the property.
 * @return value of the property.
 * @deprecated Use {@link AlgorithmParameters} and {@link KeyFactory} instead.
 */
@Deprecated
public static String getAlgorithmProperty(String algName, String propName) {
  if (algName == null || propName == null) {
    return null;
  }
  String prop = "Alg." + propName + "." + algName;
  Provider[] providers = getProviders();
  for (Provider provider : providers) {
    for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
      String propertyName = (String) e.nextElement();
      if (propertyName.equalsIgnoreCase(prop)) {
        return provider.getProperty(propertyName);
      }
    }
  }
  return null;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns the property with the specified key in the provider properties.
 * The name is not case-sensitive.
 */
private String getPropertyIgnoreCase(String key) {
  String res = getProperty(key);
  if (res != null) {
    return res;
  }
  for (Enumeration<?> e = propertyNames(); e.hasMoreElements(); ) {
    String propertyName = (String) e.nextElement();
    if (key.equalsIgnoreCase(propertyName)) {
      return getProperty(propertyName);
    }
  }
  return null;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns value for the specified algorithm with the specified name.
 *
 * @param algName
 *            the name of the algorithm.
 * @param propName
 *            the name of the property.
 * @return value of the property.
 * @deprecated Use {@link AlgorithmParameters} and {@link KeyFactory} instead.
 */
@Deprecated
public static String getAlgorithmProperty(String algName, String propName) {
  if (algName == null || propName == null) {
    return null;
  }
  String prop = "Alg." + propName + "." + algName;
  Provider[] providers = getProviders();
  for (Provider provider : providers) {
    for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
      String propertyName = (String) e.nextElement();
      if (propertyName.equalsIgnoreCase(prop)) {
        return provider.getProperty(propertyName);
      }
    }
  }
  return null;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns the property with the specified key in the provider properties.
 * The name is not case-sensitive.
 */
private String getPropertyIgnoreCase(String key) {
  String res = getProperty(key);
  if (res != null) {
    return res;
  }
  for (Enumeration<?> e = propertyNames(); e.hasMoreElements(); ) {
    String propertyName = (String) e.nextElement();
    if (key.equalsIgnoreCase(propertyName)) {
      return getProperty(propertyName);
    }
  }
  return null;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns the property with the specified key in the provider properties.
 * The name is not case-sensitive.
 */
private String getPropertyIgnoreCase(String key) {
  String res = getProperty(key);
  if (res != null) {
    return res;
  }
  for (Enumeration<?> e = propertyNames(); e.hasMoreElements(); ) {
    String propertyName = (String) e.nextElement();
    if (key.equalsIgnoreCase(propertyName)) {
      return getProperty(propertyName);
    }
  }
  return null;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns the property with the specified key in the provider properties.
 * The name is not case-sensitive.
 */
private String getPropertyIgnoreCase(String key) {
  String res = getProperty(key);
  if (res != null) {
    return res;
  }
  for (Enumeration<?> e = propertyNames(); e.hasMoreElements(); ) {
    String propertyName = (String) e.nextElement();
    if (key.equalsIgnoreCase(propertyName)) {
      return getProperty(propertyName);
    }
  }
  return null;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns value for the specified algorithm with the specified name.
 *
 * @param algName
 *            the name of the algorithm.
 * @param propName
 *            the name of the property.
 * @return value of the property.
 * @deprecated Use {@link AlgorithmParameters} and {@link KeyFactory} instead.
 */
@Deprecated
public static String getAlgorithmProperty(String algName, String propName) {
  if (algName == null || propName == null) {
    return null;
  }
  String prop = "Alg." + propName + "." + algName;
  Provider[] providers = getProviders();
  for (Provider provider : providers) {
    for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
      String propertyName = (String) e.nextElement();
      if (propertyName.equalsIgnoreCase(prop)) {
        return provider.getProperty(propertyName);
      }
    }
  }
  return null;
}

相关文章