java.security.Provider#propertyNames ( )源码实例Demo

下面列出了java.security.Provider#propertyNames ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: keystore-explorer   文件: DProviderInfo.java
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;
}
 
源代码2 项目: keystore-explorer   文件: DProviderInfo.java
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;
}
 
源代码3 项目: keystore-explorer   文件: DProviderInfo.java
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;
}