本文整理汇总了Java中java.security.Provider.getServices方法的典型用法代码示例。如果您正苦于以下问题:Java Provider.getServices方法的具体用法?Java Provider.getServices怎么用?Java Provider.getServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.Provider
的用法示例。
在下文中一共展示了Provider.getServices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listCiphers
import java.security.Provider; //导入方法依赖的package包/类
private static void listCiphers(Queue<String> arguments) {
for (Provider provider : Security.getProviders()) {
for (Provider.Service service : provider.getServices()) {
if (service.getType().equals("Cipher")) {
System.out.println("Provider: " + provider.getName() + " Algorithm: " + service.getAlgorithm());
}
}
}
}
示例2: main
import java.security.Provider; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
for (Provider p : Security.getProviders()) {
for (Provider.Service s : p.getServices()) {
if (s.getType().equals("SecureRandom") &&
!s.getAlgorithm().contains("Block")) {
test(SecureRandom.getInstance(s.getAlgorithm(), p));
}
}
}
Security.setProperty("securerandom.drbg.config", "HMAC_DRBG");
test(SecureRandom.getInstance("DRBG"));
Security.setProperty("securerandom.drbg.config", "CTR_DRBG");
test(SecureRandom.getInstance("DRBG"));
}
示例3: listKeyGenerators
import java.security.Provider; //导入方法依赖的package包/类
private static void listKeyGenerators(Queue<String> arguments) {
for (Provider provider : Security.getProviders()) {
for (Provider.Service service : provider.getServices()) {
if (service.getType().equals("KeyGenerator")) {
System.out.println("Provider: " + provider.getName() + " Algorithm: " + service.getAlgorithm());
}
}
}
}
示例4: getSupportedAlgorithms
import java.security.Provider; //导入方法依赖的package包/类
/**
* Returns supported algorithms of specified type.
*/
static List<String> getSupportedAlgorithms(String type, String alg,
Provider p) {
// prepare a list of supported algorithms
List<String> algorithms = new ArrayList<>();
Set<Provider.Service> services = p.getServices();
for (Provider.Service service : services) {
if (service.getType().equals(type)
&& service.getAlgorithm().startsWith(alg)) {
algorithms.add(service.getAlgorithm());
}
}
return algorithms;
}