Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.jcajce.provider.symmetric;
  
 
 
 
 public final class AES
 {
     private static final Class gcmSpecClass = lookup("javax.crypto.spec.GCMParameterSpec");
 
     private AES()
     {
     }
     
     public static class ECB
         extends BaseBlockCipher
     {
         public ECB()
         {
             super(new BlockCipherProvider()
             {
                 public BlockCipher get()
                 {
                     return new AESFastEngine();
                 }
             });
         }
     }
 
     public static class CBC
        extends BaseBlockCipher
     {
         public CBC()
         {
             super(new CBCBlockCipher(new AESFastEngine()), 128);
         }
     }
 
     static public class CFB
         extends BaseBlockCipher
     {
         public CFB()
         {
             super(new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 128)), 128);
         }
     }
 
     static public class OFB
         extends BaseBlockCipher
     {
         public OFB()
         {
             super(new BufferedBlockCipher(new OFBBlockCipher(new AESFastEngine(), 128)), 128);
         }
     }
 
     static public class GCM
         extends BaseBlockCipher
     {
         public GCM()
         {
            super(new GCMBlockCipher(new AESFastEngine()));
        }
    }
    static public class CCM
        extends BaseBlockCipher
    {
        public CCM()
        {
            super(new CCMBlockCipher(new AESFastEngine()));
        }
    }
    public static class AESCMAC
        extends BaseMac
    {
        public AESCMAC()
        {
            super(new CMac(new AESFastEngine()));
        }
    }
    public static class AESGMAC
        extends BaseMac
    {
        public AESGMAC()
        {
            super(new GMac(new GCMBlockCipher(new AESFastEngine())));
        }
    }
    public static class Poly1305
        extends BaseMac
    {
        public Poly1305()
        {
            super(new org.bouncycastle.crypto.macs.Poly1305(new AESFastEngine()));
        }
    }
    public static class Poly1305KeyGen
        extends BaseKeyGenerator
    {
        public Poly1305KeyGen()
        {
            super("Poly1305-AES", 256, new Poly1305KeyGenerator());
        }
    }
    static public class Wrap
        extends BaseWrapCipher
    {
        public Wrap()
        {
            super(new AESWrapEngine());
        }
    }
    public static class RFC3211Wrap
        extends BaseWrapCipher
    {
        public RFC3211Wrap()
        {
            super(new RFC3211WrapEngine(new AESFastEngine()), 16);
        }
    }
    public static class RFC5649Wrap
        extends BaseWrapCipher
    {
        public RFC5649Wrap()
        {
            super(new RFC5649WrapEngine(new AESFastEngine()));
        }
    }

    
PBEWithAES-CBC
    static public class PBEWithAESCBC
        extends BaseBlockCipher
    {
        public PBEWithAESCBC()
        {
            super(new CBCBlockCipher(new AESFastEngine()));
        }
    }
    
    public static class KeyGen
        extends BaseKeyGenerator
    {
        public KeyGen()
        {
            this(192);
        }
        public KeyGen(int keySize)
        {
            super("AES"keySizenew CipherKeyGenerator());
        }
    }
    public static class KeyGen128
        extends KeyGen
    {
        public KeyGen128()
        {
            super(128);
        }
    }
    public static class KeyGen192
        extends KeyGen
    {
        public KeyGen192()
        {
            super(192);
        }
    }
    public static class KeyGen256
        extends KeyGen
    {
        public KeyGen256()
        {
            super(256);
        }
    }
    
    
PBEWithSHA1And128BitAES-BC
    static public class PBEWithSHAAnd128BitAESBC
        extends PBESecretKeyFactory
    {
        public PBEWithSHAAnd128BitAESBC()
        {
            super("PBEWithSHA1And128BitAES-CBC-BC"nulltrue, 128, 128);
        }
    }
    
    
PBEWithSHA1And192BitAES-BC
    static public class PBEWithSHAAnd192BitAESBC
        extends PBESecretKeyFactory
    {
        public PBEWithSHAAnd192BitAESBC()
        {
            super("PBEWithSHA1And192BitAES-CBC-BC"nulltrue, 192, 128);
        }
    }
    
    
PBEWithSHA1And256BitAES-BC
    static public class PBEWithSHAAnd256BitAESBC
        extends PBESecretKeyFactory
    {
        public PBEWithSHAAnd256BitAESBC()
        {
            super("PBEWithSHA1And256BitAES-CBC-BC"nulltrue, 256, 128);
        }
    }
    
    
