本文整理匯總了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;
}