Listing All Available Cryptographic Services : Algorithms « Security « Java






Listing All Available Cryptographic Services

  

import java.security.Provider;
import java.security.Security;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class Main {
  public static void main(String[] argv) throws Exception {
    Set result = new HashSet();
    Provider[] providers = Security.getProviders();
    for (int i = 0; i < providers.length; i++) {
      Set keys = providers[i].keySet();
      for (Iterator it = keys.iterator(); it.hasNext();) {
        String key = (String) it.next();
        key = key.split(" ")[0];

        if (key.startsWith("Alg.Alias.")) {
          // Strip the alias
          key = key.substring(10);
        }
        int ix = key.indexOf('.');
        result.add(key.substring(0, ix));
      }
    }
    System.out.println(result);
  }

}
[KeyFactory, 
TransformService, 
CertPathBuilder, 
Cipher, 
SecureRandom, 
Signature, 
AlgorithmParameterGenerator, 
KeyPairGenerator, 
XMLSignatureFactory, 
CertificateFactory, 
MessageDigest, 
KeyInfoFactory, 
KeyAgreement, 
CertStore, 
Configuration, 
SSLContext, 
SaslServerFactory, 
AlgorithmParameters, 
TrustManagerFactory, 
GssApiMechanism, 
TerminalFactory, 
Mac, 
KeyGenerator, 
Policy, 
CertPathValidator, 
SaslClientFactory, 
SecretKeyFactory, 
KeyManagerFactory, 
KeyStore, 
Provider]

   
    
  








Related examples in the same category

1.What is in bouncycastle (bouncy castle)
2.JCE algorithms in BrowserJCE algorithms in Browser
3.Return the available implementations for a service type
4.Get cryptographic security providers
5.Generating a Parameter Set for the Diffie-Hellman Key Agreement Algorithm