PBEWithSHA256And128BitAES-BC
    static public class PBEWithSHA256And128BitAESBC
        extends PBESecretKeyFactory
    {
        public PBEWithSHA256And128BitAESBC()
        {
            super("PBEWithSHA256And128BitAES-CBC-BC"nulltrue, 128, 128);
        }
    }
    
    
PBEWithSHA256And192BitAES-BC
    static public class PBEWithSHA256And192BitAESBC
        extends PBESecretKeyFactory
    {
        public PBEWithSHA256And192BitAESBC()
        {
            super("PBEWithSHA256And192BitAES-CBC-BC"nulltrue, 192, 128);
        }
    }
    
    
PBEWithSHA256And256BitAES-BC
    static public class PBEWithSHA256And256BitAESBC
        extends PBESecretKeyFactory
    {
        public PBEWithSHA256And256BitAESBC()
        {
            super("PBEWithSHA256And256BitAES-CBC-BC"nulltrue, 256, 128);
        }
    }
    
    
PBEWithMD5And128BitAES-OpenSSL
    static public class PBEWithMD5And128BitAESCBCOpenSSL
        extends PBESecretKeyFactory
    {
        public PBEWithMD5And128BitAESCBCOpenSSL()
        {
            super("PBEWithMD5And128BitAES-CBC-OpenSSL"nulltrue, 128, 128);
        }
    }
    
    
PBEWithMD5And192BitAES-OpenSSL
    static public class PBEWithMD5And192BitAESCBCOpenSSL
        extends PBESecretKeyFactory
    {
        public PBEWithMD5And192BitAESCBCOpenSSL()
        {
            super("PBEWithMD5And192BitAES-CBC-OpenSSL"nulltrue, 192, 128);
        }
    }
    
    
