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