Security Java

/*
KeyGenerator:
            HMAC-MD2
            GOST
            HMACRIPEMD160
            ARC4
            CAST5
            2.16.840.1.101.3.4.1.44
            HMAC-SHA384
            2.16.840.1.101.3.4.2
            HMAC-MD4
            HMAC-SHA1
            HMAC-RIPEMD128
            HMAC-SHA512
            2.16.840.1.101.3.4.1.5
            DESEDEWRAP
            TWOFISH
            HMACMD4
            2.16.840.1.101.3.4.1.24
            2.16.840.1.101.3.4.1.42
            RIJNDAEL
            IDEA
            2.16.840.1.101.3.4.42
            RC4
            1.2.840.113549.2.10
            RC5
            HMAC-MD5
            2.16.840.1.101.3.4.22
            HMAC-SHA224
            1.2.840.113533.7.66.10
            BLOWFISH
            HMACMD2
            HMACRIPEMD128
            RC2
            2.16.840.1.101.3.4.1.23
            GOST-28147
            1.2.840.113549.2.9
            HMACSHA512
            DESEDE
            CAMELLIA
            SERPENT
            RC5-64
            RC5-32
            HMAC-SHA256
            HMACSHA384
            HMAC-RIPEMD160
            1.2.840.113549.3.7
            AESWRAP
            HMACTIGER
            2.16.840.1.101.3.4.1.22
            RC6
            HMACMD5
            1.2.840.113549.2.7
            HMACSHA256
            1.3.14.3.2.7
            2.16.840.1.101.3.4.1.21
            2.16.840.1.101.3.4.1.2
            1.2.643.2.2.21
            1.2.840.113549.2.8
            1.2.840.113549.2.11
            1.2.840.113549.3.4
            2.16.840.1.101.3.4.1.45
            2.16.840.1.101.3.4.1.41
            2.16.840.1.101.3.4.1.1
            2.16.840.1.101.3.4.1.3
            HMACSHA224
            2.16.840.1.101.3.4.1.43
            2.16.840.1.101.3.4.1.4
            1.3.6.1.4.1.188.7.1.1.2
            2.16.840.1.101.3.4.1.25
            CAST6
            HMACSHA1
            1.2.840.113549.3.2
            SKIPJACK
            AES
            DES
            GOST28147
KeyFactory:
            EC
            ECDH
            1.2.840.113549.1.1
            OID.1.2.840.113549.1.1
            1.2.643.2.2.19
            DH
            ECDSA
            1.3.14.3.2.12
            1.2.840.113549.1.1.1
            GOST-3410-94
            RSA
            ECGOST-3410
            1.2.840.10045.2.1
            DSA ImplementedIn
            GOST3410
            DSA
            GOST-3410
            ELGAMAL
            1.2.840.10040.4.1
            1.2.643.2.2.20
            ECDHC
            GOST-3410-2001
            ECGOST3410
            ElGamal
KeyPairGenerator:
            EC
            ECDH
            1.2.840.113549.1.1
            OID.1.2.840.113549.1.1
            DSA KeySize
            DH
            1.3.14.3.2.12
            ECDSA
            OID.1.2.840.10040.4.1
            1.2.840.113549.1.1.1
            GOST-3410-94
            ECGOST-3410
            RSA
            GOST3410
            ECIES
            DSA ImplementedIn
            GOST-3410
            DSA
            ELGAMAL
            1.2.840.10040.4.1
            ECDHC
            GOST-3410-2001
            ECGOST3410
Ciphers:
            ELGAMAL/NONE/NOPADDING
            RSA//NOPADDING
            PBEWITHSHA1AND192BITAES-CBC-BC
            OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC
            1.2.840.113549.1.1.7
            CAST5
            ELGAMAL/PKCS1
            PBEWITHSHA1AND128BITRC2-CBC
            1.2.840.113549.1.12.1.3
            ECIES
            RSA//RAW
            PBEWITHSHAAND40BITRC2-CBC
            PBEWITHSHAAND3-KEYTRIPLEDES-CBC
            2.16.840.1.101.3.4.1.5
            1.2.840.113549.1.12.1.6
            DESEDEWRAP
            PBEWITHSHA-1AND192BITAES-CBC-BC
            2.16.840.1.101.3.4.1.24
            2.16.840.1.101.3.4.1.42
            PBEWITHSHA256AND256BITAES-CBC-BC
            RIJNDAEL
            IDEA
            2.16.840.1.101.3.4.42
            RC4
            PBEWITHSHA1AND128BITAES-CBC-BC
            PBEWITHSHA-1AND256BITAES-CBC-BC
            RC5
            1.2.840.113549.1.12.1.2
            RC2
            1.2.840.113549.1.9.16.3.6
            PBEWITHSHA1ANDDESEDE
            RSA/OAEP
            SERPENT
            RC5-64
            RC5-32
            1.2.840.113549.3.7
            AESWRAP
            RSA/PKCS1
            2.16.840.1.101.3.4.1.22
            RC6
            PBEWITHMD5ANDRC2
            2.16.840.1.101.3.4.1.2
            2.16.840.1.101.3.4.1.21
            ARCFOUR
            1.2.643.2.2.21
            2.5.8.1.1
            IES
            1.2.840.113549.1.12.1.5
            2.16.840.1.101.3.4.1.45
            2.16.840.1.101.3.4.1.41
            2.16.840.1.101.3.4.1.1
            2.16.840.1.101.3.4.1.3
            PBEWITHSHA1ANDRC2
            RSA//OAEPPADDING
            2.16.840.1.101.3.4.1.43
            2.16.840.1.101.3.4.1.4
            PBEWITHSHA1AND40BITRC2-CBC
            PBEWITHSHAAND256BITAES-CBC-BC
            PBEWITHSHA256AND192BITAES-CBC-BC
            SKIPJACK
            DES
            PBEWITHSHAAND40BITRC4
            BROKENPBEWITHMD5ANDDES
            PBEWITHMD5AND256BITAES-CBC-OPENSSL
            PBEWITHSHA1AND2-KEYTRIPLEDES-CBC
            RSA/1
            PBEWITHMD5AND192BITAES-CBC-OPENSSL
            GOST
            ARC4
            PBEWITHSHAAND128BITRC4
            1.2.840.113549.1.12.1.1
            RSA/2
            2.16.840.1.101.3.4.1.44
            RSA//ISO9796-1PADDING
            PBEWITHSHAAND2-KEYTRIPLEDES-CBC
            2.16.840.1.101.3.4.2
            RC2WRAP
            PBEWITHSHA-256AND256BITAES-CBC-BC
            PBEWITHSHA1ANDDES
            PBEWITHSHAANDTWOFISH-CBC
            TWOFISH
            1.2.840.113549.1.9.16.3.7
            ELGAMAL/NONE/PKCS1PADDING
            1.2.840.113549.1.12.1.4
            PBEWITHSHAAND128BITRC2-CBC
            PBEWITHSHA1AND128BITRC4
            PBEWITHSHAAND192BITAES-CBC-BC
            2.16.840.1.101.3.4.22
            PBEWithSHAAnd3KeyTripleDES
            BLOWFISH
            1.2.840.113533.7.66.10
            2.16.840.1.101.3.4.1.23
            GOST-28147
            ELGAMAL/ECB/PKCS1PADDING
            DESEDE
            PBEWITHSHA-256AND128BITAES-CBC-BC
            RSA/ISO9796-1
            RSA//PKCS1PADDING
            CAMELLIA
            PBEWITHSHA-1AND128BITAES-CBC-BC
            BROKENPBEWITHSHA1ANDDES
            BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC
            PBEWITHSHA1AND3-KEYTRIPLEDES-CBC
            RSA
            ELGAMAL
            PBEWITHSHA256AND128BITAES-CBC-BC
            RSA/RAW
            1.3.14.3.2.7
            PBEWITHSHA-256AND192BITAES-CBC-BC
            PBEWITHSHA1AND40BITRC4
            1.2.840.113549.3.4
            PBEWITHMD5AND128BITAES-CBC-OPENSSL
            BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC
            PBEWITHSHAAND128BITAES-CBC-BC
            1.2.840.113549.1.1.1
            OLDPBEWITHSHAANDTWOFISH-CBC
            2.16.840.1.101.3.4.1.25
            1.3.6.1.4.1.188.7.1.1.2
            CAST6
            PBEWITHSHA1AND256BITAES-CBC-BC
            1.2.840.113549.3.2
            PBEWITHSHAANDIDEA-CBC
            AES
            PBEWITHMD5ANDDES
            GOST28147
KeyAgreeents:
            ECDH
            ECDHC
            DH
Macs:
            RC2MAC
            HMAC-MD2
            IDEAMAC/CFB8
            HMAC/SHA512
            HMACRIPEMD160
            RC5MAC
            HMAC-SHA384
            HMAC-MD4
            HMAC/SHA1
            DESEDEMAC64
            HMAC-SHA1
            HMAC-RIPEMD128
            HMAC-SHA512
            HMAC/RIPEMD128
            GOST28147MAC
            PBEWITHHMACRIPEMD160
            PBEWITHHMACSHA1
            RC2MAC/CFB8
            DESEDE64
            HMACMD4
            PBEWITHHMACSHA
            SKIPJACKMAC
            IDEA
            SKIPJACK/CFB8
            HMAC/MD2
            HMAC/MD5
            RC5/CFB8
            RC2/CFB8
            OLDHMACSHA512
            1.2.840.113549.2.10
            HMAC/SHA224
            DESWITHISO9797
            RC5
            DES/CFB8
            HMAC-MD5
            HMAC-SHA224
            HMACMD2
            HMACRIPEMD128
            ISO9797ALG3MAC
            RC2
            DESEDE/CFB8
            1.2.840.113549.2.9
            HMACSHA512
            DESEDE
            HMAC-SHA256
            HMACSHA384
            HMAC/Tiger
            HMAC-RIPEMD160
            IDEA/CFB8
            DESEDEMAC/CFB8
            1.3.14.3.2.26
            HMAC/MD4
            1.2.840.113549.2.7
            HMACMD5
            IDEAMAC
            HMACSHA256
            HMACTiger
            RC5MAC/CFB8
            HMAC/SHA384
            1.2.840.113549.2.8
            1.2.840.113549.2.11
            DESMAC/CFB8
            HMACSHA224
            DESMAC
            ISO9797ALG3
            HMAC/SHA256
            DESEDEMAC
            OLDHMACSHA384
            SKIPJACKMAC/CFB8
            HMAC/RIPEMD160
            HMAC-Tiger
            HMACSHA1
            SKIPJACK
            DESISO9797MAC
            DES
MessageDigests:
            1.3.36.3.2.2
            RIPEMD320
            SHA224
            1.2.840.113549.2.2
            SHA384
            SHA ImplementedIn
            GOST
            1.3.36.3.2.1
            MD5
            1.2.840.113549.2.4
            SHA256
            SHA-512
            1.3.36.3.2.3
            RIPEMD128
            MD2
            1.3.14.3.2.26
            RIPEMD256
            SHA-256
            GOST3411
            MD5 ImplementedIn
            WHIRLPOOL
            1.2.643.2.2.9
            SHA1
            SHA-224
            MD4
            2.16.840.1.101.3.4.2.3
            2.16.840.1.101.3.4.2.1
            1.2.840.113549.2.5
            RIPEMD160
            SHA-1
            2.16.840.1.101.3.4.2.4
            SHA
            Tiger
            SHA512
            GOST-3411
            SHA-384
            2.16.840.1.101.3.4.2.2
Signatures:
            SHA384withRSA
            SHA1withRSAEncryption
            NONEwithDSA SupportedKeyClasses
            RIPEMD160withRSA
            GOST-3410
            SHA224withRSAandMGF1
            SHA256WITHECDSA
            SHA224withRSA
            SHA512WITHECDSA
            SHA1WithRSAEncryption
            MD4WithRSAEncryption
            1.2.840.113549.1.1.4
            MD2WITHRSAENCRYPTION
            ECDSAwithSHA1
            MD5andSHA1withRSA
            GOST3411WithECGOST3410
            SHA1withRSAandMGF1
            SHA1withRSA/ISO9796-2
            SHA256withRSA
            1.2.643.2.2.3
            SHA1WITHRSA
            SHA256withRSAandMGF1
            GOST3411WITHECGOST3410
            RawDSA
            GOST-3410-94
            RIPEMD128WithRSAEncryption
            SHA384WITHRSAENCRYPTION
            1.3.14.3.2.26with1.2.840.113549.1.1.1
            SHA-1/DSA
            MD2withRSAEncryption
            RIPEMD160withRSAEncryption
            RIPEMD160WITHRSAENCRYPTION
            SHA1WithRSA
            SHA1WithECDSA
            1.3.14.3.2.29
            SHA224withRSAEncryption
            SHA/DSA
            SHA1withDSA KeySize
            SHA512WithRSA
            SHA1WITHDSA
            SHA512WithRSAEncryption
            SHA256WITHRSAENCRYPTION
            GOST3411withECGOST3410
            SHA512withRSA/PSS
            RIPEMD160WithRSAEncryption
            MD5WITHRSAENCRYPTION
            RIPEMD160WithRSA/ISO9796-2
            SHA384withRSA SupportedKeyClasses
            GOST3410
            SHA256WITHECNR
            MD5withRSA/ISO9796-2
            SHA1withRSA
            SHA256WithRSAEncryption
            SHA1withRSA/PSS
            SHA384withRSAEncryption
            1.3.14.3.2.26with1.2.840.113549.1.1.5
            ECDSAWITHSHA1
            RMD160WITHRSA
            NONEwithDSA
            1.2.840.113549.1.1.11
            RIPEMD256WithRSAEncryption
            SHA256withRSAEncryption
            1.2.840.10040.4.3
            SHA512withRSAEncryption
            1.2.840.113549.1.1.3
            SHA384WithRSAEncryption
            SHA224withRSA/PSS
            1.2.840.113549.1.1.12
            MD4withRSA
            MD5WITHRSA
            RAWDSA
            1.2.643.2.2.4
            RMD160/RSA
            1.3.14.3.2.13
            ECGOST-3410
            DSAWithSHA1
            1.2.840.113549.1.1.13
            OID.1.3.14.3.2.29
            RIPEMD160withRSA/ISO9796-2
            1.2.840.10045.4.1
            SHA256withRSA SupportedKeyClasses
            RIPEMD256WithRSA
            1.2.840.113549.1.1.5
            SHA384withRSAandMGF1
            SHA1withRSA SupportedKeyClasses
            SHA1/RSA
            GOST3411WITHGOST3410
            SHA224WithRSA
            SHA512withRSAandMGF1
            SHA1WithDSA
            SHA1WITHECNR
            OID.1.2.840.113549.1.1.5
            SHA512withRSA
            ECDSA
            SHA512WITHRSAENCRYPTION
            OID.1.2.840.113549.1.1.11
            MD4withRSAEncryption
            MD2WithRSA
            RIPEMD160WithRSA
            SHA1WithRSA/ISO9796-2
            MD5withRSA SupportedKeyClasses
            MD4WithRSA
            DSAwithSHA1
            RIPEMD160WITHRSA
            RSASSA-PSS
            GOST3411WithGOST3410
            OID.1.2.840.113549.1.1.13
            MD5WithRSAEncryption
            1.3.36.3.3.1.4
            1.2.840.113549.1.1.14
            MD2withRSA SupportedKeyClasses
            1.2.840.113549.1.1.2
            MD2withRSA
            SHA384WITHECNR
            SHAwithDSA
            MD4/RSA
            RIPEMD256withRSA
            DSA
            SHA-1/RSA
            1.2.840.113549.2.5with1.2.840.113549.1.1.1
            SHA384WITHECDSA
            OID.1.2.840.113549.1.1.12
            OID.1.2.840.113549.1.1.2
            1.3.36.3.3.1.3
            1.2.840.113549.1.1.10
            OID.1.2.840.10040.4.3
            OID.1.2.840.113549.1.1.4
            SHA512withRSA SupportedKeyClasses
            MD5WithRSA/ISO9796-2
            GOST3411withGOST3410
            SHA224WITHECDSA
            MD5withRSAEncryption
            MD5withRSA
            DSS
            SHA224WithRSAEncryption
            ECDSAWithSHA1
            1.3.36.3.3.1.2
            RIPEMD128withRSA
            SHA384withRSA/PSS
            SHA1WITHECDSA
            1.3.14.3.2.26with1.2.840.10040.4.3
            SHA1WITHRSAENCRYPTION
            MD2/RSA
            RIPEMD-160/RSA
            RMD160withRSA
            SHA512WITHECNR
            1.3.14.3.2.27
            MD5WithRSA
            MD2WithRSAEncryption
            MD5/RSA
            DSAWITHSHA1
            SHA1withDSA
            SHA384WithRSA
            1.3.14.3.2.26with1.2.840.10040.4.1
            SHA256withRSA/PSS
            SHA1/DSA
            NONEWITHDSA
            SHA1withDSA ImplementedIn
            SHA1withDSA SupportedKeyClasses
            SHA256WithRSA
            ECGOST3410
            RIPEMD128WithRSA
            GOST-3410-2001
            SHA224WITHECNR
            SHA1withECDSA
*/       
import java.security.Provider;
import java.security.Security;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class ListAlgorithms {
  public static void printSet(String setName, Set algorithms) {
    System.out.println(setName + ":");
    if (algorithms.isEmpty()) {
      System.out.println("            None available.");
    } else {
      Iterator it = algorithms.iterator();
      while (it.hasNext()) {
        String name = (String) it.next();
        System.out.println("            " + name);
      }
    }
  }
  public static void main(String[] args) {
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    Provider[] providers = Security.getProviders();
    Set ciphers = new HashSet();
    Set keyAgreements = new HashSet();
    Set macs = new HashSet();
    Set messageDigests = new HashSet();
    Set signatures = new HashSet();
    Set keyFactory = new HashSet();
    Set keyPairGenerator = new HashSet();
    Set keyGenerator = new HashSet();
    for (int i = 0; i != providers.length; i++) {
      Iterator it = providers[i].keySet().iterator();
      while (it.hasNext()) {
        String entry = (String) it.next();
        if (entry.startsWith("Alg.Alias.")) {
          entry = entry.substring("Alg.Alias.".length());
        }
        if (entry.startsWith("Cipher.")) {
          ciphers.add(entry.substring("Cipher.".length()));
        } else if (entry.startsWith("KeyAgreement.")) {
          keyAgreements.add(entry.substring("KeyAgreement.".length()));
        } else if (entry.startsWith("Mac.")) {
          macs.add(entry.substring("Mac.".length()));
        } else if (entry.startsWith("MessageDigest.")) {
          messageDigests.add(entry.substring("MessageDigest.".length()));
        } else if (entry.startsWith("Signature.")) {
          signatures.add(entry.substring("Signature.".length()));
        } else if (entry.startsWith("KeyPairGenerator.")) {
          keyPairGenerator.add(entry.substring("KeyPairGenerator.".length()));
        } else if (entry.startsWith("KeyFactory.")) {
          keyFactory.add(entry.substring("KeyFactory.".length()));
        } else if (entry.startsWith("KeyGenerator.")) {
          keyGenerator.add(entry.substring("KeyGenerator.".length()));
        } else {
          System.out.println(entry);
        }
      }
    }
    printSet("KeyGenerator", keyGenerator);
    printSet("KeyFactory", keyFactory);
    printSet("KeyPairGenerator", keyPairGenerator);
    printSet("Ciphers", ciphers);
    printSet("KeyAgreeents", keyAgreements);
    printSet("Macs", macs);
    printSet("MessageDigests", messageDigests);
    printSet("Signatures", signatures);
  }
}