PBEWithMD5And256BitAES-OpenSSL
    static public class PBEWithMD5And256BitAESCBCOpenSSL
        extends PBESecretKeyFactory
    {
        public PBEWithMD5And256BitAESCBCOpenSSL()
        {
            super("PBEWithMD5And256BitAES-CBC-OpenSSL"nulltrue, 256, 128);
        }
    }
    
    public static class AlgParamGen
        extends BaseAlgorithmParameterGenerator
    {
        protected void engineInit(
            AlgorithmParameterSpec genParamSpec,
            SecureRandom random)
            throws InvalidAlgorithmParameterException
        {
            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation.");
        }
        protected AlgorithmParameters engineGenerateParameters()
        {
            byte[]  iv = new byte[16];
            if ( == null)
            {
                 = new SecureRandom();
            }
            .nextBytes(iv);
            AlgorithmParameters params;
            try
            {
                params = createParametersInstance("AES");
                params.init(new IvParameterSpec(iv));
            }
            catch (Exception e)
            {
                throw new RuntimeException(e.getMessage());
            }
            return params;
        }
    }
    public static class AlgParamGenCCM
        extends BaseAlgorithmParameterGenerator
    {
        protected void engineInit(
            AlgorithmParameterSpec genParamSpec,
            SecureRandom random)
            throws InvalidAlgorithmParameterException
        {
            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation.");
        }
        protected AlgorithmParameters engineGenerateParameters()
        {
            byte[]  iv = new byte[12];
            if ( == null)
            {
                 = new SecureRandom();
            }
            .nextBytes(iv);
            AlgorithmParameters params;
            try
            {
                params = createParametersInstance("CCM");
                params.init(new CCMParameters(iv, 12).getEncoded());
            }
            catch (Exception e)
            {
                throw new RuntimeException(e.getMessage());
            }
            return params;
        }
    }
    public static class AlgParamGenGCM
        extends BaseAlgorithmParameterGenerator
    {
        protected void engineInit(
            AlgorithmParameterSpec genParamSpec,
            SecureRandom random)
            throws InvalidAlgorithmParameterException
        {
            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation.");
        }
        protected AlgorithmParameters engineGenerateParameters()
        {
            byte[]  nonce = new byte[12];
            if ( == null)
            {
                 = new SecureRandom();
            }
            .nextBytes(nonce);
            AlgorithmParameters params;
            try
            {
                params = createParametersInstance("GCM");
                params.init(new GCMParameters(nonce, 12).getEncoded());
            }
            catch (Exception e)
            {
                throw new RuntimeException(e.getMessage());
            }
            return params;
        }
    }
    public static class AlgParams
        extends IvAlgorithmParameters
    {
        protected String engineToString()
        {
            return "AES IV";
        }
    }
    public static class AlgParamsGCM
        extends BaseAlgorithmParameters
    {
        private GCMParameters gcmParams;
        protected void engineInit(AlgorithmParameterSpec paramSpec)
            throws InvalidParameterSpecException
        {
            if ( != null)
            {
                try
                {
                    Method tLen = .getDeclaredMethod("getTLen"new Class[0]);
                    Method iv.getDeclaredMethod("getIV"new Class[0]);
                     = new GCMParameters((byte[])iv.invoke(paramSpecnew Object[0]), ((Integer)tLen.invoke(paramSpecnew Object[0])).intValue() / 8);
                }
                catch (Exception e)
                {
                    throw new InvalidParameterSpecException("Cannot process GCMParameterSpec.");
                }
            }
        }
        protected void engineInit(byte[] params)
            throws IOException
        {
             = GCMParameters.getInstance(params);
        }
        protected void engineInit(byte[] paramsString format)
            throws IOException
        {
            if (!isASN1FormatString(format))
            {
                throw new IOException("unknown format specified");
            }
             = GCMParameters.getInstance(params);
        }
        protected byte[] engineGetEncoded()
            throws IOException
        {
            return .getEncoded();
        }
        protected byte[] engineGetEncoded(String format)
            throws IOException
        {
            if (!isASN1FormatString(format))
            {
                throw new IOException("unknown format specified");
            }
            return .getEncoded();
        }
        protected String engineToString()
        {
            return "GCM";
        }
        protected AlgorithmParameterSpec localEngineGetParameterSpec(Class paramSpec)
            throws InvalidParameterSpecException
        {
            if ( != null)
            {
                try
                {
                    Constructor constructor = .getConstructor(new Class[] { .byte[].class });
                    return (AlgorithmParameterSpec)constructor.newInstance(new Object[] { Integers.valueOf(.getIcvLen() * 8), .getNonce() });
                }
                catch (NoSuchMethodException e)
                {
                    throw new InvalidParameterSpecException("no constructor found!");   // should never happen
                }
                catch (Exception e)
                {
                    throw new InvalidParameterSpecException("construction failed: " + e.getMessage());   // should never happen
                }
            }
            throw new InvalidParameterSpecException("unknown parameter spec: " + paramSpec.getName());
        }
    }
    public static class AlgParamsCCM
        extends BaseAlgorithmParameters
    {
        private CCMParameters ccmParams;
        protected void engineInit(AlgorithmParameterSpec paramSpec)
            throws InvalidParameterSpecException
        {
            throw new InvalidParameterSpecException("No supported AlgorithmParameterSpec for AES parameter generation.");
        }
        protected void engineInit(byte[] params)
            throws IOException
        {
             = CCMParameters.getInstance(params);
        }
        protected void engineInit(byte[] paramsString format)
            throws IOException
        {
            if (!isASN1FormatString(format))
            {
                throw new IOException("unknown format specified");
            }
             = CCMParameters.getInstance(params);
        }
        protected byte[] engineGetEncoded()
            throws IOException
        {
            return .getEncoded();
        }
        protected byte[] engineGetEncoded(String format)
            throws IOException
        {
            if (!isASN1FormatString(format))
            {
                throw new IOException("unknown format specified");
            }
            return .getEncoded();
        }
        protected String engineToString()
        {
            return "CCM";
        }
        protected AlgorithmParameterSpec localEngineGetParameterSpec(Class paramSpec)
            throws InvalidParameterSpecException
        {
            if ( != null)
            {
                try
                {
                    Constructor constructor = .getConstructor(new Class[] { .byte[].class });
                    return (AlgorithmParameterSpec)constructor.newInstance(new Object[] { Integers.valueOf(.getIcvLen() * 8), .getNonce() });
                }
                catch (NoSuchMethodException e)
                {
                    throw new InvalidParameterSpecException("no constructor found!");   // should never happen
                }
                catch (Exception e)
                {
                    throw new InvalidParameterSpecException("construction failed: " + e.getMessage());   // should never happen
                }
            }
            throw new InvalidParameterSpecException("unknown parameter spec: " + paramSpec.getName());
        }
    }
    public static class Mappings
        extends SymmetricAlgorithmProvider
    {
        private static final String PREFIX = AES.class.getName();
        
        
These three got introduced in some messages as a result of a typo in an early document. We don't produce anything using these OID values, but we'll read them.
        private static final String wrongAES128 = "2.16.840.1.101.3.4.2";
        private static final String wrongAES192 = "2.16.840.1.101.3.4.22";
        private static final String wrongAES256 = "2.16.840.1.101.3.4.42";
        public Mappings()
        {
        }
        public void configure(ConfigurableProvider provider)
        {
            provider.addAlgorithm("AlgorithmParameters.AES" + "$AlgParams");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + "AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + "AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + "AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."AES");
            provider.addAlgorithm("AlgorithmParameters.GCM" + "$AlgParamsGCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."GCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."GCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."GCM");
            provider.addAlgorithm("AlgorithmParameters.CCM" + "$AlgParamsCCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."CCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."CCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ."CCM");
            provider.addAlgorithm("AlgorithmParameterGenerator.AES" + "$AlgParamGen");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + "AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + "AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + "AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."AES");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."AES");
            provider.addAlgorithm("Cipher.AES" + "$ECB");
            provider.addAlgorithm("Alg.Alias.Cipher." + "AES");
            provider.addAlgorithm("Alg.Alias.Cipher." + "AES");
            provider.addAlgorithm("Alg.Alias.Cipher." + "AES");
            provider.addAlgorithm("Cipher." + . + "$ECB");
            provider.addAlgorithm("Cipher." + . + "$ECB");
            provider.addAlgorithm("Cipher." + . + "$ECB");
            provider.addAlgorithm("Cipher." + . + "$CBC");
            provider.addAlgorithm("Cipher." + . + "$CBC");
            provider.addAlgorithm("Cipher." + . + "$CBC");
            provider.addAlgorithm("Cipher." + . + "$OFB");
            provider.addAlgorithm("Cipher." + . + "$OFB");
            provider.addAlgorithm("Cipher." + . + "$OFB");
            provider.addAlgorithm("Cipher." + . + "$CFB");
            provider.addAlgorithm("Cipher." + . + "$CFB");
            provider.addAlgorithm("Cipher." + . + "$CFB");
            provider.addAlgorithm("Cipher.AESWRAP" + "$Wrap");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."AESWRAP");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."AESWRAP");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."AESWRAP");
            provider.addAlgorithm("Cipher.AESRFC3211WRAP" + "$RFC3211Wrap");
            provider.addAlgorithm("Cipher.AESRFC5649WRAP" + "$RFC5649Wrap");
            provider.addAlgorithm("AlgorithmParameterGenerator.CCM" + "$AlgParamGenCCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."CCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."CCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."CCM");
            provider.addAlgorithm("Cipher.CCM" + "$CCM");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."CCM");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."CCM");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."CCM");
            provider.addAlgorithm("AlgorithmParameterGenerator.GCM" + "$AlgParamGenGCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."GCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."GCM");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + ."GCM");
            provider.addAlgorithm("Cipher.GCM" + "$GCM");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."GCM");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."GCM");
            provider.addAlgorithm("Alg.Alias.Cipher." + ."GCM");
            provider.addAlgorithm("KeyGenerator.AES" + "$KeyGen");
            provider.addAlgorithm("KeyGenerator." +  + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." +  + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." +  + "$KeyGen256");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen256");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen256");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen256");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen256");
            provider.addAlgorithm("KeyGenerator.AESWRAP" + "$KeyGen");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen256");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen256");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen128");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen192");
            provider.addAlgorithm("KeyGenerator." + . + "$KeyGen256");
            provider.addAlgorithm("Mac.AESCMAC" + "$AESCMAC");
            
            provider.addAlgorithm("Alg.Alias.Cipher." + ..getId(), "PBEWITHSHAAND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher." + ..getId(), "PBEWITHSHAAND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher." + ..getId(), "PBEWITHSHAAND256BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher." + ..getId(), "PBEWITHSHA256AND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher." + ..getId(), "PBEWITHSHA256AND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher." + ..getId(), "PBEWITHSHA256AND256BITAES-CBC-BC");
    
            provider.addAlgorithm("Cipher.PBEWITHSHAAND128BITAES-CBC-BC" + "$PBEWithAESCBC");
            provider.addAlgorithm("Cipher.PBEWITHSHAAND192BITAES-CBC-BC" + "$PBEWithAESCBC");
            provider.addAlgorithm("Cipher.PBEWITHSHAAND256BITAES-CBC-BC" + "$PBEWithAESCBC");
            provider.addAlgorithm("Cipher.PBEWITHSHA256AND128BITAES-CBC-BC" + "$PBEWithAESCBC");
            provider.addAlgorithm("Cipher.PBEWITHSHA256AND192BITAES-CBC-BC" + "$PBEWithAESCBC");
            provider.addAlgorithm("Cipher.PBEWITHSHA256AND256BITAES-CBC-BC" + "$PBEWithAESCBC");
            
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA-1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA-1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA-1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA-256AND128BITAES-CBC-BC","PBEWITHSHA256AND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA-256AND192BITAES-CBC-BC","PBEWITHSHA256AND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA-256AND256BITAES-CBC-BC","PBEWITHSHA256AND256BITAES-CBC-BC");
            
            provider.addAlgorithm("Cipher.PBEWITHMD5AND128BITAES-CBC-OPENSSL" + "$PBEWithAESCBC");
            provider.addAlgorithm("Cipher.PBEWITHMD5AND192BITAES-CBC-OPENSSL" + "$PBEWithAESCBC");
            provider.addAlgorithm("Cipher.PBEWITHMD5AND256BITAES-CBC-OPENSSL" + "$PBEWithAESCBC");
            
            provider.addAlgorithm("SecretKeyFactory.PBEWITHMD5AND128BITAES-CBC-OPENSSL" + "$PBEWithMD5And128BitAESCBCOpenSSL");
            provider.addAlgorithm("SecretKeyFactory.PBEWITHMD5AND192BITAES-CBC-OPENSSL" + "$PBEWithMD5And192BitAESCBCOpenSSL");
            provider.addAlgorithm("SecretKeyFactory.PBEWITHMD5AND256BITAES-CBC-OPENSSL" + "$PBEWithMD5And256BitAESCBCOpenSSL");
            
            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND128BITAES-CBC-BC" + "$PBEWithSHAAnd128BitAESBC");
            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND192BITAES-CBC-BC" + "$PBEWithSHAAnd192BitAESBC");
            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND256BITAES-CBC-BC" + "$PBEWithSHAAnd256BitAESBC");
            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHA256AND128BITAES-CBC-BC" + "$PBEWithSHA256And128BitAESBC");
            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHA256AND192BITAES-CBC-BC" + "$PBEWithSHA256And192BitAESBC");
            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHA256AND256BITAES-CBC-BC" + "$PBEWithSHA256And256BitAESBC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA-1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA-1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA-1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA-256AND128BITAES-CBC-BC","PBEWITHSHA256AND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA-256AND192BITAES-CBC-BC","PBEWITHSHA256AND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA-256AND256BITAES-CBC-BC","PBEWITHSHA256AND256BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + ..getId(), "PBEWITHSHAAND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + ..getId(), "PBEWITHSHAAND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + ..getId(), "PBEWITHSHAAND256BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + ..getId(), "PBEWITHSHA256AND128BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + ..getId(), "PBEWITHSHA256AND192BITAES-CBC-BC");
            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + ..getId(), "PBEWITHSHA256AND256BITAES-CBC-BC");
            
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND128BITAES-CBC-BC""PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND192BITAES-CBC-BC""PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND256BITAES-CBC-BC""PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA256AND128BITAES-CBC-BC""PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA256AND192BITAES-CBC-BC""PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA256AND256BITAES-CBC-BC""PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA1AND128BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA1AND192BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA1AND256BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA-1AND128BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA-1AND192BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA-1AND256BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND128BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND192BITAES-CBC-BC","PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND256BITAES-CBC-BC","PKCS12PBE"); 
            
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ..getId(), "PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ..getId(), "PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ..getId(), "PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ..getId(), "PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ..getId(), "PKCS12PBE");
            provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + ..getId(), "PKCS12PBE");
            addGMacAlgorithm(provider"AES" + "$AESGMAC" + "$KeyGen128");
            addPoly1305Algorithm(provider"AES" + "$Poly1305" + "$Poly1305KeyGen");
        }
    }
    private static Class lookup(String className)
    {
        try
        {
            Class def = AES.class.getClassLoader().loadClass(className);
            return def;
        }
        catch (Exception e)
        {
            return null;
        }
    }