X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.core%2Fsrc%2Ftest%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fcrypto%2FListBCCapabilities.java;fp=security%2Fruntime%2Forg.argeo.security.core%2Fsrc%2Ftest%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fcrypto%2FListBCCapabilities.java;h=a95fba274a04dbda397a6986df072ead7cd26d76;hb=9884b3225a86b831917b10376925eebcbf99e513;hp=0000000000000000000000000000000000000000;hpb=b39c9bfa7a3fc0b2dae3c85fedfad1062bd03f39;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.core/src/test/java/org/argeo/security/crypto/ListBCCapabilities.java b/security/runtime/org.argeo.security.core/src/test/java/org/argeo/security/crypto/ListBCCapabilities.java new file mode 100644 index 000000000..a95fba274 --- /dev/null +++ b/security/runtime/org.argeo.security.core/src/test/java/org/argeo/security/crypto/ListBCCapabilities.java @@ -0,0 +1,43 @@ +package org.argeo.security.crypto; + +import java.security.Provider; +import java.security.Security; +import java.util.Iterator; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +/** + * List the available capabilities for ciphers, key agreement, macs, message + * digests, signatures and other objects in the BC provider. + */ +public class ListBCCapabilities { + public static void main(String[] args) { + Security.addProvider(new BouncyCastleProvider()); + + Provider[] providers = Security.getProviders(); + for (Provider provider : providers) { + System.out.println(provider.getName()); + System.out.println(" " + provider.getVersion()); + System.out.println(" " + provider.getInfo()); + } + Provider provider = Security.getProvider("BC"); + // Provider provider = Security.getProvider(null); + + Iterator it = provider.keySet().iterator(); + + while (it.hasNext()) { + String entry = (String) it.next(); + + // this indicates the entry refers to another entry + + if (entry.startsWith("Alg.Alias.")) { + entry = entry.substring("Alg.Alias.".length()); + } + + String factoryClass = entry.substring(0, entry.indexOf('.')); + String name = entry.substring(factoryClass.length() + 1); + + System.out.println(factoryClass + ": " + name); + } + } +}