Home | History | Annotate | Download | only in provider
      1 package org.bouncycastle.jce.provider;
      2 
      3 import java.security.AccessController;
      4 import java.security.PrivilegedAction;
      5 import java.security.Provider;
      6 import java.util.Iterator;
      7 import java.util.Map;
      8 
      9 import org.bouncycastle.asn1.DERObjectIdentifier;
     10 import org.bouncycastle.asn1.bc.BCObjectIdentifiers;
     11 import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
     12 import org.bouncycastle.asn1.iana.IANAObjectIdentifiers;
     13 import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
     14 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
     15 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
     16 import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
     17 import org.bouncycastle.jce.interfaces.ConfigurableProvider;
     18 
     19 /**
     20  * To add the provider at runtime use:
     21  * <pre>
     22  * import java.security.Security;
     23  * import org.bouncycastle.jce.provider.BouncyCastleProvider;
     24  *
     25  * Security.addProvider(new BouncyCastleProvider());
     26  * </pre>
     27  * The provider can also be configured as part of your environment via
     28  * static registration by adding an entry to the java.security properties
     29  * file (found in $JAVA_HOME/jre/lib/security/java.security, where
     30  * $JAVA_HOME is the location of your JDK/JRE distribution). You'll find
     31  * detailed instructions in the file but basically it comes down to adding
     32  * a line:
     33  * <pre>
     34  * <code>
     35  *    security.provider.&lt;n&gt;=org.bouncycastle.jce.provider.BouncyCastleProvider
     36  * </code>
     37  * </pre>
     38  * Where &lt;n&gt; is the preference you want the provider at (1 being the
     39  * most preferred).
     40  * <p>Note: JCE algorithm names should be upper-case only so the case insensitive
     41  * test for getInstance works.
     42  */
     43 public final class BouncyCastleProvider extends Provider
     44     implements ConfigurableProvider
     45 {
     46     private static String info = "BouncyCastle Security Provider v1.46";
     47 
     48     // BEGIN android-changed
     49     //     this constant should be final
     50     public static final String PROVIDER_NAME = "BC";
     51     // END android-changed
     52 
     53     /*
     54      * Configurable symmetric ciphers
     55      */
     56     private static final String SYMMETRIC_CIPHER_PACKAGE = "org.bouncycastle.jce.provider.symmetric.";
     57     private static final String[] SYMMETRIC_CIPHERS =
     58     {
     59         // BEGIN android-removed
     60         // "AES", "ARC4", "Blowfish", "Camellia", "CAST5", "CAST6", "DESede", "Grainv1", "Grain128", "HC128", "HC256", "IDEA",
     61         // "Noekeon", "RC5", "RC6", "Rijndael", "Salsa20", "SEED", "Serpent", "Skipjack", "TEA", "Twofish", "VMPC", "VMPCKSA3", "XTEA"
     62         // END android-removed
     63         // BEGIN android-added
     64         "AES", "ARC4", "Blowfish", "DESede",
     65         // END android-added
     66 
     67     };
     68 
     69     /*
     70      * Configurable asymmetric ciphers
     71      */
     72     private static final String ASYMMETRIC_CIPHER_PACKAGE = "org.bouncycastle.jce.provider.asymmetric.";
     73     private static final String[] ASYMMETRIC_CIPHERS =
     74     {
     75         "EC"
     76     };
     77 
     78     /**
     79      * Construct a new provider.  This should only be required when
     80      * using runtime registration of the provider using the
     81      * <code>Security.addProvider()</code> mechanism.
     82      */
     83     public BouncyCastleProvider()
     84     {
     85         super(PROVIDER_NAME, 1.46, info);
     86 
     87         AccessController.doPrivileged(new PrivilegedAction()
     88         {
     89             public Object run()
     90             {
     91                 setup();
     92                 return null;
     93             }
     94         });
     95     }
     96 
     97     private void setup()
     98     {
     99         loadAlgorithms(SYMMETRIC_CIPHER_PACKAGE, SYMMETRIC_CIPHERS);
    100         loadAlgorithms(ASYMMETRIC_CIPHER_PACKAGE, ASYMMETRIC_CIPHERS);
    101 
    102         // BEGIN android-removed
    103         // //
    104         // // X509Store
    105         // //
    106         // put("X509Store.CERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertCollection");
    107         // put("X509Store.ATTRIBUTECERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreAttrCertCollection");
    108         // put("X509Store.CRL/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCRLCollection");
    109         // put("X509Store.CERTIFICATEPAIR/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertPairCollection");
    110         //
    111         // put("X509Store.CERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCerts");
    112         // put("X509Store.CRL/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCRLs");
    113         // put("X509Store.ATTRIBUTECERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPAttrCerts");
    114         // put("X509Store.CERTIFICATEPAIR/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCertPairs");
    115         //
    116         // //
    117         // // X509StreamParser
    118         // //
    119         // put("X509StreamParser.CERTIFICATE", "org.bouncycastle.jce.provider.X509CertParser");
    120         // put("X509StreamParser.ATTRIBUTECERTIFICATE", "org.bouncycastle.jce.provider.X509AttrCertParser");
    121         // put("X509StreamParser.CRL", "org.bouncycastle.jce.provider.X509CRLParser");
    122         // put("X509StreamParser.CERTIFICATEPAIR", "org.bouncycastle.jce.provider.X509CertPairParser");
    123         // END android-removed
    124 
    125 
    126         //
    127         // KeyStore
    128         //
    129         put("KeyStore.BKS", "org.bouncycastle.jce.provider.JDKKeyStore");
    130         put("KeyStore.BouncyCastle", "org.bouncycastle.jce.provider.JDKKeyStore$BouncyCastleStore");
    131         put("KeyStore.PKCS12", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore");
    132         // BEGIN android-changed
    133         put("Alg.Alias.KeyStore.BCPKCS12", "PKCS12");
    134         // END android-changed
    135         // BEGIN android-removed
    136         // put("KeyStore.PKCS12-DEF", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore");
    137         // END android-removed
    138 
    139         // BEGIN android-changed
    140         put("Alg.Alias.KeyStore.PKCS12-3DES-40RC2", "PKCS12");
    141         // END android-changed
    142         // BEGIN android-removed
    143         // put("KeyStore.PKCS12-3DES-3DES", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore3DES");
    144         // END android-removed
    145 
    146         // BEGIN android-removed
    147         // put("KeyStore.PKCS12-DEF-3DES-40RC2", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore");
    148         // put("KeyStore.PKCS12-DEF-3DES-3DES", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore3DES");
    149         // END android-removed
    150 
    151         put("Alg.Alias.KeyStore.UBER", "BouncyCastle");
    152         put("Alg.Alias.KeyStore.BOUNCYCASTLE", "BouncyCastle");
    153         put("Alg.Alias.KeyStore.bouncycastle", "BouncyCastle");
    154 
    155         //
    156         // certificate factories.
    157         //
    158         put("CertificateFactory.X.509", "org.bouncycastle.jce.provider.JDKX509CertificateFactory");
    159         put("Alg.Alias.CertificateFactory.X509", "X.509");
    160 
    161         //
    162         // algorithm parameter generators
    163         //
    164         put("AlgorithmParameterGenerator.DH", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DH");
    165         put("AlgorithmParameterGenerator.DSA", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA");
    166         // BEGIN android-removed
    167         // put("AlgorithmParameterGenerator.GOST3410", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$GOST3410");
    168         // put("AlgorithmParameterGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$ElGamal");
    169         // put("AlgorithmParameterGenerator.DES", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
    170         // put("AlgorithmParameterGenerator.DESEDE", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
    171         // put("AlgorithmParameterGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
    172         // put("AlgorithmParameterGenerator." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
    173         // put("AlgorithmParameterGenerator.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2");
    174         // put("AlgorithmParameterGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2");
    175         // END android-removed
    176 
    177         put("Alg.Alias.AlgorithmParameterGenerator.DIFFIEHELLMAN", "DH");
    178         // BEGIN android-removed
    179         // put("Alg.Alias.AlgorithmParameterGenerator.GOST-3410", "GOST3410");
    180         // END android-removed
    181         //
    182         // algorithm parameters
    183         //
    184         put("AlgorithmParameters.OAEP", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$OAEP");
    185         // BEGIN android-removed
    186         // put("AlgorithmParameters.PSS", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PSS");
    187         // END android-removed
    188         put("AlgorithmParameters.DH", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$DH");
    189         put("Alg.Alias.AlgorithmParameters.DIFFIEHELLMAN", "DH");
    190         put("AlgorithmParameters.DSA", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$DSA");
    191         // BEGIN android-removed
    192         // put("AlgorithmParameters.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$ElGamal");
    193         // put("AlgorithmParameters.IES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IES");
    194         // END android-removed
    195         put("AlgorithmParameters.PKCS12PBE", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PKCS12PBE");
    196         // BEGIN android-changed
    197         // redundant with below
    198         // put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.des_EDE3_CBC, "DESede");
    199         // END android-changed
    200         // BEGIN android-removed
    201         // put("AlgorithmParameters." + PKCSObjectIdentifiers.id_PBKDF2, "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PBKDF2");
    202         //
    203         // put("AlgorithmParameters.GOST3410", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$GOST3410");
    204         // put("Alg.Alias.AlgorithmParameters.GOST-3410", "GOST3410");
    205         // END android-removed
    206         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2", "PKCS12PBE");
    207         // BEGIN android-removed
    208         // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND3-KEYTRIPLEDES", "PKCS12PBE");
    209         // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND2-KEYTRIPLEDES", "PKCS12PBE");
    210         // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC2", "PKCS12PBE");
    211         // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC4", "PKCS12PBE");
    212         // END android-removed
    213         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH", "PKCS12PBE");
    214         // BEGIN android-removed
    215         // put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2-CBC", "PKCS12PBE");
    216         // END android-removed
    217         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PKCS12PBE");
    218         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", "PKCS12PBE");
    219         // BEGIN android-removed
    220         // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDDES3KEY-CBC", "PKCS12PBE");
    221         // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDDES2KEY-CBC", "PKCS12PBE");
    222         // END android-removed
    223         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND40BITRC2-CBC", "PKCS12PBE");
    224         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND40BITRC4", "PKCS12PBE");
    225         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND128BITRC2-CBC", "PKCS12PBE");
    226         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND128BITRC4", "PKCS12PBE");
    227         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH", "PKCS12PBE");
    228         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH-CBC", "PKCS12PBE");
    229         put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.1", "PKCS12PBE");
    230         put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.2", "PKCS12PBE");
    231         put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.3", "PKCS12PBE");
    232         put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.4", "PKCS12PBE");
    233         put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.5", "PKCS12PBE");
    234         put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.6", "PKCS12PBE");
    235         put("Alg.Alias.AlgorithmParameters.PBEWithSHAAnd3KeyTripleDES", "PKCS12PBE");
    236 
    237         put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.getId(), "PKCS12PBE");
    238         put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.getId(), "PKCS12PBE");
    239         put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes256_cbc.getId(), "PKCS12PBE");
    240         put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes128_cbc.getId(), "PKCS12PBE");
    241         put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.getId(), "PKCS12PBE");
    242         put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.getId(), "PKCS12PBE");
    243 
    244         put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.id_RSAES_OAEP, "OAEP");
    245 
    246         // BEGIN android-removed
    247         // put("Alg.Alias.AlgorithmParameters.RSAPSS", "PSS");
    248         // put("Alg.Alias.AlgorithmParameters.RSASSA-PSS", "PSS");
    249         // put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.id_RSASSA_PSS, "PSS");
    250         // put("Alg.Alias.AlgorithmParameters.SHA1withRSA/PSS", "PSS");
    251         // put("Alg.Alias.AlgorithmParameters.SHA224withRSA/PSS", "PSS");
    252         // put("Alg.Alias.AlgorithmParameters.SHA256withRSA/PSS", "PSS");
    253         // put("Alg.Alias.AlgorithmParameters.SHA384withRSA/PSS", "PSS");
    254         // put("Alg.Alias.AlgorithmParameters.SHA512withRSA/PSS", "PSS");
    255         // put("Alg.Alias.AlgorithmParameters.SHA1WITHRSAANDMGF1", "PSS");
    256         // put("Alg.Alias.AlgorithmParameters.SHA224WITHRSAANDMGF1", "PSS");
    257         // put("Alg.Alias.AlgorithmParameters.SHA256WITHRSAANDMGF1", "PSS");
    258         // put("Alg.Alias.AlgorithmParameters.SHA384WITHRSAANDMGF1", "PSS");
    259         // put("Alg.Alias.AlgorithmParameters.SHA512WITHRSAANDMGF1", "PSS");
    260         // put("Alg.Alias.AlgorithmParameters.RAWRSAPSS", "PSS");
    261         // put("Alg.Alias.AlgorithmParameters.NONEWITHRSAPSS", "PSS");
    262         // put("Alg.Alias.AlgorithmParameters.NONEWITHRSASSA-PSS", "PSS");
    263         // END android-removed
    264 
    265         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND128BITAES-CBC-BC", "PKCS12PBE");
    266         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND192BITAES-CBC-BC", "PKCS12PBE");
    267         put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND256BITAES-CBC-BC", "PKCS12PBE");
    268         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA256AND128BITAES-CBC-BC", "PKCS12PBE");
    269         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA256AND192BITAES-CBC-BC", "PKCS12PBE");
    270         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA256AND256BITAES-CBC-BC", "PKCS12PBE");
    271         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1AND128BITAES-CBC-BC","PKCS12PBE");
    272         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1AND192BITAES-CBC-BC","PKCS12PBE");
    273         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1AND256BITAES-CBC-BC","PKCS12PBE");
    274         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-1AND128BITAES-CBC-BC","PKCS12PBE");
    275         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-1AND192BITAES-CBC-BC","PKCS12PBE");
    276         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-1AND256BITAES-CBC-BC","PKCS12PBE");
    277         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND128BITAES-CBC-BC","PKCS12PBE");
    278         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND192BITAES-CBC-BC","PKCS12PBE");
    279         put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND256BITAES-CBC-BC","PKCS12PBE");
    280 
    281         // BEGIN android-removed
    282         // put("AlgorithmParameters.SHA1WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters");
    283         // put("AlgorithmParameters.SHA224WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters");
    284         // put("AlgorithmParameters.SHA256WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters");
    285         // put("AlgorithmParameters.SHA384WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters");
    286         // put("AlgorithmParameters.SHA512WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters");
    287         // END android-removed
    288 
    289         //
    290         // key agreement
    291         //
    292         put("KeyAgreement.DH", "org.bouncycastle.jce.provider.JCEDHKeyAgreement");
    293         put("Alg.Alias.KeyAgreement.DIFFIEHELLMAN", "DH");
    294 
    295         //
    296         // cipher engines
    297         //
    298         put("Cipher.DES", "org.bouncycastle.jce.provider.JCEBlockCipher$DES");
    299         // BEGIN android-removed
    300         // put("Cipher." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.JCEBlockCipher$DESCBC");
    301         //
    302         // put("Cipher.RC2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2");
    303         // put("Cipher.RC2WRAP", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap");
    304         // put("Cipher.1.2.840.113549.1.9.16.3.7", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap");
    305         //
    306         // put("Cipher.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2CBC");
    307         // END android-removed
    308 
    309         put("Alg.Alias.Cipher.PBEWithSHAAnd3KeyTripleDES",  "PBEWITHSHAAND3-KEYTRIPLEDES-CBC");
    310 
    311         // BEGIN android-removed
    312         // put("Cipher.GOST28147", "org.bouncycastle.jce.provider.JCEBlockCipher$GOST28147");
    313         // put("Alg.Alias.Cipher.GOST", "GOST28147");
    314         // put("Alg.Alias.Cipher.GOST-28147", "GOST28147");
    315         // put("Cipher." + CryptoProObjectIdentifiers.gostR28147_cbc, "org.bouncycastle.jce.provider.JCEBlockCipher$GOST28147cbc");
    316         // END android-removed
    317 
    318         put("Cipher.RSA", "org.bouncycastle.jce.provider.JCERSACipher$NoPadding");
    319         // BEGIN android-changed
    320         put("Alg.Alias.Cipher.RSA/RAW", "RSA");
    321         // END android-changed
    322         // BEGIN android-removed
    323         // put("Cipher.RSA/PKCS1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding");
    324         // put("Cipher.1.2.840.113549.1.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding");
    325         // put("Cipher.2.5.8.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding");
    326         // put("Cipher.RSA/1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PrivateOnly");
    327         // put("Cipher.RSA/2", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PublicOnly");
    328         // put("Cipher.RSA/OAEP", "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding");
    329         // put("Cipher." + PKCSObjectIdentifiers.id_RSAES_OAEP, "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding");
    330         // put("Cipher.RSA/ISO9796-1", "org.bouncycastle.jce.provider.JCERSACipher$ISO9796d1Padding");
    331         //
    332         // put("Cipher.ECIES", "org.bouncycastle.jce.provider.JCEIESCipher$ECIES");
    333         // put("Cipher.BrokenECIES", "org.bouncycastle.jce.provider.JCEIESCipher$BrokenECIES");
    334         // put("Cipher.IES", "org.bouncycastle.jce.provider.JCEIESCipher$IES");
    335         // put("Cipher.BrokenIES", "org.bouncycastle.jce.provider.JCEIESCipher$BrokenIES");
    336         // put("Cipher.ELGAMAL", "org.bouncycastle.jce.provider.JCEElGamalCipher$NoPadding");
    337         // put("Cipher.ELGAMAL/PKCS1", "org.bouncycastle.jce.provider.JCEElGamalCipher$PKCS1v1_5Padding");
    338         // END android-removed
    339 
    340         put("Alg.Alias.Cipher.RSA//RAW", "RSA");
    341         put("Alg.Alias.Cipher.RSA//NOPADDING", "RSA");
    342         // BEGIN android-removed
    343         // put("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1");
    344         // put("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP");
    345         // put("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1");
    346         //
    347         // put("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
    348         // put("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
    349         // put("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL");
    350         // END android-removed
    351 
    352         put("Cipher.PBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithMD5AndDES");
    353         // BEGIN android-removed
    354         // put("Cipher.BROKENPBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithMD5AndDES");
    355         // END android-removed
    356         put("Cipher.PBEWITHMD5ANDRC2", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithMD5AndRC2");
    357         put("Cipher.PBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHA1AndDES");
    358         // BEGIN android-removed
    359         // put("Cipher.BROKENPBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHA1AndDES");
    360         // END android-removed
    361         put("Cipher.PBEWITHSHA1ANDRC2", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHA1AndRC2");
    362         put("Cipher.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndDES3Key");
    363         // BEGIN android-removed
    364         // put("Cipher.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES3Key");
    365         // put("Cipher.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndDES3Key");
    366         // END android-removed
    367         put("Cipher.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndDES2Key");
    368         // BEGIN android-removed
    369         // put("Cipher.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES2Key");
    370         // END android-removed
    371         put("Cipher.PBEWITHSHAAND128BITRC2-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAnd128BitRC2");
    372         put("Cipher.PBEWITHSHAAND40BITRC2-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAnd40BitRC2");
    373         put("Cipher.PBEWITHSHAAND128BITRC4", "org.bouncycastle.jce.provider.JCEStreamCipher$PBEWithSHAAnd128BitRC4");
    374         put("Cipher.PBEWITHSHAAND40BITRC4", "org.bouncycastle.jce.provider.JCEStreamCipher$PBEWithSHAAnd40BitRC4");
    375 
    376         // BEGIN android-changed
    377         put("Alg.Alias.Cipher.PBEWITHSHA1AND3-KEYTRIPLEDES-CBC", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC");
    378         put("Alg.Alias.Cipher.PBEWITHSHA1AND2-KEYTRIPLEDES-CBC", "PBEWITHSHAAND2-KEYTRIPLEDES-CBC");
    379         put("Alg.Alias.Cipher.PBEWITHSHA1AND128BITRC2-CBC", "PBEWITHSHAAND128BITRC2-CBC");
    380         put("Alg.Alias.Cipher.PBEWITHSHA1AND40BITRC2-CBC", "PBEWITHSHAAND40BITRC2-CBC");
    381         put("Alg.Alias.Cipher.PBEWITHSHA1AND128BITRC4", "PBEWITHSHAAND128BITRC4");
    382         put("Alg.Alias.Cipher.PBEWITHSHA1AND40BITRC4", "PBEWITHSHAAND40BITRC4");
    383         // END android-changed
    384 
    385         put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.getId(), "PBEWITHSHAAND128BITAES-CBC-BC");
    386         put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.getId(), "PBEWITHSHAAND192BITAES-CBC-BC");
    387         put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes256_cbc.getId(), "PBEWITHSHAAND256BITAES-CBC-BC");
    388         put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes128_cbc.getId(), "PBEWITHSHA256AND128BITAES-CBC-BC");
    389         put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.getId(), "PBEWITHSHA256AND192BITAES-CBC-BC");
    390         put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.getId(), "PBEWITHSHA256AND256BITAES-CBC-BC");
    391 
    392         put("Cipher.PBEWITHSHAAND128BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    393         put("Cipher.PBEWITHSHAAND192BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    394         put("Cipher.PBEWITHSHAAND256BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    395         put("Cipher.PBEWITHSHA256AND128BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    396         put("Cipher.PBEWITHSHA256AND192BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    397         put("Cipher.PBEWITHSHA256AND256BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    398         put("Alg.Alias.Cipher.PBEWITHSHA1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
    399         put("Alg.Alias.Cipher.PBEWITHSHA1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
    400         put("Alg.Alias.Cipher.PBEWITHSHA1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
    401         put("Alg.Alias.Cipher.PBEWITHSHA-1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
    402         put("Alg.Alias.Cipher.PBEWITHSHA-1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
    403         put("Alg.Alias.Cipher.PBEWITHSHA-1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
    404         put("Alg.Alias.Cipher.PBEWITHSHA-256AND128BITAES-CBC-BC","PBEWITHSHA256AND128BITAES-CBC-BC");
    405         put("Alg.Alias.Cipher.PBEWITHSHA-256AND192BITAES-CBC-BC","PBEWITHSHA256AND192BITAES-CBC-BC");
    406         put("Alg.Alias.Cipher.PBEWITHSHA-256AND256BITAES-CBC-BC","PBEWITHSHA256AND256BITAES-CBC-BC");
    407 
    408         put("Cipher.PBEWITHMD5AND128BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    409         put("Cipher.PBEWITHMD5AND192BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    410         put("Cipher.PBEWITHMD5AND256BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC");
    411 
    412         put("Cipher.PBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndTwofish");
    413         // BEGIN android-removed
    414         // put("Cipher.OLDPBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndTwofish");
    415         //
    416         // put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES");
    417         // put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2");
    418         // END android-removed
    419         put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES");
    420         put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDDES");
    421         put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES");
    422         put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithSHA1AndRC2_CBC, "PBEWITHSHA1ANDRC2");
    423 
    424         put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.1", "PBEWITHSHAAND128BITRC4");
    425         put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.2", "PBEWITHSHAAND40BITRC4");
    426         put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.3", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC");
    427         put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.4", "PBEWITHSHAAND2-KEYTRIPLEDES-CBC");
    428         put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.5", "PBEWITHSHAAND128BITRC2-CBC");
    429         put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.6", "PBEWITHSHAAND40BITRC2-CBC");
    430         put("Alg.Alias.Cipher.PBEWITHSHA1ANDDESEDE", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC");
    431         //
    432         // key generators.
    433         //
    434         put("KeyGenerator.DES", "org.bouncycastle.jce.provider.JCEKeyGenerator$DES");
    435         put("Alg.Alias.KeyGenerator." + OIWObjectIdentifiers.desCBC, "DES");
    436 
    437         // BEGIN android-removed
    438         // put("KeyGenerator.RC2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2");
    439         // put("KeyGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2");
    440         //
    441         // put("KeyGenerator.GOST28147", "org.bouncycastle.jce.provider.JCEKeyGenerator$GOST28147");
    442         // put("Alg.Alias.KeyGenerator.GOST", "GOST28147");
    443         // put("Alg.Alias.KeyGenerator.GOST-28147", "GOST28147");
    444         // put("Alg.Alias.KeyGenerator." + CryptoProObjectIdentifiers.gostR28147_cbc, "GOST28147");
    445         // END android-removed
    446 
    447         //
    448         // key pair generators.
    449         //
    450         put("KeyPairGenerator.RSA", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$RSA");
    451         put("KeyPairGenerator.DH", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$DH");
    452         put("KeyPairGenerator.DSA", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$DSA");
    453         // BEGIN android-removed
    454         // put("KeyPairGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ElGamal");
    455         // END android-removed
    456 
    457         put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1.1", "RSA");
    458         put("Alg.Alias.KeyPairGenerator.DIFFIEHELLMAN", "DH");
    459 
    460         // BEGIN android-removed
    461         // put("KeyPairGenerator.GOST3410", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$GOST3410");
    462         // put("Alg.Alias.KeyPairGenerator.GOST-3410", "GOST3410");
    463         // put("Alg.Alias.KeyPairGenerator.GOST-3410-94", "GOST3410");
    464         // END android-removed
    465 
    466         //
    467         // key factories
    468         //
    469         put("KeyFactory.RSA", "org.bouncycastle.jce.provider.JDKKeyFactory$RSA");
    470         put("KeyFactory.DH", "org.bouncycastle.jce.provider.JDKKeyFactory$DH");
    471         put("KeyFactory.DSA", "org.bouncycastle.jce.provider.JDKKeyFactory$DSA");
    472         // BEGIN android-removed
    473         // put("KeyFactory.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal");
    474         // put("KeyFactory.ElGamal", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal");
    475         //
    476         // put("KeyFactory.X.509", "org.bouncycastle.jce.provider.JDKKeyFactory$X509");
    477         // END android-removed
    478 
    479         put("Alg.Alias.KeyFactory.1.2.840.113549.1.1.1", "RSA");
    480         put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
    481 
    482         put("Alg.Alias.KeyFactory.DIFFIEHELLMAN", "DH");
    483 
    484         // BEGIN android-removed
    485         // put("KeyFactory.GOST3410", "org.bouncycastle.jce.provider.JDKKeyFactory$GOST3410");
    486         // put("Alg.Alias.KeyFactory.GOST-3410", "GOST3410");
    487         // put("Alg.Alias.KeyFactory.GOST-3410-94", "GOST3410");
    488         // put("Alg.Alias.KeyFactory." + CryptoProObjectIdentifiers.gostR3410_94, "GOST3410");
    489         // END android-removed
    490 
    491         //
    492         // Algorithm parameters
    493         //
    494         put("AlgorithmParameters.DES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
    495         put("Alg.Alias.AlgorithmParameters." + OIWObjectIdentifiers.desCBC, "DES");
    496         put("AlgorithmParameters.DESEDE", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
    497         // BEGIN android-changed
    498         put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.des_EDE3_CBC, "DESEDE");
    499         // END android-changed
    500         // BEGIN android-removed
    501         // put("AlgorithmParameters.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters");
    502         // put("AlgorithmParameters.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters");
    503         // END android-removed
    504 
    505         //
    506         // secret key factories.
    507         //
    508         put("SecretKeyFactory.DES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$DES");
    509         // BEGIN android-removed
    510         // put("SecretKeyFactory.PBEWITHMD2ANDDES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD2AndDES");
    511         // END android-removed
    512 
    513         // BEGIN android-removed
    514         // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES");
    515         // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2");
    516         // END android-removed
    517         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES");
    518         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDDES");
    519         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES");
    520         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndRC2_CBC, "PBEWITHSHA1ANDRC2");
    521 
    522         // BEGIN android-removed
    523         // put("SecretKeyFactory.PBEWITHMD2ANDRC2", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD2AndRC2");
    524         // END android-removed
    525         put("SecretKeyFactory.PBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5AndDES");
    526         put("SecretKeyFactory.PBEWITHMD5ANDRC2", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5AndRC2");
    527         put("SecretKeyFactory.PBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA1AndDES");
    528         put("SecretKeyFactory.PBEWITHSHA1ANDRC2", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA1AndRC2");
    529         put("SecretKeyFactory.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAndDES3Key");
    530         put("SecretKeyFactory.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAndDES2Key");
    531         put("SecretKeyFactory.PBEWITHSHAAND128BITRC4", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd128BitRC4");
    532         put("SecretKeyFactory.PBEWITHSHAAND40BITRC4", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd40BitRC4");
    533         put("SecretKeyFactory.PBEWITHSHAAND128BITRC2-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd128BitRC2");
    534         put("SecretKeyFactory.PBEWITHSHAAND40BITRC2-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd40BitRC2");
    535         put("SecretKeyFactory.PBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAndTwofish");
    536         // BEGIN android-removed
    537         // put("SecretKeyFactory.PBEWITHHMACRIPEMD160", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithRIPEMD160");
    538         // END android-removed
    539         put("SecretKeyFactory.PBEWITHHMACSHA1", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA");
    540         // BEGIN android-removed
    541         // put("SecretKeyFactory.PBEWITHHMACTIGER", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithTiger");
    542         // END android-removed
    543 
    544         put("SecretKeyFactory.PBEWITHMD5AND128BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5And128BitAESCBCOpenSSL");
    545         put("SecretKeyFactory.PBEWITHMD5AND192BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5And192BitAESCBCOpenSSL");
    546         put("SecretKeyFactory.PBEWITHMD5AND256BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5And256BitAESCBCOpenSSL");
    547 
    548         // BEGIN android-removed
    549         // put("Alg.Alias.SecretKeyFactory.PBE", "PBE/PKCS5");
    550         //
    551         // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHMD5ANDDES", "PBE/PKCS5");
    552         // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHA1ANDDES", "PBE/PKCS5");
    553         // put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12");
    554         // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12");
    555         // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "PBE/PKCS12");
    556         // put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAANDTWOFISH-CBC", "PBE/PKCS12");
    557         // END android-removed
    558 
    559         // BEGIN android-removed
    560         // put("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDDES-CBC", "PBEWITHMD2ANDDES");
    561         // put("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDRC2-CBC", "PBEWITHMD2ANDRC2");
    562         // END android-removed
    563         put("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDDES-CBC", "PBEWITHMD5ANDDES");
    564         put("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDRC2-CBC", "PBEWITHMD5ANDRC2");
    565         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDDES-CBC", "PBEWITHSHA1ANDDES");
    566         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDRC2-CBC", "PBEWITHSHA1ANDRC2");
    567         // BEGIN android-removed
    568         // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES");
    569         // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2");
    570         // END android-removed
    571         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES");
    572         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDRC2");
    573         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES");
    574         put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndRC2_CBC, "PBEWITHSHA1ANDRC2");
    575 
    576         put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.1", "PBEWITHSHAAND128BITRC4");
    577         put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.2", "PBEWITHSHAAND40BITRC4");
    578         put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.3", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC");
    579         put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.4", "PBEWITHSHAAND2-KEYTRIPLEDES-CBC");
    580         put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.5", "PBEWITHSHAAND128BITRC2-CBC");
    581         put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.6", "PBEWITHSHAAND40BITRC2-CBC");
    582         put("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
    583         put("Alg.Alias.SecretKeyFactory.1.3.14.3.2.26", "PBEWITHHMACSHA1");
    584         put("Alg.Alias.SecretKeyFactory.PBEWithSHAAnd3KeyTripleDES", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC");
    585 
    586         put("SecretKeyFactory.PBEWITHSHAAND128BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd128BitAESBC");
    587         put("SecretKeyFactory.PBEWITHSHAAND192BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd192BitAESBC");
    588         put("SecretKeyFactory.PBEWITHSHAAND256BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd256BitAESBC");
    589         put("SecretKeyFactory.PBEWITHSHA256AND128BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA256And128BitAESBC");
    590         put("SecretKeyFactory.PBEWITHSHA256AND192BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA256And192BitAESBC");
    591         put("SecretKeyFactory.PBEWITHSHA256AND256BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA256And256BitAESBC");
    592         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
    593         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
    594         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
    595         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA-1AND128BITAES-CBC-BC","PBEWITHSHAAND128BITAES-CBC-BC");
    596         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA-1AND192BITAES-CBC-BC","PBEWITHSHAAND192BITAES-CBC-BC");
    597         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA-1AND256BITAES-CBC-BC","PBEWITHSHAAND256BITAES-CBC-BC");
    598         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA-256AND128BITAES-CBC-BC","PBEWITHSHA256AND128BITAES-CBC-BC");
    599         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA-256AND192BITAES-CBC-BC","PBEWITHSHA256AND192BITAES-CBC-BC");
    600         put("Alg.Alias.SecretKeyFactory.PBEWITHSHA-256AND256BITAES-CBC-BC","PBEWITHSHA256AND256BITAES-CBC-BC");
    601         put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.getId(), "PBEWITHSHAAND128BITAES-CBC-BC");
    602         put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.getId(), "PBEWITHSHAAND192BITAES-CBC-BC");
    603         put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes256_cbc.getId(), "PBEWITHSHAAND256BITAES-CBC-BC");
    604         put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes128_cbc.getId(), "PBEWITHSHA256AND128BITAES-CBC-BC");
    605         put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.getId(), "PBEWITHSHA256AND192BITAES-CBC-BC");
    606         put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.getId(), "PBEWITHSHA256AND256BITAES-CBC-BC");
    607         // BEGIN android-added
    608 
    609         put("SecretKeyFactory.PBKDF2WithHmacSHA1", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBKDF2WithHmacSHA1");
    610         // END android-added
    611 
    612         addMacAlgorithms();
    613 
    614         addMessageDigestAlgorithms();
    615 
    616         addSignatureAlgorithms();
    617 
    618     // Certification Path API
    619         // BEGIN android-removed
    620         // put("CertPathValidator.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathValidatorSpi");
    621         // put("CertPathBuilder.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathBuilderSpi");
    622         // END android-removed
    623         // BEGIN android-changed
    624         // Use Alg.Alias so RFC3280 doesn't show up when iterating provider services, only PKIX
    625         put("Alg.Alias.CertPathValidator.RFC3280", "PKIX");
    626         put("Alg.Alias.CertPathBuilder.RFC3280", "PKIX");
    627         // END android-changed
    628         put("CertPathValidator.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi");
    629         put("CertPathBuilder.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi");
    630         put("CertStore.Collection", "org.bouncycastle.jce.provider.CertStoreCollectionSpi");
    631         // BEGIN android-removed
    632         // put("CertStore.LDAP", "org.bouncycastle.jce.provider.X509LDAPCertStoreSpi");
    633         // put("CertStore.Multi", "org.bouncycastle.jce.provider.MultiCertStoreSpi");
    634         // put("Alg.Alias.CertStore.X509LDAP", "LDAP");
    635         // END android-removed
    636     }
    637 
    638     private void loadAlgorithms(String packageName, String[] names)
    639     {
    640         for (int i = 0; i != names.length; i++)
    641         {
    642             Class clazz = null;
    643             try
    644             {
    645                 ClassLoader loader = this.getClass().getClassLoader();
    646 
    647                 if (loader != null)
    648                 {
    649                     clazz = loader.loadClass(packageName + names[i] + "$Mappings");
    650                 }
    651                 else
    652                 {
    653                     clazz = Class.forName(packageName + names[i] + "$Mappings");
    654                 }
    655             }
    656             catch (ClassNotFoundException e)
    657             {
    658                 // ignore
    659             }
    660 
    661             if (clazz != null)
    662             {
    663                 try
    664                 {
    665                     addMappings((Map)clazz.newInstance());
    666                 }
    667                 catch (Exception e)
    668                 {   // this should never ever happen!!
    669                     throw new InternalError("cannot create instance of "
    670                         + packageName + names[i] + "$Mappings : " + e);
    671                 }
    672             }
    673         }
    674     }
    675 
    676     private void addMappings(Map mappings)
    677     {
    678         // can't use putAll due to JDK 1.1
    679         for (Iterator it = mappings.keySet().iterator(); it.hasNext();)
    680         {
    681             Object key = it.next();
    682 
    683             if (containsKey(key))
    684             {
    685                 throw new IllegalStateException("duplicate provider key (" + key + ") found in " + mappings.getClass().getName());
    686             }
    687             put(key, mappings.get(key));
    688         }
    689     }
    690 
    691     //
    692     // macs
    693     //
    694     private void addMacAlgorithms()
    695     {
    696         // BEGIN android-removed
    697         // put("Mac.DESMAC", "org.bouncycastle.jce.provider.JCEMac$DES");
    698         // put("Alg.Alias.Mac.DES", "DESMAC");
    699         // put("Mac.DESMAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$DESCFB8");
    700         // put("Alg.Alias.Mac.DES/CFB8", "DESMAC/CFB8");
    701         //
    702         // put("Mac.DESWITHISO9797", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3");
    703         // put("Alg.Alias.Mac.DESISO9797MAC", "DESWITHISO9797");
    704         //
    705         // put("Mac.ISO9797ALG3MAC", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3");
    706         // put("Alg.Alias.Mac.ISO9797ALG3", "ISO9797ALG3MAC");
    707         // put("Mac.ISO9797ALG3WITHISO7816-4PADDING", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3with7816d4");
    708         // put("Alg.Alias.Mac.ISO9797ALG3MACWITHISO7816-4PADDING", "ISO9797ALG3WITHISO7816-4PADDING");
    709         //
    710         // put("Mac.RC2MAC", "org.bouncycastle.jce.provider.JCEMac$RC2");
    711         // put("Alg.Alias.Mac.RC2", "RC2MAC");
    712         // put("Mac.RC2MAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$RC2CFB8");
    713         // put("Alg.Alias.Mac.RC2/CFB8", "RC2MAC/CFB8");
    714         //
    715         //
    716         // put("Mac.GOST28147MAC", "org.bouncycastle.jce.provider.JCEMac$GOST28147");
    717         // put("Alg.Alias.Mac.GOST28147", "GOST28147MAC");
    718         //
    719         // put("Mac.OLDHMACSHA384", "org.bouncycastle.jce.provider.JCEMac$OldSHA384");
    720         //
    721         // put("Mac.OLDHMACSHA512", "org.bouncycastle.jce.provider.JCEMac$OldSHA512");
    722         //
    723         // addHMACAlgorithm("MD2", "org.bouncycastle.jce.provider.JCEMac$MD2", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD2HMAC");
    724         // addHMACAlgorithm("MD4", "org.bouncycastle.jce.provider.JCEMac$MD4", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD4HMAC");
    725         // END android-removed
    726         addHMACAlgorithm("MD5", "org.bouncycastle.jce.provider.JCEMac$MD5", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD5HMAC");
    727         addHMACAlias("MD5", IANAObjectIdentifiers.hmacMD5);
    728 
    729         addHMACAlgorithm("SHA1", "org.bouncycastle.jce.provider.JCEMac$SHA1", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA1");
    730         addHMACAlias("SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
    731         addHMACAlias("SHA1", IANAObjectIdentifiers.hmacSHA1);
    732         // BEGIN android-removed
    733         // addHMACAlgorithm("SHA224", "org.bouncycastle.jce.provider.JCEMac$SHA224", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA224");
    734         // addHMACAlias("SHA224", PKCSObjectIdentifiers.id_hmacWithSHA224);
    735         // END android-removed
    736         addHMACAlgorithm("SHA256", "org.bouncycastle.jce.provider.JCEMac$SHA256", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA256");
    737         addHMACAlias("SHA256", PKCSObjectIdentifiers.id_hmacWithSHA256);
    738         addHMACAlgorithm("SHA384", "org.bouncycastle.jce.provider.JCEMac$SHA384", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA384");
    739         addHMACAlias("SHA384", PKCSObjectIdentifiers.id_hmacWithSHA384);
    740         addHMACAlgorithm("SHA512", "org.bouncycastle.jce.provider.JCEMac$SHA512", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA512");
    741         addHMACAlias("SHA512", PKCSObjectIdentifiers.id_hmacWithSHA512);
    742 
    743         // BEGIN android-removed
    744         // addHMACAlgorithm("RIPEMD128", "org.bouncycastle.jce.provider.JCEMac$RIPEMD128", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD128HMAC");
    745         // addHMACAlgorithm("RIPEMD160", "org.bouncycastle.jce.provider.JCEMac$RIPEMD160", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD160HMAC");
    746         // addHMACAlias("RIPEMD160", IANAObjectIdentifiers.hmacRIPEMD160);
    747         //
    748         // addHMACAlgorithm("TIGER", "org.bouncycastle.jce.provider.JCEMac$Tiger", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACTIGER");
    749         // addHMACAlias("TIGER", IANAObjectIdentifiers.hmacTIGER);
    750         // END android-removed
    751 
    752         put("Mac.PBEWITHHMACSHA", "org.bouncycastle.jce.provider.JCEMac$PBEWithSHA");
    753         put("Mac.PBEWITHHMACSHA1", "org.bouncycastle.jce.provider.JCEMac$PBEWithSHA");
    754         // BEGIN android-removed
    755         // put("Mac.PBEWITHHMACRIPEMD160", "org.bouncycastle.jce.provider.JCEMac$PBEWithRIPEMD160");
    756         // END android-removed
    757         put("Alg.Alias.Mac.1.3.14.3.2.26", "PBEWITHHMACSHA");
    758     }
    759 
    760     private void addHMACAlgorithm(
    761         String algorithm,
    762         String algorithmClassName,
    763         String keyGeneratorClassName)
    764     {
    765         String mainName = "HMAC" + algorithm;
    766 
    767         put("Mac." + mainName, algorithmClassName);
    768         put("Alg.Alias.Mac.HMAC-" + algorithm, mainName);
    769         put("Alg.Alias.Mac.HMAC/" + algorithm, mainName);
    770         put("KeyGenerator." + mainName, keyGeneratorClassName);
    771         put("Alg.Alias.KeyGenerator.HMAC-" + algorithm, mainName);
    772         put("Alg.Alias.KeyGenerator.HMAC/" + algorithm, mainName);
    773     }
    774 
    775     private void addHMACAlias(
    776         String              algorithm,
    777         DERObjectIdentifier oid)
    778     {
    779         String mainName = "HMAC" + algorithm;
    780 
    781         put("Alg.Alias.Mac." + oid, mainName);
    782         put("Alg.Alias.KeyGenerator." + oid, mainName);
    783     }
    784 
    785     //
    786     // message digests
    787     //
    788     private void addMessageDigestAlgorithms()
    789     {
    790         put("MessageDigest.SHA-1", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA1");
    791         put("Alg.Alias.MessageDigest.SHA1", "SHA-1");
    792         put("Alg.Alias.MessageDigest.SHA", "SHA-1");
    793         put("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1");
    794         // BEGIN android-removed
    795         // put("MessageDigest.SHA-224", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA224");
    796         // put("Alg.Alias.MessageDigest.SHA224", "SHA-224");
    797         // put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha224, "SHA-224");
    798         // END android-removed
    799         put("MessageDigest.SHA-256", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA256");
    800         put("Alg.Alias.MessageDigest.SHA256", "SHA-256");
    801         put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha256, "SHA-256");
    802         put("MessageDigest.SHA-384", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA384");
    803         put("Alg.Alias.MessageDigest.SHA384", "SHA-384");
    804         put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha384, "SHA-384");
    805         put("MessageDigest.SHA-512", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA512");
    806         put("Alg.Alias.MessageDigest.SHA512", "SHA-512");
    807         put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512, "SHA-512");
    808 
    809         // BEGIN android-removed
    810         // put("MessageDigest.MD2", "org.bouncycastle.jce.provider.JDKMessageDigest$MD2");
    811         // put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md2, "MD2");
    812         // put("MessageDigest.MD4", "org.bouncycastle.jce.provider.JDKMessageDigest$MD4");
    813         // put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md4, "MD4");
    814         // END android-removed
    815         put("MessageDigest.MD5", "org.bouncycastle.jce.provider.JDKMessageDigest$MD5");
    816         put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md5, "MD5");
    817         // BEGIN android-removed
    818         // put("MessageDigest.RIPEMD128", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD128");
    819         // put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd128, "RIPEMD128");
    820         // put("MessageDigest.RIPEMD160", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD160");
    821         // put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd160, "RIPEMD160");
    822         // put("MessageDigest.RIPEMD256", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD256");
    823         // put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd256, "RIPEMD256");
    824         // put("MessageDigest.RIPEMD320", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD320");
    825         // put("MessageDigest.Tiger", "org.bouncycastle.jce.provider.JDKMessageDigest$Tiger");
    826 
    827         // put("MessageDigest.WHIRLPOOL", "org.bouncycastle.jce.provider.JDKMessageDigest$Whirlpool");
    828 
    829         // put("MessageDigest.GOST3411", "org.bouncycastle.jce.provider.JDKMessageDigest$GOST3411");
    830         // put("Alg.Alias.MessageDigest.GOST", "GOST3411");
    831         // put("Alg.Alias.MessageDigest.GOST-3411", "GOST3411");
    832         // put("Alg.Alias.MessageDigest." + CryptoProObjectIdentifiers.gostR3411, "GOST3411");
    833         // END android-removed
    834     }
    835 
    836     //
    837     // signature algorithms.
    838     //
    839     private void addSignatureAlgorithms()
    840     {
    841         // BEGIN android-removed
    842         // Dropping MD2
    843         // put("Signature.MD2WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD2WithRSAEncryption");
    844         // put("Signature.MD4WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD4WithRSAEncryption");
    845         // END android-removed
    846         put("Signature.MD5WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD5WithRSAEncryption");
    847         put("Signature.SHA1WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA1WithRSAEncryption");
    848         // BEGIN android-removed
    849         // put("Signature.SHA224WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA224WithRSAEncryption");
    850         // END android-removed
    851         put("Signature.SHA256WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA256WithRSAEncryption");
    852         put("Signature.SHA384WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA384WithRSAEncryption");
    853         put("Signature.SHA512WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA512WithRSAEncryption");
    854         // BEGIN android-removed
    855         // put("Signature.RIPEMD160WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD160WithRSAEncryption");
    856         // put("Signature.RIPEMD128WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD128WithRSAEncryption");
    857         // put("Signature.RIPEMD256WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD256WithRSAEncryption");
    858         // END android-removed
    859         // BEGIN android-changed
    860         put("Signature.SHA1withDSA", "org.bouncycastle.jce.provider.JDKDSASigner$stdDSA");
    861         // END android-changed
    862         put("Signature.NONEWITHDSA", "org.bouncycastle.jce.provider.JDKDSASigner$noneDSA");
    863         // BEGIN android-removed
    864         // put("Signature.SHA1withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$SHA1WithRSAEncryption");
    865         // put("Signature.MD5withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$MD5WithRSAEncryption");
    866         // put("Signature.RIPEMD160withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$RIPEMD160WithRSAEncryption");
    867         //
    868         // put("Signature.RSASSA-PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$PSSwithRSA");
    869         // put("Signature." + PKCSObjectIdentifiers.id_RSASSA_PSS, "org.bouncycastle.jce.provider.JDKPSSSigner$PSSwithRSA");
    870         // put("Signature.SHA1withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA1withRSA");
    871         // put("Signature.SHA224withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA224withRSA");
    872         // put("Signature.SHA256withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA256withRSA");
    873         // put("Signature.SHA384withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA384withRSA");
    874         // put("Signature.SHA512withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA512withRSA");
    875         //
    876         // put("Signature.RSA", "org.bouncycastle.jce.provider.JDKDigestSignature$noneRSA");
    877         // put("Signature.RAWRSASSA-PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$nonePSS");
    878         // END android-removed
    879 
    880         put("Alg.Alias.Signature.RAWDSA", "NONEWITHDSA");
    881 
    882         // BEGIN android-removed
    883         // put("Alg.Alias.Signature.RAWRSA", "RSA");
    884         // put("Alg.Alias.Signature.NONEWITHRSA", "RSA");
    885         // put("Alg.Alias.Signature.RAWRSAPSS", "RAWRSASSA-PSS");
    886         // put("Alg.Alias.Signature.NONEWITHRSAPSS", "RAWRSASSA-PSS");
    887         // put("Alg.Alias.Signature.NONEWITHRSASSA-PSS", "RAWRSASSA-PSS");
    888         //
    889         // put("Alg.Alias.Signature.RSAPSS", "RSASSA-PSS");
    890         //
    891         // put("Alg.Alias.Signature.SHA1withRSAandMGF1", "SHA1withRSA/PSS");
    892         // put("Alg.Alias.Signature.SHA224withRSAandMGF1", "SHA224withRSA/PSS");
    893         // put("Alg.Alias.Signature.SHA256withRSAandMGF1", "SHA256withRSA/PSS");
    894         // put("Alg.Alias.Signature.SHA384withRSAandMGF1", "SHA384withRSA/PSS");
    895         // put("Alg.Alias.Signature.SHA512withRSAandMGF1", "SHA512withRSA/PSS");
    896         //
    897         // put("Alg.Alias.Signature.MD2withRSAEncryption", "MD2WithRSAEncryption");
    898         // put("Alg.Alias.Signature.MD4withRSAEncryption", "MD4WithRSAEncryption");
    899         // END android-removed
    900         put("Alg.Alias.Signature.MD5withRSAEncryption", "MD5WithRSAEncryption");
    901         put("Alg.Alias.Signature.SHA1withRSAEncryption", "SHA1WithRSAEncryption");
    902         // BEGIN android-removed
    903         // put("Alg.Alias.Signature.SHA224withRSAEncryption", "SHA224WithRSAEncryption");
    904         // END android-removed
    905 
    906         put("Alg.Alias.Signature.SHA256withRSAEncryption", "SHA256WithRSAEncryption");
    907         put("Alg.Alias.Signature.SHA384withRSAEncryption", "SHA384WithRSAEncryption");
    908         put("Alg.Alias.Signature.SHA512withRSAEncryption", "SHA512WithRSAEncryption");
    909 
    910         put("Alg.Alias.Signature.SHA256WithRSAEncryption", "SHA256WithRSAEncryption");
    911         put("Alg.Alias.Signature.SHA384WithRSAEncryption", "SHA384WithRSAEncryption");
    912         put("Alg.Alias.Signature.SHA512WithRSAEncryption", "SHA512WithRSAEncryption");
    913 
    914         put("Alg.Alias.Signature.SHA256WITHRSAENCRYPTION", "SHA256WithRSAEncryption");
    915         put("Alg.Alias.Signature.SHA384WITHRSAENCRYPTION", "SHA384WithRSAEncryption");
    916         put("Alg.Alias.Signature.SHA512WITHRSAENCRYPTION", "SHA512WithRSAEncryption");
    917 
    918         // BEGIN android-removed
    919         // Dropping MD2
    920         // put("Alg.Alias.Signature.RIPEMD160withRSAEncryption", "RIPEMD160WithRSAEncryption");
    921         // put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md2WithRSAEncryption, "MD2WithRSAEncryption");
    922         // put("Alg.Alias.Signature.MD2WithRSA", "MD2WithRSAEncryption");
    923         // put("Alg.Alias.Signature.MD2withRSA", "MD2WithRSAEncryption");
    924         // put("Alg.Alias.Signature.MD2/RSA", "MD2WithRSAEncryption");
    925         // END android-removed
    926         put("Alg.Alias.Signature.MD5WithRSA", "MD5WithRSAEncryption");
    927         put("Alg.Alias.Signature.MD5withRSA", "MD5WithRSAEncryption");
    928         put("Alg.Alias.Signature.MD5/RSA", "MD5WithRSAEncryption");
    929         put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md5WithRSAEncryption, "MD5WithRSAEncryption");
    930         // BEGIN android-removed
    931         // put("Alg.Alias.Signature.MD4WithRSA", "MD4WithRSAEncryption");
    932         // put("Alg.Alias.Signature.MD4withRSA", "MD4WithRSAEncryption");
    933         // put("Alg.Alias.Signature.MD4/RSA", "MD4WithRSAEncryption");
    934         // put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md4WithRSAEncryption, "MD4WithRSAEncryption");
    935         // END android-removed
    936         put("Alg.Alias.Signature.SHA1WithRSA", "SHA1WithRSAEncryption");
    937         put("Alg.Alias.Signature.SHA1withRSA", "SHA1WithRSAEncryption");
    938         // BEGIN android-removed
    939         // put("Alg.Alias.Signature.SHA224WithRSA", "SHA224WithRSAEncryption");
    940         // put("Alg.Alias.Signature.SHA224withRSA", "SHA224WithRSAEncryption");
    941         // END android-removed
    942         put("Alg.Alias.Signature.SHA256WithRSA", "SHA256WithRSAEncryption");
    943         put("Alg.Alias.Signature.SHA256withRSA", "SHA256WithRSAEncryption");
    944         put("Alg.Alias.Signature.SHA384WithRSA", "SHA384WithRSAEncryption");
    945         put("Alg.Alias.Signature.SHA384withRSA", "SHA384WithRSAEncryption");
    946         put("Alg.Alias.Signature.SHA512WithRSA", "SHA512WithRSAEncryption");
    947         put("Alg.Alias.Signature.SHA512withRSA", "SHA512WithRSAEncryption");
    948         put("Alg.Alias.Signature.SHA1/RSA", "SHA1WithRSAEncryption");
    949         put("Alg.Alias.Signature.SHA-1/RSA", "SHA1WithRSAEncryption");
    950         put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha1WithRSAEncryption, "SHA1WithRSAEncryption");
    951         // BEGIN android-removed
    952         // put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WithRSAEncryption");
    953         // END android-removed
    954         put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256WithRSAEncryption");
    955         put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384WithRSAEncryption");
    956         put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha512WithRSAEncryption, "SHA512WithRSAEncryption");
    957         put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.1", "SHA1WithRSAEncryption");
    958         put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.5", "SHA1WithRSAEncryption");
    959         put("Alg.Alias.Signature.1.2.840.113549.2.5with1.2.840.113549.1.1.1", "MD5WithRSAEncryption");
    960         // BEGIN android-removed
    961         // put("Alg.Alias.Signature.RIPEMD160WithRSA", "RIPEMD160WithRSAEncryption");
    962         // put("Alg.Alias.Signature.RIPEMD160withRSA", "RIPEMD160WithRSAEncryption");
    963         // put("Alg.Alias.Signature.RIPEMD128WithRSA", "RIPEMD128WithRSAEncryption");
    964         // put("Alg.Alias.Signature.RIPEMD128withRSA", "RIPEMD128WithRSAEncryption");
    965         // put("Alg.Alias.Signature.RIPEMD256WithRSA", "RIPEMD256WithRSAEncryption");
    966         // put("Alg.Alias.Signature.RIPEMD256withRSA", "RIPEMD256WithRSAEncryption");
    967         // put("Alg.Alias.Signature.RIPEMD-160/RSA", "RIPEMD160WithRSAEncryption");
    968         // put("Alg.Alias.Signature.RMD160withRSA", "RIPEMD160WithRSAEncryption");
    969         // put("Alg.Alias.Signature.RMD160/RSA", "RIPEMD160WithRSAEncryption");
    970         // put("Alg.Alias.Signature.1.3.36.3.3.1.2", "RIPEMD160WithRSAEncryption");
    971         // put("Alg.Alias.Signature.1.3.36.3.3.1.3", "RIPEMD128WithRSAEncryption");
    972         // put("Alg.Alias.Signature.1.3.36.3.3.1.4", "RIPEMD256WithRSAEncryption");
    973         // END android-removed
    974         put("Alg.Alias.Signature." + OIWObjectIdentifiers.sha1WithRSA, "SHA1WithRSAEncryption");
    975 
    976         // BEGIN android-removed
    977         // put("Alg.Alias.Signature.MD2WITHRSAENCRYPTION", "MD2WithRSAEncryption");
    978         // END android-removed
    979         put("Alg.Alias.Signature.MD5WITHRSAENCRYPTION", "MD5WithRSAEncryption");
    980         put("Alg.Alias.Signature.SHA1WITHRSAENCRYPTION", "SHA1WithRSAEncryption");
    981         // BEGIN android-removed
    982         // put("Alg.Alias.Signature.RIPEMD160WITHRSAENCRYPTION", "RIPEMD160WithRSAEncryption");
    983         // END android-removed
    984 
    985         put("Alg.Alias.Signature.MD5WITHRSA", "MD5WithRSAEncryption");
    986         put("Alg.Alias.Signature.SHA1WITHRSA", "SHA1WithRSAEncryption");
    987         // BEGIN android-removed
    988         // put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption");
    989         // put("Alg.Alias.Signature.RMD160WITHRSA", "RIPEMD160WithRSAEncryption");
    990         // put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption");
    991         // END android-removed
    992 
    993         // BEGIN android-removed
    994         // addSignatureAlgorithm("SHA224", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa224", NISTObjectIdentifiers.dsa_with_sha224);
    995         // addSignatureAlgorithm("SHA256", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa256", NISTObjectIdentifiers.dsa_with_sha256);
    996         // addSignatureAlgorithm("SHA384", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384);
    997         // addSignatureAlgorithm("SHA512", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512);
    998         // END android-removed
    999 
   1000         // BEGIN android-changed
   1001         put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA");
   1002         put("Alg.Alias.Signature.DSA", "SHA1withDSA");
   1003         put("Alg.Alias.Signature.SHA1WITHDSA", "SHA1withDSA");
   1004         put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "SHA1withDSA");
   1005         put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "SHA1withDSA");
   1006         put("Alg.Alias.Signature.DSAwithSHA1", "SHA1withDSA");
   1007         put("Alg.Alias.Signature.DSAWITHSHA1", "SHA1withDSA");
   1008         put("Alg.Alias.Signature.SHA1WithDSA", "SHA1withDSA");
   1009         put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA");
   1010         put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA");
   1011         // END android-changed
   1012         // BEGIN android-removed
   1013         // put("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2");
   1014         // put("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2");
   1015         // put("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2");
   1016         //
   1017         // put("Signature.ECGOST3410", "org.bouncycastle.jce.provider.JDKGOST3410Signer$ecgost3410");
   1018         // put("Alg.Alias.Signature.ECGOST-3410", "ECGOST3410");
   1019         // put("Alg.Alias.Signature.GOST-3410-2001", "ECGOST3410");
   1020         // put("Alg.Alias.Signature.GOST3411withECGOST3410", "ECGOST3410");
   1021         // put("Alg.Alias.Signature.GOST3411WITHECGOST3410", "ECGOST3410");
   1022         // put("Alg.Alias.Signature.GOST3411WithECGOST3410", "ECGOST3410");
   1023         // put("Alg.Alias.Signature." + CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "ECGOST3410");
   1024         //
   1025         // put("Signature.GOST3410", "org.bouncycastle.jce.provider.JDKGOST3410Signer$gost3410");
   1026         // put("Alg.Alias.Signature.GOST-3410", "GOST3410");
   1027         // put("Alg.Alias.Signature.GOST-3410-94", "GOST3410");
   1028         // put("Alg.Alias.Signature.GOST3411withGOST3410", "GOST3410");
   1029         // put("Alg.Alias.Signature.GOST3411WITHGOST3410", "GOST3410");
   1030         // put("Alg.Alias.Signature.GOST3411WithGOST3410", "GOST3410");
   1031         // put("Alg.Alias.Signature." + CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3410");
   1032         // END android-removed
   1033     }
   1034 
   1035     // BEGIN android-removed
   1036     // private void addSignatureAlgorithm(
   1037     //     String digest,
   1038     //     String algorithm,
   1039     //     String className,
   1040     //     DERObjectIdentifier oid)
   1041     // {
   1042     //     String mainName = digest + "WITH" + algorithm;
   1043     //     String jdk11Variation1 = digest + "with" + algorithm;
   1044     //     String jdk11Variation2 = digest + "With" + algorithm;
   1045     //     String alias = digest + "/" + algorithm;
   1046     //
   1047     //     put("Signature." + mainName, className);
   1048     //     put("Alg.Alias.Signature." + jdk11Variation1, mainName);
   1049     //     put("Alg.Alias.Signature." + jdk11Variation2, mainName);
   1050     //     put("Alg.Alias.Signature." + alias, mainName);
   1051     //     put("Alg.Alias.Signature." + oid, mainName);
   1052     //     put("Alg.Alias.Signature.OID." + oid, mainName);
   1053     // }
   1054     // END android-removed
   1055 
   1056     public void setParameter(String parameterName, Object parameter)
   1057     {
   1058         ProviderUtil.setParameter(parameterName, parameter);
   1059     }
   1060 }
   1061