1 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/ASN1Null.java bcprov-jdk15on-149/org/bouncycastle/asn1/ASN1Null.java 2 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/ASN1Null.java 2013-05-31 21:16:46.000000000 +0000 3 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/ASN1Null.java 2013-01-31 02:26:40.000000000 +0000 4 @@ -11,9 +11,11 @@ 5 /** 6 * @deprecated use DERNull.INSTANCE 7 */ 8 - public ASN1Null() 9 + // BEGIN android-changed 10 + /*package*/ ASN1Null() 11 { 12 } 13 + // END android-changed 14 15 public static ASN1Null getInstance(Object o) 16 { 17 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERBoolean.java bcprov-jdk15on-149/org/bouncycastle/asn1/DERBoolean.java 18 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERBoolean.java 2013-05-31 21:16:46.000000000 +0000 19 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/DERBoolean.java 2013-05-25 02:14:15.000000000 +0000 20 @@ -10,7 +10,9 @@ 21 private static final byte[] TRUE_VALUE = new byte[] { (byte)0xff }; 22 private static final byte[] FALSE_VALUE = new byte[] { 0 }; 23 24 - private byte[] value; 25 + // BEGIN android-changed 26 + final private byte[] value; 27 + // END android-changed 28 29 public static final ASN1Boolean FALSE = new ASN1Boolean(false); 30 public static final ASN1Boolean TRUE = new ASN1Boolean(true); 31 @@ -55,6 +57,17 @@ 32 return (value != 0 ? TRUE : FALSE); 33 } 34 35 + // BEGIN android-added 36 + /** 37 + * return a DERBoolean from the passed in array. 38 + */ 39 + public static DERBoolean getInstance( 40 + byte[] octets) 41 + { 42 + return (octets[0] != 0) ? TRUE : FALSE; 43 + } 44 + 45 + // END android-added 46 /** 47 * return a Boolean from a tagged object. 48 * 49 @@ -80,7 +93,9 @@ 50 } 51 } 52 53 - DERBoolean( 54 + // BEGIN android-changed 55 + protected DERBoolean( 56 + // END android-changed 57 byte[] value) 58 { 59 if (value.length != 1) 60 @@ -106,8 +121,10 @@ 61 * @deprecated use getInstance(boolean) method. 62 * @param value 63 */ 64 - public DERBoolean( 65 + // BEGIN android-changed 66 + protected DERBoolean( 67 boolean value) 68 + // END android-changed 69 { 70 this.value = (value) ? TRUE_VALUE : FALSE_VALUE; 71 } 72 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERNull.java bcprov-jdk15on-149/org/bouncycastle/asn1/DERNull.java 73 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERNull.java 2013-05-31 21:16:46.000000000 +0000 74 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/DERNull.java 2013-01-31 02:26:40.000000000 +0000 75 @@ -15,7 +15,9 @@ 76 /** 77 * @deprecated use DERNull.INSTANCE 78 */ 79 - public DERNull() 80 + // BEGIN android-changed 81 + protected DERNull() 82 + // END android-changed 83 { 84 } 85 86 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERObjectIdentifier.java bcprov-jdk15on-149/org/bouncycastle/asn1/DERObjectIdentifier.java 87 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERObjectIdentifier.java 2013-05-31 21:16:46.000000000 +0000 88 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/DERObjectIdentifier.java 2013-05-25 02:14:15.000000000 +0000 89 @@ -144,7 +144,13 @@ 90 } 91 } 92 93 - this.identifier = objId.toString(); 94 + // BEGIN android-changed 95 + /* 96 + * Intern the identifier so there aren't hundreds of duplicates 97 + * (in practice). 98 + */ 99 + this.identifier = objId.toString().intern(); 100 + // END android-changed 101 this.body = Arrays.clone(bytes); 102 } 103 104 @@ -160,7 +166,13 @@ 105 throw new IllegalArgumentException("string " + identifier + " not an OID"); 106 } 107 108 - this.identifier = identifier; 109 + // BEGIN android-changed 110 + /* 111 + * Intern the identifier so there aren't hundreds of duplicates 112 + * (in practice). 113 + */ 114 + this.identifier = identifier.intern(); 115 + // END android-changed 116 } 117 118 DERObjectIdentifier(DERObjectIdentifier oid, String branchID) 119 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERPrintableString.java bcprov-jdk15on-149/org/bouncycastle/asn1/DERPrintableString.java 120 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/DERPrintableString.java 2013-05-31 21:16:46.000000000 +0000 121 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/DERPrintableString.java 2013-01-31 02:26:40.000000000 +0000 122 @@ -12,7 +12,9 @@ 123 extends ASN1Primitive 124 implements ASN1String 125 { 126 - private byte[] string; 127 + // BEGIN android-changed 128 + private final byte[] string; 129 + // END android-changed 130 131 /** 132 * return a printable string from the passed in object. 133 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/cms/ContentInfo.java bcprov-jdk15on-149/org/bouncycastle/asn1/cms/ContentInfo.java 134 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/cms/ContentInfo.java 2013-05-31 21:16:46.000000000 +0000 135 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/cms/ContentInfo.java 2013-05-25 02:14:15.000000000 +0000 136 @@ -12,7 +12,9 @@ 137 138 public class ContentInfo 139 extends ASN1Object 140 - implements CMSObjectIdentifiers 141 + // BEGIN android-removed 142 + // implements CMSObjectIdentifiers 143 + // END android-removed 144 { 145 private ASN1ObjectIdentifier contentType; 146 private ASN1Encodable content; 147 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java bcprov-jdk15on-149/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 148 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2013-05-31 21:16:46.000000000 +0000 149 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2013-01-31 02:26:40.000000000 +0000 150 @@ -10,8 +10,10 @@ 151 // 152 static final ASN1ObjectIdentifier pkcs_1 = new ASN1ObjectIdentifier("1.2.840.113549.1.1"); 153 static final ASN1ObjectIdentifier rsaEncryption = pkcs_1.branch("1"); 154 - static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2"); 155 - static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3"); 156 + // BEGIN android-removed 157 + // static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2"); 158 + // static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3"); 159 + // END android-removed 160 static final ASN1ObjectIdentifier md5WithRSAEncryption = pkcs_1.branch("4"); 161 static final ASN1ObjectIdentifier sha1WithRSAEncryption = pkcs_1.branch("5"); 162 static final ASN1ObjectIdentifier srsaOAEPEncryptionSET = pkcs_1.branch("6"); 163 @@ -22,7 +24,9 @@ 164 static final ASN1ObjectIdentifier sha256WithRSAEncryption = pkcs_1.branch("11"); 165 static final ASN1ObjectIdentifier sha384WithRSAEncryption = pkcs_1.branch("12"); 166 static final ASN1ObjectIdentifier sha512WithRSAEncryption = pkcs_1.branch("13"); 167 - static final ASN1ObjectIdentifier sha224WithRSAEncryption = pkcs_1.branch("14"); 168 + // BEGIN android-removed 169 + // static final ASN1ObjectIdentifier sha224WithRSAEncryption = pkcs_1.branch("14"); 170 + // END android-removed 171 172 // 173 // pkcs-3 OBJECT IDENTIFIER ::= { 174 @@ -66,13 +70,17 @@ 175 // md2 OBJECT IDENTIFIER ::= 176 // {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 2} 177 // 178 - static final ASN1ObjectIdentifier md2 = digestAlgorithm.branch("2"); 179 + // BEGIN android-removed 180 + // static final ASN1ObjectIdentifier md2 = digestAlgorithm.branch("2"); 181 + // END android-removed 182 183 // 184 // md4 OBJECT IDENTIFIER ::= 185 // {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 4} 186 // 187 - static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4"); 188 + // BEGIN android-removed 189 + // static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4"); 190 + // END android-removed 191 192 // 193 // md5 OBJECT IDENTIFIER ::= 194 @@ -81,7 +89,9 @@ 195 static final ASN1ObjectIdentifier md5 = digestAlgorithm.branch("5"); 196 197 static final ASN1ObjectIdentifier id_hmacWithSHA1 = digestAlgorithm.branch("7"); 198 - static final ASN1ObjectIdentifier id_hmacWithSHA224 = digestAlgorithm.branch("8"); 199 + // BEGIN android-removed 200 + // static final ASN1ObjectIdentifier id_hmacWithSHA224 = digestAlgorithm.branch("8"); 201 + // END android-removed 202 static final ASN1ObjectIdentifier id_hmacWithSHA256 = digestAlgorithm.branch("9"); 203 static final ASN1ObjectIdentifier id_hmacWithSHA384 = digestAlgorithm.branch("10"); 204 static final ASN1ObjectIdentifier id_hmacWithSHA512 = digestAlgorithm.branch("11"); 205 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java bcprov-jdk15on-149/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java 206 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java 2013-05-31 21:16:46.000000000 +0000 207 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java 2013-05-25 02:14:15.000000000 +0000 208 @@ -14,7 +14,9 @@ 209 import org.bouncycastle.asn1.DERSequence; 210 import org.bouncycastle.asn1.DERTaggedObject; 211 import org.bouncycastle.crypto.Digest; 212 -import org.bouncycastle.crypto.digests.SHA1Digest; 213 +// BEGIN android-changed 214 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 215 +// END android-changed 216 217 /** 218 * The AuthorityKeyIdentifier object. 219 @@ -106,7 +108,9 @@ 220 public AuthorityKeyIdentifier( 221 SubjectPublicKeyInfo spki) 222 { 223 - Digest digest = new SHA1Digest(); 224 + // BEGIN android-changed 225 + Digest digest = AndroidDigestFactory.getSHA1(); 226 + // END android-changed 227 byte[] resBuf = new byte[digest.getDigestSize()]; 228 229 byte[] bytes = spki.getPublicKeyData().getBytes(); 230 @@ -124,7 +128,9 @@ 231 GeneralNames name, 232 BigInteger serialNumber) 233 { 234 - Digest digest = new SHA1Digest(); 235 + // BEGIN android-changed 236 + Digest digest = AndroidDigestFactory.getSHA1(); 237 + // END android-changed 238 byte[] resBuf = new byte[digest.getDigestSize()]; 239 240 byte[] bytes = spki.getPublicKeyData().getBytes(); 241 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java bcprov-jdk15on-149/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java 242 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java 2013-05-31 21:16:46.000000000 +0000 243 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java 2013-01-31 02:26:40.000000000 +0000 244 @@ -6,7 +6,9 @@ 245 import org.bouncycastle.asn1.ASN1TaggedObject; 246 import org.bouncycastle.asn1.DEROctetString; 247 import org.bouncycastle.crypto.Digest; 248 -import org.bouncycastle.crypto.digests.SHA1Digest; 249 +// BEGIN android-changed 250 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 251 +// END android-changed 252 253 /** 254 * The SubjectKeyIdentifier object. 255 @@ -124,7 +126,9 @@ 256 257 private static byte[] getDigest(SubjectPublicKeyInfo spki) 258 { 259 - Digest digest = new SHA1Digest(); 260 + // BEGIN android-changed 261 + Digest digest = AndroidDigestFactory.getSHA1(); 262 + // END android-changed 263 byte[] resBuf = new byte[digest.getDigestSize()]; 264 265 byte[] bytes = spki.getPublicKeyData().getBytes(); 266 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/X509Name.java bcprov-jdk15on-149/org/bouncycastle/asn1/x509/X509Name.java 267 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/X509Name.java 2013-05-31 21:16:46.000000000 +0000 268 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/x509/X509Name.java 2013-05-25 02:14:15.000000000 +0000 269 @@ -255,8 +255,10 @@ 270 */ 271 public static final Hashtable SymbolLookUp = DefaultLookUp; 272 273 - private static final Boolean TRUE = new Boolean(true); // for J2ME compatibility 274 - private static final Boolean FALSE = new Boolean(false); 275 + // BEGIN android-changed 276 + private static final Boolean TRUE = Boolean.TRUE; 277 + private static final Boolean FALSE = Boolean.FALSE; 278 + // END android-changed 279 280 static 281 { 282 @@ -446,7 +448,9 @@ 283 throw new IllegalArgumentException("cannot encode value"); 284 } 285 } 286 - added.addElement((i != 0) ? TRUE : FALSE); // to allow earlier JDK compatibility 287 + // BEGIN android-changed 288 + added.addElement(Boolean.valueOf(i != 0)); 289 + // END android-changed 290 } 291 } 292 } 293 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java bcprov-jdk15on-149/org/bouncycastle/asn1/x509/X509NameTokenizer.java 294 --- bcprov-jdk15on-149.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2013-05-31 21:16:46.000000000 +0000 295 +++ bcprov-jdk15on-149/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2013-05-25 02:14:15.000000000 +0000 296 @@ -78,6 +78,17 @@ 297 } 298 else 299 { 300 + // BEGIN android-added 301 + // copied from a newer version of BouncyCastle 302 + if (c == '#' && buf.charAt(buf.length() - 1) == '=') 303 + { 304 + buf.append('\\'); 305 + } 306 + else if (c == '+' && separator != '+') 307 + { 308 + buf.append('\\'); 309 + } 310 + // END android-added 311 buf.append(c); 312 } 313 } 314 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 315 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 1970-01-01 00:00:00.000000000 +0000 316 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 2013-05-01 01:48:41.000000000 +0000 317 @@ -0,0 +1,83 @@ 318 +/* 319 + * Copyright (C) 2012 The Android Open Source Project 320 + * 321 + * Licensed under the Apache License, Version 2.0 (the "License"); 322 + * you may not use this file except in compliance with the License. 323 + * You may obtain a copy of the License at 324 + * 325 + * http://www.apache.org/licenses/LICENSE-2.0 326 + * 327 + * Unless required by applicable law or agreed to in writing, software 328 + * distributed under the License is distributed on an "AS IS" BASIS, 329 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 330 + * See the License for the specific language governing permissions and 331 + * limitations under the License. 332 + */ 333 + 334 +package org.bouncycastle.crypto.digests; 335 + 336 +import org.bouncycastle.crypto.Digest; 337 + 338 +/** 339 + * Level of indirection to let us select OpenSSLDigest implementations 340 + * for libcore but fallback to BouncyCastle ones on the RI. 341 + */ 342 +public final class AndroidDigestFactory { 343 + private static final String OpenSSLFactoryClassName 344 + = AndroidDigestFactory.class.getName() + "OpenSSL"; 345 + private static final String BouncyCastleFactoryClassName 346 + = AndroidDigestFactory.class.getName() + "BouncyCastle"; 347 + 348 + private static final AndroidDigestFactoryInterface FACTORY; 349 + static { 350 + Class factoryImplementationClass; 351 + try { 352 + factoryImplementationClass = Class.forName(OpenSSLFactoryClassName); 353 + // Double check for NativeCrypto in case we are running on RI for testing 354 + Class.forName("com.android.org.conscrypt.NativeCrypto"); 355 + } catch (ClassNotFoundException e1) { 356 + try { 357 + factoryImplementationClass = Class.forName(BouncyCastleFactoryClassName); 358 + } catch (ClassNotFoundException e2) { 359 + AssertionError e = new AssertionError("Failed to load " 360 + + "AndroidDigestFactoryInterface " 361 + + "implementation. Looked for " 362 + + OpenSSLFactoryClassName + " and " 363 + + BouncyCastleFactoryClassName); 364 + e.initCause(e1); 365 + throw e; 366 + } 367 + } 368 + if (!AndroidDigestFactoryInterface.class.isAssignableFrom(factoryImplementationClass)) { 369 + throw new AssertionError(factoryImplementationClass 370 + + "does not implement AndroidDigestFactoryInterface"); 371 + } 372 + try { 373 + FACTORY = (AndroidDigestFactoryInterface) factoryImplementationClass.newInstance(); 374 + } catch (InstantiationException e) { 375 + throw new AssertionError(e); 376 + } catch (IllegalAccessException e) { 377 + throw new AssertionError(e); 378 + } 379 + } 380 + 381 + public static Digest getMD5() { 382 + return FACTORY.getMD5(); 383 + } 384 + 385 + public static Digest getSHA1() { 386 + return FACTORY.getSHA1(); 387 + } 388 + 389 + public static Digest getSHA256() { 390 + return FACTORY.getSHA256(); 391 + } 392 + 393 + public static Digest getSHA384() { 394 + return FACTORY.getSHA384(); 395 + } 396 + 397 + public static Digest getSHA512() { 398 + return FACTORY.getSHA512(); 399 + } 400 +} 401 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java 402 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java 1970-01-01 00:00:00.000000000 +0000 403 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java 2012-09-17 23:04:47.000000000 +0000 404 @@ -0,0 +1,37 @@ 405 +/* 406 + * Copyright (C) 2012 The Android Open Source Project 407 + * 408 + * Licensed under the Apache License, Version 2.0 (the "License"); 409 + * you may not use this file except in compliance with the License. 410 + * You may obtain a copy of the License at 411 + * 412 + * http://www.apache.org/licenses/LICENSE-2.0 413 + * 414 + * Unless required by applicable law or agreed to in writing, software 415 + * distributed under the License is distributed on an "AS IS" BASIS, 416 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 417 + * See the License for the specific language governing permissions and 418 + * limitations under the License. 419 + */ 420 + 421 +package org.bouncycastle.crypto.digests; 422 + 423 +import org.bouncycastle.crypto.Digest; 424 + 425 +public class AndroidDigestFactoryBouncyCastle implements AndroidDigestFactoryInterface { 426 + public Digest getMD5() { 427 + return new MD5Digest(); 428 + } 429 + public Digest getSHA1() { 430 + return new SHA1Digest(); 431 + } 432 + public Digest getSHA256() { 433 + return new SHA256Digest(); 434 + } 435 + public Digest getSHA384() { 436 + return new SHA384Digest(); 437 + } 438 + public Digest getSHA512() { 439 + return new SHA512Digest(); 440 + } 441 +} 442 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java 443 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java 1970-01-01 00:00:00.000000000 +0000 444 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java 2012-09-17 23:04:47.000000000 +0000 445 @@ -0,0 +1,27 @@ 446 +/* 447 + * Copyright (C) 2012 The Android Open Source Project 448 + * 449 + * Licensed under the Apache License, Version 2.0 (the "License"); 450 + * you may not use this file except in compliance with the License. 451 + * You may obtain a copy of the License at 452 + * 453 + * http://www.apache.org/licenses/LICENSE-2.0 454 + * 455 + * Unless required by applicable law or agreed to in writing, software 456 + * distributed under the License is distributed on an "AS IS" BASIS, 457 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 458 + * See the License for the specific language governing permissions and 459 + * limitations under the License. 460 + */ 461 + 462 +package org.bouncycastle.crypto.digests; 463 + 464 +import org.bouncycastle.crypto.Digest; 465 + 466 +interface AndroidDigestFactoryInterface { 467 + public Digest getMD5(); 468 + public Digest getSHA1(); 469 + public Digest getSHA256(); 470 + public Digest getSHA384(); 471 + public Digest getSHA512(); 472 +} 473 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java 474 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java 1970-01-01 00:00:00.000000000 +0000 475 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java 2012-09-17 23:04:47.000000000 +0000 476 @@ -0,0 +1,37 @@ 477 +/* 478 + * Copyright (C) 2012 The Android Open Source Project 479 + * 480 + * Licensed under the Apache License, Version 2.0 (the "License"); 481 + * you may not use this file except in compliance with the License. 482 + * You may obtain a copy of the License at 483 + * 484 + * http://www.apache.org/licenses/LICENSE-2.0 485 + * 486 + * Unless required by applicable law or agreed to in writing, software 487 + * distributed under the License is distributed on an "AS IS" BASIS, 488 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 489 + * See the License for the specific language governing permissions and 490 + * limitations under the License. 491 + */ 492 + 493 +package org.bouncycastle.crypto.digests; 494 + 495 +import org.bouncycastle.crypto.Digest; 496 + 497 +public class AndroidDigestFactoryOpenSSL implements AndroidDigestFactoryInterface { 498 + public Digest getMD5() { 499 + return new OpenSSLDigest.MD5(); 500 + } 501 + public Digest getSHA1() { 502 + return new OpenSSLDigest.SHA1(); 503 + } 504 + public Digest getSHA256() { 505 + return new OpenSSLDigest.SHA256(); 506 + } 507 + public Digest getSHA384() { 508 + return new OpenSSLDigest.SHA384(); 509 + } 510 + public Digest getSHA512() { 511 + return new OpenSSLDigest.SHA512(); 512 + } 513 +} 514 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java bcprov-jdk15on-149/org/bouncycastle/crypto/digests/OpenSSLDigest.java 515 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java 1970-01-01 00:00:00.000000000 +0000 516 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/digests/OpenSSLDigest.java 2013-04-24 05:37:59.000000000 +0000 517 @@ -0,0 +1,159 @@ 518 +/* 519 + * Copyright (C) 2008 The Android Open Source Project 520 + * 521 + * Licensed under the Apache License, Version 2.0 (the "License"); 522 + * you may not use this file except in compliance with the License. 523 + * You may obtain a copy of the License at 524 + * 525 + * http://www.apache.org/licenses/LICENSE-2.0 526 + * 527 + * Unless required by applicable law or agreed to in writing, software 528 + * distributed under the License is distributed on an "AS IS" BASIS, 529 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 530 + * See the License for the specific language governing permissions and 531 + * limitations under the License. 532 + */ 533 + 534 +package org.bouncycastle.crypto.digests; 535 + 536 +import com.android.org.conscrypt.NativeCrypto; 537 +import org.bouncycastle.crypto.ExtendedDigest; 538 + 539 +/** 540 + * Implements the BouncyCastle Digest interface using OpenSSL's EVP API. 541 + */ 542 +public class OpenSSLDigest implements ExtendedDigest { 543 + 544 + /** 545 + * Holds the standard name of the hashing algorithm, e.g. "SHA-1"; 546 + */ 547 + private final String algorithm; 548 + 549 + /** 550 + * Holds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1"); 551 + */ 552 + private final long evp_md; 553 + 554 + /** 555 + * Holds the output size of the message digest. 556 + */ 557 + private final int size; 558 + 559 + /** 560 + * Holds the block size of the message digest. 561 + */ 562 + private final int blockSize; 563 + 564 + /** 565 + * Holds a pointer to the native message digest context. It is 566 + * lazily initialized to avoid having to reallocate on reset when 567 + * its unlikely to be reused. 568 + */ 569 + private long ctx; 570 + 571 + /** 572 + * Holds a dummy buffer for writing single bytes to the digest. 573 + */ 574 + private final byte[] singleByte = new byte[1]; 575 + 576 + /** 577 + * Creates a new OpenSSLMessageDigest instance for the given algorithm 578 + * name. 579 + */ 580 + private OpenSSLDigest(String algorithm, long evp_md, int size, int blockSize) { 581 + this.algorithm = algorithm; 582 + this.evp_md = evp_md; 583 + this.size = size; 584 + this.blockSize = blockSize; 585 + } 586 + 587 + public String getAlgorithmName() { 588 + return algorithm; 589 + } 590 + 591 + public int getDigestSize() { 592 + return size; 593 + } 594 + 595 + public int getByteLength() { 596 + return blockSize; 597 + } 598 + 599 + public void reset() { 600 + free(); 601 + } 602 + 603 + public void update(byte in) { 604 + singleByte[0] = in; 605 + update(singleByte, 0, 1); 606 + } 607 + 608 + public void update(byte[] in, int inOff, int len) { 609 + NativeCrypto.EVP_DigestUpdate(getCtx(), in, inOff, len); 610 + } 611 + 612 + public int doFinal(byte[] out, int outOff) { 613 + int i = NativeCrypto.EVP_DigestFinal(getCtx(), out, outOff); 614 + ctx = 0; // EVP_DigestFinal frees the context as a side effect 615 + reset(); 616 + return i; 617 + } 618 + 619 + private long getCtx() { 620 + if (ctx == 0) { 621 + ctx = NativeCrypto.EVP_DigestInit(evp_md); 622 + } 623 + return ctx; 624 + } 625 + 626 + private void free() { 627 + if (ctx != 0) { 628 + NativeCrypto.EVP_MD_CTX_destroy(ctx); 629 + ctx = 0; 630 + } 631 + } 632 + 633 + @Override 634 + protected void finalize() throws Throwable { 635 + try { 636 + free(); 637 + } finally { 638 + super.finalize(); 639 + } 640 + } 641 + 642 + public static class MD5 extends OpenSSLDigest { 643 + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("md5"); 644 + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 645 + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 646 + public MD5() { super("MD5", EVP_MD, SIZE, BLOCK_SIZE); } 647 + } 648 + 649 + public static class SHA1 extends OpenSSLDigest { 650 + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha1"); 651 + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 652 + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 653 + public SHA1() { super("SHA-1", EVP_MD, SIZE, BLOCK_SIZE); } 654 + } 655 + 656 + public static class SHA256 extends OpenSSLDigest { 657 + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha256"); 658 + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 659 + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 660 + public SHA256() { super("SHA-256", EVP_MD, SIZE, BLOCK_SIZE); } 661 + } 662 + 663 + public static class SHA384 extends OpenSSLDigest { 664 + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha384"); 665 + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 666 + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 667 + public SHA384() { super("SHA-384", EVP_MD, SIZE, BLOCK_SIZE); } 668 + } 669 + 670 + public static class SHA512 extends OpenSSLDigest { 671 + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha512"); 672 + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 673 + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 674 + public SHA512() { super("SHA-512", EVP_MD, SIZE, BLOCK_SIZE); } 675 + } 676 +} 677 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/encodings/OAEPEncoding.java bcprov-jdk15on-149/org/bouncycastle/crypto/encodings/OAEPEncoding.java 678 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/encodings/OAEPEncoding.java 2013-05-31 21:16:46.000000000 +0000 679 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/encodings/OAEPEncoding.java 2013-05-25 02:14:15.000000000 +0000 680 @@ -6,7 +6,9 @@ 681 import org.bouncycastle.crypto.CipherParameters; 682 import org.bouncycastle.crypto.Digest; 683 import org.bouncycastle.crypto.InvalidCipherTextException; 684 -import org.bouncycastle.crypto.digests.SHA1Digest; 685 +// BEGIN android-changed 686 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 687 +// END android-changed 688 import org.bouncycastle.crypto.params.ParametersWithRandom; 689 690 /** 691 @@ -25,7 +27,9 @@ 692 public OAEPEncoding( 693 AsymmetricBlockCipher cipher) 694 { 695 - this(cipher, new SHA1Digest(), null); 696 + // BEGIN android-changed 697 + this(cipher, AndroidDigestFactory.getSHA1(), null); 698 + // END android-changed 699 } 700 701 public OAEPEncoding( 702 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/encodings/PKCS1Encoding.java bcprov-jdk15on-149/org/bouncycastle/crypto/encodings/PKCS1Encoding.java 703 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/encodings/PKCS1Encoding.java 2013-05-31 21:16:46.000000000 +0000 704 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/encodings/PKCS1Encoding.java 2013-01-31 02:26:40.000000000 +0000 705 @@ -216,6 +216,12 @@ 706 throw new InvalidCipherTextException("unknown block type"); 707 } 708 } 709 + // BEGIN android-added 710 + if ((type == 1 && forPrivateKey) || (type == 2 && !forPrivateKey)) 711 + { 712 + throw new InvalidCipherTextException("invalid block type " + type); 713 + } 714 + // END android-added 715 716 if (useStrictLength && block.length != engine.getOutputBlockSize()) 717 { 718 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/engines/DESedeWrapEngine.java bcprov-jdk15on-149/org/bouncycastle/crypto/engines/DESedeWrapEngine.java 719 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/engines/DESedeWrapEngine.java 2013-05-31 21:16:46.000000000 +0000 720 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/engines/DESedeWrapEngine.java 2012-09-17 23:04:47.000000000 +0000 721 @@ -6,7 +6,9 @@ 722 import org.bouncycastle.crypto.Digest; 723 import org.bouncycastle.crypto.InvalidCipherTextException; 724 import org.bouncycastle.crypto.Wrapper; 725 -import org.bouncycastle.crypto.digests.SHA1Digest; 726 +// BEGIN android-changed 727 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 728 +// END android-changed 729 import org.bouncycastle.crypto.modes.CBCBlockCipher; 730 import org.bouncycastle.crypto.params.KeyParameter; 731 import org.bouncycastle.crypto.params.ParametersWithIV; 732 @@ -52,7 +54,9 @@ 733 // 734 // checksum digest 735 // 736 - Digest sha1 = new SHA1Digest(); 737 + // BEGIN android-changed 738 + Digest sha1 = AndroidDigestFactory.getSHA1(); 739 + // END android-changed 740 byte[] digest = new byte[20]; 741 742 /** 743 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java bcprov-jdk15on-149/org/bouncycastle/crypto/generators/DHParametersHelper.java 744 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java 2013-05-31 21:16:46.000000000 +0000 745 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/generators/DHParametersHelper.java 2012-09-17 23:04:47.000000000 +0000 746 @@ -3,10 +3,17 @@ 747 import java.math.BigInteger; 748 import java.security.SecureRandom; 749 750 +// BEGIN android-added 751 +import java.util.logging.Logger; 752 +// END android-added 753 import org.bouncycastle.util.BigIntegers; 754 755 class DHParametersHelper 756 { 757 + // BEGIN android-added 758 + private static final Logger logger = Logger.getLogger(DHParametersHelper.class.getName()); 759 + // END android-added 760 + 761 private static final BigInteger ONE = BigInteger.valueOf(1); 762 private static final BigInteger TWO = BigInteger.valueOf(2); 763 764 @@ -17,11 +24,19 @@ 765 */ 766 static BigInteger[] generateSafePrimes(int size, int certainty, SecureRandom random) 767 { 768 + // BEGIN android-added 769 + logger.info("Generating safe primes. This may take a long time."); 770 + long start = System.currentTimeMillis(); 771 + int tries = 0; 772 + // END android-added 773 BigInteger p, q; 774 int qLength = size - 1; 775 776 for (;;) 777 { 778 + // BEGIN android-added 779 + tries++; 780 + // END android-added 781 q = new BigInteger(qLength, 2, random); 782 783 // p <- 2q + 1 784 @@ -32,6 +47,11 @@ 785 break; 786 } 787 } 788 + // BEGIN android-added 789 + long end = System.currentTimeMillis(); 790 + long duration = end - start; 791 + logger.info("Generated safe primes: " + tries + " tries took " + duration + "ms"); 792 + // END android-added 793 794 return new BigInteger[] { p, q }; 795 } 796 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/DSAParametersGenerator.java bcprov-jdk15on-149/org/bouncycastle/crypto/generators/DSAParametersGenerator.java 797 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/DSAParametersGenerator.java 2013-05-31 21:16:46.000000000 +0000 798 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/generators/DSAParametersGenerator.java 2013-05-25 02:14:15.000000000 +0000 799 @@ -4,7 +4,9 @@ 800 import java.security.SecureRandom; 801 802 import org.bouncycastle.crypto.Digest; 803 -import org.bouncycastle.crypto.digests.SHA1Digest; 804 +// BEGIN android-changed 805 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 806 +// END android-changed 807 import org.bouncycastle.crypto.params.DSAParameterGenerationParameters; 808 import org.bouncycastle.crypto.params.DSAParameters; 809 import org.bouncycastle.crypto.params.DSAValidationParameters; 810 @@ -31,7 +33,9 @@ 811 812 public DSAParametersGenerator() 813 { 814 - this(new SHA1Digest()); 815 + // BEGIN android-changed 816 + this(AndroidDigestFactory.getSHA1()); 817 + // END android-changed 818 } 819 820 public DSAParametersGenerator(Digest digest) 821 @@ -122,7 +126,9 @@ 822 int n = (L - 1) / 160; 823 byte[] w = new byte[L / 8]; 824 825 - if (!(digest instanceof SHA1Digest)) 826 + // BEGIN android-changed 827 + if (!(digest.getAlgorithmName().equals("SHA-1"))) 828 + // END android-changed 829 { 830 throw new IllegalStateException("can only use SHA-1 for generating FIPS 186-2 parameters"); 831 } 832 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java bcprov-jdk15on-149/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java 833 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java 2013-05-31 21:16:46.000000000 +0000 834 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java 2012-09-17 23:04:47.000000000 +0000 835 @@ -3,7 +3,9 @@ 836 import org.bouncycastle.crypto.CipherParameters; 837 import org.bouncycastle.crypto.Digest; 838 import org.bouncycastle.crypto.PBEParametersGenerator; 839 -import org.bouncycastle.crypto.digests.MD5Digest; 840 +// BEGIN android-changed 841 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 842 +// END android-changed 843 import org.bouncycastle.crypto.params.KeyParameter; 844 import org.bouncycastle.crypto.params.ParametersWithIV; 845 846 @@ -17,7 +19,9 @@ 847 public class OpenSSLPBEParametersGenerator 848 extends PBEParametersGenerator 849 { 850 - private Digest digest = new MD5Digest(); 851 + // BEGIN android-changed 852 + private Digest digest = AndroidDigestFactory.getMD5(); 853 + // END android-changed 854 855 /** 856 * Construct a OpenSSL Parameters generator. 857 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java bcprov-jdk15on-149/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java 858 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java 2013-05-31 21:16:46.000000000 +0000 859 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java 2013-05-25 02:14:15.000000000 +0000 860 @@ -4,7 +4,9 @@ 861 import org.bouncycastle.crypto.Digest; 862 import org.bouncycastle.crypto.Mac; 863 import org.bouncycastle.crypto.PBEParametersGenerator; 864 -import org.bouncycastle.crypto.digests.SHA1Digest; 865 +// BEGIN android-changed 866 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 867 +// END android-changed 868 import org.bouncycastle.crypto.macs.HMac; 869 import org.bouncycastle.crypto.params.KeyParameter; 870 import org.bouncycastle.crypto.params.ParametersWithIV; 871 @@ -28,7 +30,9 @@ 872 */ 873 public PKCS5S2ParametersGenerator() 874 { 875 - this(new SHA1Digest()); 876 + // BEGIN android-changed 877 + this(AndroidDigestFactory.getSHA1()); 878 + // END android-changed 879 } 880 881 public PKCS5S2ParametersGenerator(Digest digest) 882 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/macs/HMac.java bcprov-jdk15on-149/org/bouncycastle/crypto/macs/HMac.java 883 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/macs/HMac.java 2013-05-31 21:16:46.000000000 +0000 884 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/macs/HMac.java 2013-05-25 02:14:15.000000000 +0000 885 @@ -36,23 +36,31 @@ 886 { 887 blockLengths = new Hashtable(); 888 889 - blockLengths.put("GOST3411", Integers.valueOf(32)); 890 - 891 - blockLengths.put("MD2", Integers.valueOf(16)); 892 - blockLengths.put("MD4", Integers.valueOf(64)); 893 + // BEGIN android-removed 894 + // blockLengths.put("GOST3411", Integers.valueOf(32)); 895 + // 896 + // blockLengths.put("MD2", Integers.valueOf(16)); 897 + // blockLengths.put("MD4", Integers.valueOf(64)); 898 + // END android-removed 899 blockLengths.put("MD5", Integers.valueOf(64)); 900 901 - blockLengths.put("RIPEMD128", Integers.valueOf(64)); 902 - blockLengths.put("RIPEMD160", Integers.valueOf(64)); 903 + // BEGIN android-removed 904 + // blockLengths.put("RIPEMD128", Integers.valueOf(64)); 905 + // blockLengths.put("RIPEMD160", Integers.valueOf(64)); 906 + // END android-removed 907 908 blockLengths.put("SHA-1", Integers.valueOf(64)); 909 - blockLengths.put("SHA-224", Integers.valueOf(64)); 910 + // BEGIN android-removed 911 + // blockLengths.put("SHA-224", Integers.valueOf(64)); 912 + // END android-removed 913 blockLengths.put("SHA-256", Integers.valueOf(64)); 914 blockLengths.put("SHA-384", Integers.valueOf(128)); 915 blockLengths.put("SHA-512", Integers.valueOf(128)); 916 917 - blockLengths.put("Tiger", Integers.valueOf(64)); 918 - blockLengths.put("Whirlpool", Integers.valueOf(64)); 919 + // BEGIN android-removed 920 + // blockLengths.put("Tiger", Integers.valueOf(64)); 921 + // blockLengths.put("Whirlpool", Integers.valueOf(64)); 922 + // END android-removed 923 } 924 925 private static int getByteLength( 926 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java bcprov-jdk15on-149/org/bouncycastle/crypto/signers/RSADigestSigner.java 927 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java 2013-05-31 21:16:46.000000000 +0000 928 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/signers/RSADigestSigner.java 2012-09-17 23:04:47.000000000 +0000 929 @@ -39,18 +39,24 @@ 930 */ 931 static 932 { 933 - oidMap.put("RIPEMD128", TeleTrusTObjectIdentifiers.ripemd128); 934 - oidMap.put("RIPEMD160", TeleTrusTObjectIdentifiers.ripemd160); 935 - oidMap.put("RIPEMD256", TeleTrusTObjectIdentifiers.ripemd256); 936 + // BEGIN android-removed 937 + // oidMap.put("RIPEMD128", TeleTrusTObjectIdentifiers.ripemd128); 938 + // oidMap.put("RIPEMD160", TeleTrusTObjectIdentifiers.ripemd160); 939 + // oidMap.put("RIPEMD256", TeleTrusTObjectIdentifiers.ripemd256); 940 + // END android-removed 941 942 oidMap.put("SHA-1", X509ObjectIdentifiers.id_SHA1); 943 - oidMap.put("SHA-224", NISTObjectIdentifiers.id_sha224); 944 + // BEGIN android-removed 945 + // oidMap.put("SHA-224", NISTObjectIdentifiers.id_sha224); 946 + // END android-removed 947 oidMap.put("SHA-256", NISTObjectIdentifiers.id_sha256); 948 oidMap.put("SHA-384", NISTObjectIdentifiers.id_sha384); 949 oidMap.put("SHA-512", NISTObjectIdentifiers.id_sha512); 950 951 - oidMap.put("MD2", PKCSObjectIdentifiers.md2); 952 - oidMap.put("MD4", PKCSObjectIdentifiers.md4); 953 + // BEGIN android-removed 954 + // oidMap.put("MD2", PKCSObjectIdentifiers.md2); 955 + // oidMap.put("MD4", PKCSObjectIdentifiers.md4); 956 + // END android-removed 957 oidMap.put("MD5", PKCSObjectIdentifiers.md5); 958 } 959 960 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java bcprov-jdk15on-149/org/bouncycastle/crypto/util/PrivateKeyFactory.java 961 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2013-05-31 21:16:46.000000000 +0000 962 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2013-01-31 02:26:40.000000000 +0000 963 @@ -11,7 +11,9 @@ 964 import org.bouncycastle.asn1.ASN1Primitive; 965 import org.bouncycastle.asn1.ASN1Sequence; 966 import org.bouncycastle.asn1.nist.NISTNamedCurves; 967 -import org.bouncycastle.asn1.oiw.ElGamalParameter; 968 +// BEGIN android-removed 969 +// import org.bouncycastle.asn1.oiw.ElGamalParameter; 970 +// END android-removed 971 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 972 import org.bouncycastle.asn1.pkcs.DHParameter; 973 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 974 @@ -19,7 +21,9 @@ 975 import org.bouncycastle.asn1.pkcs.RSAPrivateKey; 976 import org.bouncycastle.asn1.sec.ECPrivateKey; 977 import org.bouncycastle.asn1.sec.SECNamedCurves; 978 -import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 979 +// BEGIN android-removed 980 +// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 981 +// END android-removed 982 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 983 import org.bouncycastle.asn1.x509.DSAParameter; 984 import org.bouncycastle.asn1.x9.X962NamedCurves; 985 @@ -33,8 +37,10 @@ 986 import org.bouncycastle.crypto.params.DSAPrivateKeyParameters; 987 import org.bouncycastle.crypto.params.ECDomainParameters; 988 import org.bouncycastle.crypto.params.ECPrivateKeyParameters; 989 -import org.bouncycastle.crypto.params.ElGamalParameters; 990 -import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; 991 +// BEGIN android-removed 992 +// import org.bouncycastle.crypto.params.ElGamalParameters; 993 +// import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; 994 +// END android-removed 995 import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; 996 997 /** 998 @@ -100,14 +106,16 @@ 999 1000 return new DHPrivateKeyParameters(derX.getValue(), dhParams); 1001 } 1002 - else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 1003 - { 1004 - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters()); 1005 - ASN1Integer derX = (ASN1Integer)keyInfo.parsePrivateKey(); 1006 - 1007 - return new ElGamalPrivateKeyParameters(derX.getValue(), new ElGamalParameters( 1008 - params.getP(), params.getG())); 1009 - } 1010 + // BEGIN android-removed 1011 + // else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 1012 + // { 1013 + // ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters()); 1014 + // ASN1Integer = (ASN1Integer)keyInfo.parsePrivateKey(); 1015 + // 1016 + // return new ElGamalPrivateKeyParameters(derX.getValue(), new ElGamalParameters( 1017 + // params.getP(), params.getG())); 1018 + // } 1019 + // END android-removed 1020 else if (algId.getAlgorithm().equals(X9ObjectIdentifiers.id_dsa)) 1021 { 1022 ASN1Integer derX = (ASN1Integer)keyInfo.parsePrivateKey(); 1023 @@ -140,10 +148,12 @@ 1024 { 1025 x9 = NISTNamedCurves.getByOID(oid); 1026 1027 - if (x9 == null) 1028 - { 1029 - x9 = TeleTrusTNamedCurves.getByOID(oid); 1030 - } 1031 + // BEGIN android-removed 1032 + // if (x9 == null) 1033 + // { 1034 + // x9 = TeleTrusTNamedCurves.getByOID(oid); 1035 + // } 1036 + // END android-removed 1037 } 1038 } 1039 } 1040 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java bcprov-jdk15on-149/org/bouncycastle/crypto/util/PublicKeyFactory.java 1041 --- bcprov-jdk15on-149.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java 2013-05-31 21:16:46.000000000 +0000 1042 +++ bcprov-jdk15on-149/org/bouncycastle/crypto/util/PublicKeyFactory.java 2013-01-31 02:26:40.000000000 +0000 1043 @@ -13,13 +13,17 @@ 1044 import org.bouncycastle.asn1.ASN1Sequence; 1045 import org.bouncycastle.asn1.DEROctetString; 1046 import org.bouncycastle.asn1.nist.NISTNamedCurves; 1047 -import org.bouncycastle.asn1.oiw.ElGamalParameter; 1048 +// BEGIN android-removed 1049 +// import org.bouncycastle.asn1.oiw.ElGamalParameter; 1050 +// END android-removed 1051 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 1052 import org.bouncycastle.asn1.pkcs.DHParameter; 1053 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 1054 import org.bouncycastle.asn1.pkcs.RSAPublicKey; 1055 import org.bouncycastle.asn1.sec.SECNamedCurves; 1056 -import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 1057 +// BEGIN android-removed 1058 +// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 1059 +// END android-removed 1060 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 1061 import org.bouncycastle.asn1.x509.DSAParameter; 1062 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 1063 @@ -40,8 +44,10 @@ 1064 import org.bouncycastle.crypto.params.DSAPublicKeyParameters; 1065 import org.bouncycastle.crypto.params.ECDomainParameters; 1066 import org.bouncycastle.crypto.params.ECPublicKeyParameters; 1067 -import org.bouncycastle.crypto.params.ElGamalParameters; 1068 -import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; 1069 +// BEGIN android-removed 1070 +// import org.bouncycastle.crypto.params.ElGamalParameters; 1071 +// import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; 1072 +// END android-removed 1073 import org.bouncycastle.crypto.params.RSAKeyParameters; 1074 1075 /** 1076 @@ -135,14 +141,16 @@ 1077 1078 return new DHPublicKeyParameters(derY.getValue(), dhParams); 1079 } 1080 - else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 1081 - { 1082 - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters()); 1083 - ASN1Integer derY = (ASN1Integer)keyInfo.parsePublicKey(); 1084 - 1085 - return new ElGamalPublicKeyParameters(derY.getValue(), new ElGamalParameters( 1086 - params.getP(), params.getG())); 1087 - } 1088 + // BEGIN android-removed 1089 + // else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 1090 + // { 1091 + // ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters()); 1092 + // ASN1Integer derY = (ASN1Integer)keyInfo.parsePublicKey(); 1093 + // 1094 + // return new ElGamalPublicKeyParameters(derY.getValue(), new ElGamalParameters( 1095 + // params.getP(), params.getG())); 1096 + // } 1097 + // END android-removed 1098 else if (algId.getAlgorithm().equals(X9ObjectIdentifiers.id_dsa) 1099 || algId.getAlgorithm().equals(OIWObjectIdentifiers.dsaWithSHA1)) 1100 { 1101 @@ -177,10 +185,12 @@ 1102 { 1103 x9 = NISTNamedCurves.getByOID(oid); 1104 1105 - if (x9 == null) 1106 - { 1107 - x9 = TeleTrusTNamedCurves.getByOID(oid); 1108 - } 1109 + // BEGIN android-removed 1110 + // if (x9 == null) 1111 + // { 1112 + // x9 = TeleTrusTNamedCurves.getByOID(oid); 1113 + // } 1114 + // END android-removed 1115 } 1116 } 1117 } 1118 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/DH.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/DH.java 1119 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/DH.java 2013-05-31 21:16:46.000000000 +0000 1120 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/DH.java 2013-05-25 02:14:15.000000000 +0000 1121 @@ -32,10 +32,12 @@ 1122 1123 provider.addAlgorithm("AlgorithmParameterGenerator.DH", PREFIX + "AlgorithmParameterGeneratorSpi"); 1124 1125 - provider.addAlgorithm("Cipher.DHIES", PREFIX + "IESCipher$IES"); 1126 - provider.addAlgorithm("Cipher.DHIESwithAES", PREFIX + "IESCipher$IESwithAES"); 1127 - provider.addAlgorithm("Cipher.DHIESWITHAES", PREFIX + "IESCipher$IESwithAES"); 1128 - provider.addAlgorithm("Cipher.DHIESWITHDESEDE", PREFIX + "IESCipher$IESwithDESede"); 1129 + // BEGIN android-removed 1130 + // provider.addAlgorithm("Cipher.DHIES", PREFIX + "IESCipher$IES"); 1131 + // provider.addAlgorithm("Cipher.DHIESwithAES", PREFIX + "IESCipher$IESwithAES"); 1132 + // provider.addAlgorithm("Cipher.DHIESWITHAES", PREFIX + "IESCipher$IESwithAES"); 1133 + // provider.addAlgorithm("Cipher.DHIESWITHDESEDE", PREFIX + "IESCipher$IESwithDESede"); 1134 + // END android-removed 1135 } 1136 } 1137 } 1138 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/DSA.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/DSA.java 1139 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/DSA.java 2013-05-31 21:16:46.000000000 +0000 1140 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/DSA.java 2013-01-31 02:26:40.000000000 +0000 1141 @@ -27,33 +27,43 @@ 1142 provider.addAlgorithm("KeyPairGenerator.DSA", PREFIX + "KeyPairGeneratorSpi"); 1143 provider.addAlgorithm("KeyFactory.DSA", PREFIX + "KeyFactorySpi"); 1144 1145 - provider.addAlgorithm("Signature.DSA", PREFIX + "DSASigner$stdDSA"); 1146 + // BEGIN android-changed 1147 + provider.addAlgorithm("Signature.SHA1withDSA", PREFIX + "DSASigner$stdDSA"); 1148 + // END android-changed 1149 provider.addAlgorithm("Signature.NONEWITHDSA", PREFIX + "DSASigner$noneDSA"); 1150 1151 provider.addAlgorithm("Alg.Alias.Signature.RAWDSA", "NONEWITHDSA"); 1152 1153 - addSignatureAlgorithm(provider, "SHA224", "DSA", PREFIX + "DSASigner$dsa224", NISTObjectIdentifiers.dsa_with_sha224); 1154 - addSignatureAlgorithm(provider, "SHA256", "DSA", PREFIX + "DSASigner$dsa256", NISTObjectIdentifiers.dsa_with_sha256); 1155 - addSignatureAlgorithm(provider, "SHA384", "DSA", PREFIX + "DSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384); 1156 - addSignatureAlgorithm(provider, "SHA512", "DSA", PREFIX + "DSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512); 1157 - 1158 - provider.addAlgorithm("Alg.Alias.Signature.SHA/DSA", "DSA"); 1159 - provider.addAlgorithm("Alg.Alias.Signature.SHA1withDSA", "DSA"); 1160 - provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHDSA", "DSA"); 1161 - provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "DSA"); 1162 - provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "DSA"); 1163 - provider.addAlgorithm("Alg.Alias.Signature.DSAwithSHA1", "DSA"); 1164 - provider.addAlgorithm("Alg.Alias.Signature.DSAWITHSHA1", "DSA"); 1165 - provider.addAlgorithm("Alg.Alias.Signature.SHA1WithDSA", "DSA"); 1166 - provider.addAlgorithm("Alg.Alias.Signature.DSAWithSHA1", "DSA"); 1167 + // BEGIN android-removed 1168 + // addSignatureAlgorithm(provider, "SHA224", "DSA", PREFIX + "DSASigner$dsa224", NISTObjectIdentifiers.dsa_with_sha224); 1169 + // addSignatureAlgorithm(provider, "SHA256", "DSA", PREFIX + "DSASigner$dsa256", NISTObjectIdentifiers.dsa_with_sha256); 1170 + // addSignatureAlgorithm(provider, "SHA384", "DSA", PREFIX + "DSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384); 1171 + // addSignatureAlgorithm(provider, "SHA512", "DSA", PREFIX + "DSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512); 1172 + // END android-removed 1173 + 1174 + // BEGIN android-added 1175 + provider.addAlgorithm("Alg.Alias.Signature.DSA", "SHA1withDSA"); 1176 + // END android-added 1177 + // BEGIN android-changed 1178 + provider.addAlgorithm("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA"); 1179 + provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHDSA", "SHA1withDSA"); 1180 + provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "SHA1withDSA"); 1181 + provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "SHA1withDSA"); 1182 + provider.addAlgorithm("Alg.Alias.Signature.DSAwithSHA1", "SHA1withDSA"); 1183 + provider.addAlgorithm("Alg.Alias.Signature.DSAWITHSHA1", "SHA1withDSA"); 1184 + provider.addAlgorithm("Alg.Alias.Signature.SHA1WithDSA", "SHA1withDSA"); 1185 + provider.addAlgorithm("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA"); 1186 1187 - provider.addAlgorithm("Alg.Alias.Signature.1.2.840.10040.4.3", "DSA"); 1188 + provider.addAlgorithm("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA"); 1189 + // END android-changed 1190 1191 AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi(); 1192 1193 for (int i = 0; i != DSAUtil.dsaOids.length; i++) 1194 { 1195 - provider.addAlgorithm("Alg.Alias.Signature." + DSAUtil.dsaOids[i], "DSA"); 1196 + // BEGIN android-changed 1197 + provider.addAlgorithm("Alg.Alias.Signature." + DSAUtil.dsaOids[i], "SHA1withDSA"); 1198 + // END android-changed 1199 1200 registerOid(provider, DSAUtil.dsaOids[i], "DSA", keyFact); 1201 registerOidAlgorithmParameters(provider, DSAUtil.dsaOids[i], "DSA"); 1202 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/EC.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/EC.java 1203 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/EC.java 2013-05-31 21:16:46.000000000 +0000 1204 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/EC.java 2013-05-25 02:14:15.000000000 +0000 1205 @@ -1,7 +1,9 @@ 1206 package org.bouncycastle.jcajce.provider.asymmetric; 1207 1208 -import org.bouncycastle.asn1.eac.EACObjectIdentifiers; 1209 -import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 1210 +// BEGIN android-removed 1211 +// import org.bouncycastle.asn1.eac.EACObjectIdentifiers; 1212 +// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 1213 +// END android-removed 1214 import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 1215 import org.bouncycastle.jcajce.provider.asymmetric.ec.KeyFactorySpi; 1216 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 1217 @@ -21,39 +23,49 @@ 1218 public void configure(ConfigurableProvider provider) 1219 { 1220 provider.addAlgorithm("KeyAgreement.ECDH", PREFIX + "KeyAgreementSpi$DH"); 1221 - provider.addAlgorithm("KeyAgreement.ECDHC", PREFIX + "KeyAgreementSpi$DHC"); 1222 - provider.addAlgorithm("KeyAgreement.ECMQV", PREFIX + "KeyAgreementSpi$MQV"); 1223 - provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$DHwithSHA1KDF"); 1224 - provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$MQVwithSHA1KDF"); 1225 + // BEGIN android-removed 1226 + // provider.addAlgorithm("KeyAgreement.ECDHC", PREFIX + "KeyAgreementSpi$DHC"); 1227 + // provider.addAlgorithm("KeyAgreement.ECMQV", PREFIX + "KeyAgreementSpi$MQV"); 1228 + // provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$DHwithSHA1KDF"); 1229 + // provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$MQVwithSHA1KDF"); 1230 + // END android-removed 1231 1232 registerOid(provider, X9ObjectIdentifiers.id_ecPublicKey, "EC", new KeyFactorySpi.EC()); 1233 // TODO Should this be an alias for ECDH? 1234 registerOid(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC", new KeyFactorySpi.EC()); 1235 - registerOid(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV()); 1236 - 1237 - registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.id_ecPublicKey, "EC"); 1238 - // TODO Should this be an alias for ECDH? 1239 - registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC"); 1240 - registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "EC"); 1241 + // BEGIN android-removed 1242 + // registerOid(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV()); 1243 + // END android-removed 1244 + 1245 + // BEGIN android-removed 1246 + // registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.id_ecPublicKey, "EC"); 1247 + // // TODO Should this be an alias for ECDH? 1248 + // registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC"); 1249 + // registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "EC"); 1250 + // END android-removed 1251 1252 provider.addAlgorithm("KeyFactory.EC", PREFIX + "KeyFactorySpi$EC"); 1253 - provider.addAlgorithm("KeyFactory.ECDSA", PREFIX + "KeyFactorySpi$ECDSA"); 1254 - provider.addAlgorithm("KeyFactory.ECDH", PREFIX + "KeyFactorySpi$ECDH"); 1255 - provider.addAlgorithm("KeyFactory.ECDHC", PREFIX + "KeyFactorySpi$ECDHC"); 1256 - provider.addAlgorithm("KeyFactory.ECMQV", PREFIX + "KeyFactorySpi$ECMQV"); 1257 + // BEGIN android-removed 1258 + // provider.addAlgorithm("KeyFactory.ECDSA", PREFIX + "KeyFactorySpi$ECDSA"); 1259 + // provider.addAlgorithm("KeyFactory.ECDH", PREFIX + "KeyFactorySpi$ECDH"); 1260 + // provider.addAlgorithm("KeyFactory.ECDHC", PREFIX + "KeyFactorySpi$ECDHC"); 1261 + // provider.addAlgorithm("KeyFactory.ECMQV", PREFIX + "KeyFactorySpi$ECMQV"); 1262 + // END android-removed 1263 1264 provider.addAlgorithm("KeyPairGenerator.EC", PREFIX + "KeyPairGeneratorSpi$EC"); 1265 - provider.addAlgorithm("KeyPairGenerator.ECDSA", PREFIX + "KeyPairGeneratorSpi$ECDSA"); 1266 - provider.addAlgorithm("KeyPairGenerator.ECDH", PREFIX + "KeyPairGeneratorSpi$ECDH"); 1267 - provider.addAlgorithm("KeyPairGenerator.ECDHC", PREFIX + "KeyPairGeneratorSpi$ECDHC"); 1268 - provider.addAlgorithm("KeyPairGenerator.ECIES", PREFIX + "KeyPairGeneratorSpi$ECDH"); 1269 - provider.addAlgorithm("KeyPairGenerator.ECMQV", PREFIX + "KeyPairGeneratorSpi$ECMQV"); 1270 - 1271 - provider.addAlgorithm("Cipher.ECIES", PREFIX + "IESCipher$ECIES"); 1272 - provider.addAlgorithm("Cipher.ECIESwithAES", PREFIX + "IESCipher$ECIESwithAES"); 1273 - provider.addAlgorithm("Cipher.ECIESWITHAES", PREFIX + "IESCipher$ECIESwithAES"); 1274 - provider.addAlgorithm("Cipher.ECIESwithDESEDE", PREFIX + "IESCipher$ECIESwithDESede"); 1275 - provider.addAlgorithm("Cipher.ECIESWITHDESEDE", PREFIX + "IESCipher$ECIESwithDESede"); 1276 + // BEGIN android-removed 1277 + // provider.addAlgorithm("KeyPairGenerator.ECDSA", PREFIX + "KeyPairGeneratorSpi$ECDSA"); 1278 + // provider.addAlgorithm("KeyPairGenerator.ECDH", PREFIX + "KeyPairGeneratorSpi$ECDH"); 1279 + // provider.addAlgorithm("KeyPairGenerator.ECDHC", PREFIX + "KeyPairGeneratorSpi$ECDHC"); 1280 + // provider.addAlgorithm("KeyPairGenerator.ECIES", PREFIX + "KeyPairGeneratorSpi$ECDH"); 1281 + // provider.addAlgorithm("KeyPairGenerator.ECMQV", PREFIX + "KeyPairGeneratorSpi$ECMQV"); 1282 + // 1283 + // provider.addAlgorithm("Cipher.ECIES", PREFIX + "IESCipher$ECIES"); 1284 + // provider.addAlgorithm("Cipher.ECIESwithAES", PREFIX + "IESCipher$ECIESwithAES"); 1285 + // provider.addAlgorithm("Cipher.ECIESWITHAES", PREFIX + "IESCipher$ECIESwithAES"); 1286 + // provider.addAlgorithm("Cipher.ECIESwithDESEDE", PREFIX + "IESCipher$ECIESwithDESede"); 1287 + // provider.addAlgorithm("Cipher.ECIESWITHDESEDE", PREFIX + "IESCipher$ECIESwithDESede"); 1288 + // END android-removed 1289 1290 provider.addAlgorithm("Signature.ECDSA", PREFIX + "SignatureSpi$ecDSA"); 1291 provider.addAlgorithm("Signature.NONEwithECDSA", PREFIX + "SignatureSpi$ecDSAnone"); 1292 @@ -65,25 +77,31 @@ 1293 provider.addAlgorithm("Alg.Alias.Signature.SHA1WithECDSA", "ECDSA"); 1294 provider.addAlgorithm("Alg.Alias.Signature.ECDSAWithSHA1", "ECDSA"); 1295 provider.addAlgorithm("Alg.Alias.Signature.1.2.840.10045.4.1", "ECDSA"); 1296 - provider.addAlgorithm("Alg.Alias.Signature." + TeleTrusTObjectIdentifiers.ecSignWithSha1, "ECDSA"); 1297 - 1298 - addSignatureAlgorithm(provider, "SHA224", "ECDSA", PREFIX + "SignatureSpi$ecDSA224", X9ObjectIdentifiers.ecdsa_with_SHA224); 1299 + // BEGIN android-removed 1300 + // provider.addAlgorithm("Alg.Alias.Signature." + TeleTrusTObjectIdentifiers.ecSignWithSha1, "ECDSA"); 1301 + // END android-removed 1302 + 1303 + // BEGIN android-removed 1304 + // addSignatureAlgorithm(provider, "SHA224", "ECDSA", PREFIX + "SignatureSpi$ecDSA224", X9ObjectIdentifiers.ecdsa_with_SHA224); 1305 + // END android-removed 1306 addSignatureAlgorithm(provider, "SHA256", "ECDSA", PREFIX + "SignatureSpi$ecDSA256", X9ObjectIdentifiers.ecdsa_with_SHA256); 1307 addSignatureAlgorithm(provider, "SHA384", "ECDSA", PREFIX + "SignatureSpi$ecDSA384", X9ObjectIdentifiers.ecdsa_with_SHA384); 1308 addSignatureAlgorithm(provider, "SHA512", "ECDSA", PREFIX + "SignatureSpi$ecDSA512", X9ObjectIdentifiers.ecdsa_with_SHA512); 1309 - addSignatureAlgorithm(provider, "RIPEMD160", "ECDSA", PREFIX + "SignatureSpi$ecDSARipeMD160",TeleTrusTObjectIdentifiers.ecSignWithRipemd160); 1310 - 1311 - provider.addAlgorithm("Signature.SHA1WITHECNR", PREFIX + "SignatureSpi$ecNR"); 1312 - provider.addAlgorithm("Signature.SHA224WITHECNR", PREFIX + "SignatureSpi$ecNR224"); 1313 - provider.addAlgorithm("Signature.SHA256WITHECNR", PREFIX + "SignatureSpi$ecNR256"); 1314 - provider.addAlgorithm("Signature.SHA384WITHECNR", PREFIX + "SignatureSpi$ecNR384"); 1315 - provider.addAlgorithm("Signature.SHA512WITHECNR", PREFIX + "SignatureSpi$ecNR512"); 1316 - 1317 - addSignatureAlgorithm(provider, "SHA1", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1); 1318 - addSignatureAlgorithm(provider, "SHA224", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA224", EACObjectIdentifiers.id_TA_ECDSA_SHA_224); 1319 - addSignatureAlgorithm(provider, "SHA256", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA256", EACObjectIdentifiers.id_TA_ECDSA_SHA_256); 1320 - addSignatureAlgorithm(provider, "SHA384", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA384", EACObjectIdentifiers.id_TA_ECDSA_SHA_384); 1321 - addSignatureAlgorithm(provider, "SHA512", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA512", EACObjectIdentifiers.id_TA_ECDSA_SHA_512); 1322 + // BEGIN android-removed 1323 + // addSignatureAlgorithm(provider, "RIPEMD160", "ECDSA", PREFIX + "SignatureSpi$ecDSARipeMD160",TeleTrusTObjectIdentifiers.ecSignWithRipemd160); 1324 + // 1325 + // provider.addAlgorithm("Signature.SHA1WITHECNR", PREFIX + "SignatureSpi$ecNR"); 1326 + // provider.addAlgorithm("Signature.SHA224WITHECNR", PREFIX + "SignatureSpi$ecNR224"); 1327 + // provider.addAlgorithm("Signature.SHA256WITHECNR", PREFIX + "SignatureSpi$ecNR256"); 1328 + // provider.addAlgorithm("Signature.SHA384WITHECNR", PREFIX + "SignatureSpi$ecNR384"); 1329 + // provider.addAlgorithm("Signature.SHA512WITHECNR", PREFIX + "SignatureSpi$ecNR512"); 1330 + // 1331 + // addSignatureAlgorithm(provider, "SHA1", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1); 1332 + // addSignatureAlgorithm(provider, "SHA224", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA224", EACObjectIdentifiers.id_TA_ECDSA_SHA_224); 1333 + // addSignatureAlgorithm(provider, "SHA256", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA256", EACObjectIdentifiers.id_TA_ECDSA_SHA_256); 1334 + // addSignatureAlgorithm(provider, "SHA384", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA384", EACObjectIdentifiers.id_TA_ECDSA_SHA_384); 1335 + // addSignatureAlgorithm(provider, "SHA512", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA512", EACObjectIdentifiers.id_TA_ECDSA_SHA_512); 1336 + // END android-removed 1337 } 1338 } 1339 } 1340 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/RSA.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/RSA.java 1341 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/RSA.java 2013-05-31 21:16:46.000000000 +0000 1342 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/RSA.java 2013-01-31 02:26:40.000000000 +0000 1343 @@ -3,7 +3,9 @@ 1344 import org.bouncycastle.asn1.ASN1ObjectIdentifier; 1345 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 1346 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 1347 -import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 1348 +// BEGIN android-removed 1349 +// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 1350 +// END android-removed 1351 import org.bouncycastle.asn1.x509.X509ObjectIdentifiers; 1352 import org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi; 1353 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 1354 @@ -24,41 +26,49 @@ 1355 public void configure(ConfigurableProvider provider) 1356 { 1357 provider.addAlgorithm("AlgorithmParameters.OAEP", PREFIX + "AlgorithmParametersSpi$OAEP"); 1358 - provider.addAlgorithm("AlgorithmParameters.PSS", PREFIX + "AlgorithmParametersSpi$PSS"); 1359 - 1360 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSAPSS", "PSS"); 1361 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSASSA-PSS", "PSS"); 1362 - 1363 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224withRSA/PSS", "PSS"); 1364 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256withRSA/PSS", "PSS"); 1365 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384withRSA/PSS", "PSS"); 1366 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512withRSA/PSS", "PSS"); 1367 - 1368 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224WITHRSAANDMGF1", "PSS"); 1369 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256WITHRSAANDMGF1", "PSS"); 1370 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384WITHRSAANDMGF1", "PSS"); 1371 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512WITHRSAANDMGF1", "PSS"); 1372 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RAWRSAPSS", "PSS"); 1373 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAPSS", "PSS"); 1374 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSASSA-PSS", "PSS"); 1375 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAANDMGF1", "PSS"); 1376 + // BEGIN android-removed 1377 + // provider.addAlgorithm("AlgorithmParameters.PSS", PREFIX + "AlgorithmParametersSpi$PSS"); 1378 + // 1379 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSAPSS", "PSS"); 1380 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSASSA-PSS", "PSS"); 1381 + // 1382 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224withRSA/PSS", "PSS"); 1383 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256withRSA/PSS", "PSS"); 1384 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384withRSA/PSS", "PSS"); 1385 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512withRSA/PSS", "PSS"); 1386 + // 1387 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224WITHRSAANDMGF1", "PSS"); 1388 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256WITHRSAANDMGF1", "PSS"); 1389 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384WITHRSAANDMGF1", "PSS"); 1390 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512WITHRSAANDMGF1", "PSS"); 1391 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RAWRSAPSS", "PSS"); 1392 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAPSS", "PSS"); 1393 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSASSA-PSS", "PSS"); 1394 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAANDMGF1", "PSS"); 1395 + // END android-removed 1396 1397 provider.addAlgorithm("Cipher.RSA", PREFIX + "CipherSpi$NoPadding"); 1398 - provider.addAlgorithm("Cipher.RSA/RAW", PREFIX + "CipherSpi$NoPadding"); 1399 - provider.addAlgorithm("Cipher.RSA/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding"); 1400 - provider.addAlgorithm("Cipher.1.2.840.113549.1.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding"); 1401 - provider.addAlgorithm("Cipher.2.5.8.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding"); 1402 - provider.addAlgorithm("Cipher.RSA/1", PREFIX + "CipherSpi$PKCS1v1_5Padding_PrivateOnly"); 1403 - provider.addAlgorithm("Cipher.RSA/2", PREFIX + "CipherSpi$PKCS1v1_5Padding_PublicOnly"); 1404 - provider.addAlgorithm("Cipher.RSA/OAEP", PREFIX + "CipherSpi$OAEPPadding"); 1405 - provider.addAlgorithm("Cipher." + PKCSObjectIdentifiers.id_RSAES_OAEP, PREFIX + "CipherSpi$OAEPPadding"); 1406 - provider.addAlgorithm("Cipher.RSA/ISO9796-1", PREFIX + "CipherSpi$ISO9796d1Padding"); 1407 + // BEGIN android-changed 1408 + provider.addAlgorithm("Alg.Alias.Cipher.RSA/RAW", "RSA"); 1409 + // END android-changed 1410 + // BEGIN android-removed 1411 + // provider.addAlgorithm("Cipher.RSA/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding"); 1412 + // provider.addAlgorithm("Cipher.1.2.840.113549.1.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding"); 1413 + // provider.addAlgorithm("Cipher.2.5.8.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding"); 1414 + // provider.addAlgorithm("Cipher.RSA/1", PREFIX + "CipherSpi$PKCS1v1_5Padding_PrivateOnly"); 1415 + // provider.addAlgorithm("Cipher.RSA/2", PREFIX + "CipherSpi$PKCS1v1_5Padding_PublicOnly"); 1416 + // provider.addAlgorithm("Cipher.RSA/OAEP", PREFIX + "CipherSpi$OAEPPadding"); 1417 + // provider.addAlgorithm("Cipher." + PKCSObjectIdentifiers.id_RSAES_OAEP, PREFIX + "CipherSpi$OAEPPadding"); 1418 + // provider.addAlgorithm("Cipher.RSA/ISO9796-1", PREFIX + "CipherSpi$ISO9796d1Padding"); 1419 + // END android-removed 1420 1421 provider.addAlgorithm("Alg.Alias.Cipher.RSA//RAW", "RSA"); 1422 provider.addAlgorithm("Alg.Alias.Cipher.RSA//NOPADDING", "RSA"); 1423 - provider.addAlgorithm("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1"); 1424 - provider.addAlgorithm("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP"); 1425 - provider.addAlgorithm("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1"); 1426 + // BEGIN android-removed 1427 + // provider.addAlgorithm("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1"); 1428 + // provider.addAlgorithm("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP"); 1429 + // provider.addAlgorithm("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1"); 1430 + // END android-removed 1431 1432 provider.addAlgorithm("KeyFactory.RSA", PREFIX + "KeyFactorySpi"); 1433 provider.addAlgorithm("KeyPairGenerator.RSA", PREFIX + "KeyPairGeneratorSpi"); 1434 @@ -68,101 +78,113 @@ 1435 registerOid(provider, PKCSObjectIdentifiers.rsaEncryption, "RSA", keyFact); 1436 registerOid(provider, X509ObjectIdentifiers.id_ea_rsa, "RSA", keyFact); 1437 registerOid(provider, PKCSObjectIdentifiers.id_RSAES_OAEP, "RSA", keyFact); 1438 - registerOid(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "RSA", keyFact); 1439 - 1440 - registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.rsaEncryption, "RSA"); 1441 - registerOidAlgorithmParameters(provider, X509ObjectIdentifiers.id_ea_rsa, "RSA"); 1442 - registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSAES_OAEP, "OAEP"); 1443 - registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "PSS"); 1444 - 1445 - 1446 - provider.addAlgorithm("Signature.RSASSA-PSS", PREFIX + "PSSSignatureSpi$PSSwithRSA"); 1447 - provider.addAlgorithm("Signature." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA"); 1448 - provider.addAlgorithm("Signature.OID." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA"); 1449 - 1450 - provider.addAlgorithm("Signature.SHA224withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA224withRSA"); 1451 - provider.addAlgorithm("Signature.SHA256withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA256withRSA"); 1452 - provider.addAlgorithm("Signature.SHA384withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA384withRSA"); 1453 - provider.addAlgorithm("Signature.SHA512withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA512withRSA"); 1454 - 1455 - provider.addAlgorithm("Signature.RSA", PREFIX + "DigestSignatureSpi$noneRSA"); 1456 - provider.addAlgorithm("Signature.RAWRSASSA-PSS", PREFIX + "PSSSignatureSpi$nonePSS"); 1457 - 1458 - provider.addAlgorithm("Alg.Alias.Signature.RAWRSA", "RSA"); 1459 - provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSA", "RSA"); 1460 - provider.addAlgorithm("Alg.Alias.Signature.RAWRSAPSS", "RAWRSASSA-PSS"); 1461 - provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAPSS", "RAWRSASSA-PSS"); 1462 - provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSASSA-PSS", "RAWRSASSA-PSS"); 1463 - provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAANDMGF1", "RAWRSASSA-PSS"); 1464 - provider.addAlgorithm("Alg.Alias.Signature.RSAPSS", "RSASSA-PSS"); 1465 - 1466 - 1467 - provider.addAlgorithm("Alg.Alias.Signature.SHA224withRSAandMGF1", "SHA224withRSA/PSS"); 1468 - provider.addAlgorithm("Alg.Alias.Signature.SHA256withRSAandMGF1", "SHA256withRSA/PSS"); 1469 - provider.addAlgorithm("Alg.Alias.Signature.SHA384withRSAandMGF1", "SHA384withRSA/PSS"); 1470 - provider.addAlgorithm("Alg.Alias.Signature.SHA512withRSAandMGF1", "SHA512withRSA/PSS"); 1471 - provider.addAlgorithm("Alg.Alias.Signature.SHA224WITHRSAANDMGF1", "SHA224withRSA/PSS"); 1472 - provider.addAlgorithm("Alg.Alias.Signature.SHA256WITHRSAANDMGF1", "SHA256withRSA/PSS"); 1473 - provider.addAlgorithm("Alg.Alias.Signature.SHA384WITHRSAANDMGF1", "SHA384withRSA/PSS"); 1474 - provider.addAlgorithm("Alg.Alias.Signature.SHA512WITHRSAANDMGF1", "SHA512withRSA/PSS"); 1475 - 1476 - if (provider.hasAlgorithm("MessageDigest", "MD2")) 1477 - { 1478 - addDigestSignature(provider, "MD2", PREFIX + "DigestSignatureSpi$MD2", PKCSObjectIdentifiers.md2WithRSAEncryption); 1479 - } 1480 - 1481 - if (provider.hasAlgorithm("MessageDigest", "MD4")) 1482 - { 1483 - addDigestSignature(provider, "MD4", PREFIX + "DigestSignatureSpi$MD4", PKCSObjectIdentifiers.md4WithRSAEncryption); 1484 - } 1485 + // BEGIN android-removed 1486 + // registerOid(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "RSA", keyFact); 1487 + // 1488 + // registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.rsaEncryption, "RSA"); 1489 + // registerOidAlgorithmParameters(provider, X509ObjectIdentifiers.id_ea_rsa, "RSA"); 1490 + // registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSAES_OAEP, "OAEP"); 1491 + // registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "PSS"); 1492 + // 1493 + // 1494 + // provider.addAlgorithm("Signature.RSASSA-PSS", PREFIX + "PSSSignatureSpi$PSSwithRSA"); 1495 + // provider.addAlgorithm("Signature." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA"); 1496 + // provider.addAlgorithm("Signature.OID." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA"); 1497 + // 1498 + // provider.addAlgorithm("Signature.SHA224withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA224withRSA"); 1499 + // provider.addAlgorithm("Signature.SHA256withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA256withRSA"); 1500 + // provider.addAlgorithm("Signature.SHA384withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA384withRSA"); 1501 + // provider.addAlgorithm("Signature.SHA512withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA512withRSA"); 1502 + // 1503 + // provider.addAlgorithm("Signature.RSA", PREFIX + "DigestSignatureSpi$noneRSA"); 1504 + // provider.addAlgorithm("Signature.RAWRSASSA-PSS", PREFIX + "PSSSignatureSpi$nonePSS"); 1505 + // 1506 + // provider.addAlgorithm("Alg.Alias.Signature.RAWRSA", "RSA"); 1507 + // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSA", "RSA"); 1508 + // provider.addAlgorithm("Alg.Alias.Signature.RAWRSAPSS", "RAWRSASSA-PSS"); 1509 + // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAPSS", "RAWRSASSA-PSS"); 1510 + // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSASSA-PSS", "RAWRSASSA-PSS"); 1511 + // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAANDMGF1", "RAWRSASSA-PSS"); 1512 + // provider.addAlgorithm("Alg.Alias.Signature.RSAPSS", "RSASSA-PSS"); 1513 + // 1514 + // 1515 + // provider.addAlgorithm("Alg.Alias.Signature.SHA224withRSAandMGF1", "SHA224withRSA/PSS"); 1516 + // provider.addAlgorithm("Alg.Alias.Signature.SHA256withRSAandMGF1", "SHA256withRSA/PSS"); 1517 + // provider.addAlgorithm("Alg.Alias.Signature.SHA384withRSAandMGF1", "SHA384withRSA/PSS"); 1518 + // provider.addAlgorithm("Alg.Alias.Signature.SHA512withRSAandMGF1", "SHA512withRSA/PSS"); 1519 + // provider.addAlgorithm("Alg.Alias.Signature.SHA224WITHRSAANDMGF1", "SHA224withRSA/PSS"); 1520 + // provider.addAlgorithm("Alg.Alias.Signature.SHA256WITHRSAANDMGF1", "SHA256withRSA/PSS"); 1521 + // provider.addAlgorithm("Alg.Alias.Signature.SHA384WITHRSAANDMGF1", "SHA384withRSA/PSS"); 1522 + // provider.addAlgorithm("Alg.Alias.Signature.SHA512WITHRSAANDMGF1", "SHA512withRSA/PSS"); 1523 + // 1524 + // if (provider.hasAlgorithm("MessageDigest", "MD2")) 1525 + // { 1526 + // addDigestSignature(provider, "MD2", PREFIX + "DigestSignatureSpi$MD2", PKCSObjectIdentifiers.md2WithRSAEncryption); 1527 + // } 1528 + // 1529 + // if (provider.hasAlgorithm("MessageDigest", "MD4")) 1530 + // { 1531 + // addDigestSignature(provider, "MD4", PREFIX + "DigestSignatureSpi$MD4", PKCSObjectIdentifiers.md4WithRSAEncryption); 1532 + // } 1533 + // END android-removed 1534 1535 if (provider.hasAlgorithm("MessageDigest", "MD5")) 1536 { 1537 addDigestSignature(provider, "MD5", PREFIX + "DigestSignatureSpi$MD5", PKCSObjectIdentifiers.md5WithRSAEncryption); 1538 - provider.addAlgorithm("Signature.MD5withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$MD5WithRSAEncryption"); 1539 - provider.addAlgorithm("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2"); 1540 + // BEGIN android-removed 1541 + // provider.addAlgorithm("Signature.MD5withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$MD5WithRSAEncryption"); 1542 + // provider.addAlgorithm("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2"); 1543 + // END android-removed 1544 } 1545 1546 if (provider.hasAlgorithm("MessageDigest", "SHA1")) 1547 { 1548 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1withRSA/PSS", "PSS"); 1549 - provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1WITHRSAANDMGF1", "PSS"); 1550 - provider.addAlgorithm("Signature.SHA1withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA1withRSA"); 1551 - provider.addAlgorithm("Alg.Alias.Signature.SHA1withRSAandMGF1", "SHA1withRSA/PSS"); 1552 - provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHRSAANDMGF1", "SHA1withRSA/PSS"); 1553 + // BEGIN android-removed 1554 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1withRSA/PSS", "PSS"); 1555 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1WITHRSAANDMGF1", "PSS"); 1556 + // provider.addAlgorithm("Signature.SHA1withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA1withRSA"); 1557 + // provider.addAlgorithm("Alg.Alias.Signature.SHA1withRSAandMGF1", "SHA1withRSA/PSS"); 1558 + // provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHRSAANDMGF1", "SHA1withRSA/PSS"); 1559 + // END android-removed 1560 1561 addDigestSignature(provider, "SHA1", PREFIX + "DigestSignatureSpi$SHA1", PKCSObjectIdentifiers.sha1WithRSAEncryption); 1562 1563 - provider.addAlgorithm("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2"); 1564 - provider.addAlgorithm("Signature.SHA1withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$SHA1WithRSAEncryption"); 1565 + // BEGIN android-removed 1566 + // provider.addAlgorithm("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2"); 1567 + // provider.addAlgorithm("Signature.SHA1withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$SHA1WithRSAEncryption"); 1568 + // END android-removed 1569 provider.addAlgorithm("Alg.Alias.Signature." + OIWObjectIdentifiers.sha1WithRSA, "SHA1WITHRSA"); 1570 provider.addAlgorithm("Alg.Alias.Signature.OID." + OIWObjectIdentifiers.sha1WithRSA, "SHA1WITHRSA"); 1571 } 1572 1573 - addDigestSignature(provider, "SHA224", PREFIX + "DigestSignatureSpi$SHA224", PKCSObjectIdentifiers.sha224WithRSAEncryption); 1574 + // BEGIN android-removed 1575 + // addDigestSignature(provider, "SHA224", PREFIX + "DigestSignatureSpi$SHA224", PKCSObjectIdentifiers.sha224WithRSAEncryption); 1576 + // END android-removed 1577 addDigestSignature(provider, "SHA256", PREFIX + "DigestSignatureSpi$SHA256", PKCSObjectIdentifiers.sha256WithRSAEncryption); 1578 addDigestSignature(provider, "SHA384", PREFIX + "DigestSignatureSpi$SHA384", PKCSObjectIdentifiers.sha384WithRSAEncryption); 1579 addDigestSignature(provider, "SHA512", PREFIX + "DigestSignatureSpi$SHA512", PKCSObjectIdentifiers.sha512WithRSAEncryption); 1580 1581 - if (provider.hasAlgorithm("MessageDigest", "RIPEMD128")) 1582 - { 1583 - addDigestSignature(provider, "RIPEMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 1584 - addDigestSignature(provider, "RMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", null); 1585 - } 1586 - 1587 - if (provider.hasAlgorithm("MessageDigest", "RIPEMD160")) 1588 - { 1589 - addDigestSignature(provider, "RIPEMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 1590 - addDigestSignature(provider, "RMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", null); 1591 - provider.addAlgorithm("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2"); 1592 - provider.addAlgorithm("Signature.RIPEMD160withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$RIPEMD160WithRSAEncryption"); 1593 - } 1594 - 1595 - if (provider.hasAlgorithm("MessageDigest", "RIPEMD256")) 1596 - { 1597 - addDigestSignature(provider, "RIPEMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 1598 - addDigestSignature(provider, "RMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", null); 1599 - } 1600 + // BEGIN android-removed 1601 + // if (provider.hasAlgorithm("MessageDigest", "RIPEMD128")) 1602 + // { 1603 + // addDigestSignature(provider, "RIPEMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 1604 + // addDigestSignature(provider, "RMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", null); 1605 + // } 1606 + // 1607 + // if (provider.hasAlgorithm("MessageDigest", "RIPEMD160")) 1608 + // { 1609 + // addDigestSignature(provider, "RIPEMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 1610 + // addDigestSignature(provider, "RMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", null); 1611 + // provider.addAlgorithm("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2"); 1612 + // provider.addAlgorithm("Signature.RIPEMD160withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$RIPEMD160WithRSAEncryption"); 1613 + // } 1614 + // 1615 + // if (provider.hasAlgorithm("MessageDigest", "RIPEMD256")) 1616 + // { 1617 + // addDigestSignature(provider, "RIPEMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 1618 + // addDigestSignature(provider, "RMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", null); 1619 + // } 1620 + // END android-removed 1621 } 1622 1623 private void addDigestSignature( 1624 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/X509.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/X509.java 1625 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/X509.java 2013-05-31 21:16:46.000000000 +0000 1626 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/X509.java 2012-09-17 23:04:47.000000000 +0000 1627 @@ -18,8 +18,10 @@ 1628 1629 public void configure(ConfigurableProvider provider) 1630 { 1631 - provider.addAlgorithm("KeyFactory.X.509", "org.bouncycastle.jcajce.provider.asymmetric.x509.KeyFactory"); 1632 - provider.addAlgorithm("Alg.Alias.KeyFactory.X509", "X.509"); 1633 + // BEGIN android-removed 1634 + // provider.addAlgorithm("KeyFactory.X.509", "org.bouncycastle.jcajce.provider.asymmetric.x509.KeyFactory"); 1635 + // provider.addAlgorithm("Alg.Alias.KeyFactory.X509", "X.509"); 1636 + // END android-removed 1637 1638 // 1639 // certificate factories. 1640 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java 1641 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java 2013-05-31 21:16:46.000000000 +0000 1642 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java 2013-05-25 02:14:15.000000000 +0000 1643 @@ -23,11 +23,16 @@ 1644 import org.bouncycastle.crypto.DSA; 1645 import org.bouncycastle.crypto.Digest; 1646 import org.bouncycastle.crypto.digests.NullDigest; 1647 -import org.bouncycastle.crypto.digests.SHA1Digest; 1648 -import org.bouncycastle.crypto.digests.SHA224Digest; 1649 -import org.bouncycastle.crypto.digests.SHA256Digest; 1650 -import org.bouncycastle.crypto.digests.SHA384Digest; 1651 -import org.bouncycastle.crypto.digests.SHA512Digest; 1652 +// BEGIN android-added 1653 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 1654 +// END android-added 1655 +// BEGIN android-removed 1656 +// import org.bouncycastle.crypto.digests.SHA1Digest; 1657 +// import org.bouncycastle.crypto.digests.SHA224Digest; 1658 +// import org.bouncycastle.crypto.digests.SHA256Digest; 1659 +// import org.bouncycastle.crypto.digests.SHA384Digest; 1660 +// import org.bouncycastle.crypto.digests.SHA512Digest; 1661 +// END android-removed 1662 import org.bouncycastle.crypto.params.ParametersWithRandom; 1663 1664 public class DSASigner 1665 @@ -216,45 +221,49 @@ 1666 { 1667 public stdDSA() 1668 { 1669 - super(new SHA1Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1670 + // BEGIN android-changed 1671 + super(AndroidDigestFactory.getSHA1(), new org.bouncycastle.crypto.signers.DSASigner()); 1672 + // END android-changed 1673 } 1674 } 1675 1676 - static public class dsa224 1677 - extends DSASigner 1678 - { 1679 - public dsa224() 1680 - { 1681 - super(new SHA224Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1682 - } 1683 - } 1684 - 1685 - static public class dsa256 1686 - extends DSASigner 1687 - { 1688 - public dsa256() 1689 - { 1690 - super(new SHA256Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1691 - } 1692 - } 1693 - 1694 - static public class dsa384 1695 - extends DSASigner 1696 - { 1697 - public dsa384() 1698 - { 1699 - super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1700 - } 1701 - } 1702 - 1703 - static public class dsa512 1704 - extends DSASigner 1705 - { 1706 - public dsa512() 1707 - { 1708 - super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1709 - } 1710 - } 1711 + // BEGIN android-removed 1712 + // static public class dsa224 1713 + // extends DSASigner 1714 + // { 1715 + // public dsa224() 1716 + // { 1717 + // super(new SHA224Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1718 + // } 1719 + // } 1720 + // 1721 + // static public class dsa256 1722 + // extends DSASigner 1723 + // { 1724 + // public dsa256() 1725 + // { 1726 + // super(new SHA256Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1727 + // } 1728 + // } 1729 + // 1730 + // static public class dsa384 1731 + // extends DSASigner 1732 + // { 1733 + // public dsa384() 1734 + // { 1735 + // super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1736 + // } 1737 + // } 1738 + // 1739 + // static public class dsa512 1740 + // extends DSASigner 1741 + // { 1742 + // public dsa512() 1743 + // { 1744 + // super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner()); 1745 + // } 1746 + // } 1747 + // END android-removed 1748 1749 static public class noneDSA 1750 extends DSASigner 1751 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java 1752 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java 2013-05-31 21:16:46.000000000 +0000 1753 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java 2013-05-25 02:14:15.000000000 +0000 1754 @@ -19,8 +19,10 @@ 1755 import org.bouncycastle.asn1.DERInteger; 1756 import org.bouncycastle.asn1.DERNull; 1757 import org.bouncycastle.asn1.DERObjectIdentifier; 1758 -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 1759 -import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 1760 +// BEGIN android-removed 1761 +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 1762 +// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 1763 +// END android-removed 1764 import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 1765 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 1766 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 1767 @@ -224,21 +226,23 @@ 1768 ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(params.getParameters()); 1769 X9ECParameters ecP = ECUtil.getNamedCurveByOid(oid); 1770 1771 - if (ecP == null) // GOST Curve 1772 - { 1773 - ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); 1774 - EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); 1775 - 1776 - ecSpec = new ECNamedCurveSpec( 1777 - ECGOST3410NamedCurves.getName(oid), 1778 - ellipticCurve, 1779 - new ECPoint( 1780 - gParam.getG().getX().toBigInteger(), 1781 - gParam.getG().getY().toBigInteger()), 1782 - gParam.getN(), 1783 - gParam.getH()); 1784 - } 1785 - else 1786 + // BEGIN android-removed 1787 + // if (ecP == null) // GOST Curve 1788 + // { 1789 + // ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); 1790 + // EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); 1791 + // 1792 + // ecSpec = new ECNamedCurveSpec( 1793 + // ECGOST3410NamedCurves.getName(oid), 1794 + // ellipticCurve, 1795 + // new ECPoint( 1796 + // gParam.getG().getX().toBigInteger(), 1797 + // gParam.getG().getY().toBigInteger()), 1798 + // gParam.getN(), 1799 + // gParam.getH()); 1800 + // } 1801 + // else 1802 + // END android-removed 1803 { 1804 EllipticCurve ellipticCurve = EC5Util.convertCurve(ecP.getCurve(), ecP.getSeed()); 1805 1806 @@ -352,11 +356,13 @@ 1807 1808 try 1809 { 1810 - if (algorithm.equals("ECGOST3410")) 1811 - { 1812 - info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.toASN1Primitive()), keyStructure.toASN1Primitive()); 1813 - } 1814 - else 1815 + // BEGIN android-removed 1816 + // if (algorithm.equals("ECGOST3410")) 1817 + // { 1818 + // info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.toASN1Primitive()), keyStructure.toASN1Primitive()); 1819 + // } 1820 + // else 1821 + // END android-removed 1822 { 1823 1824 info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.toASN1Primitive()), keyStructure.toASN1Primitive()); 1825 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java 1826 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java 2013-05-31 21:16:46.000000000 +0000 1827 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java 2013-05-25 02:14:15.000000000 +0000 1828 @@ -23,21 +23,27 @@ 1829 import org.bouncycastle.crypto.CipherParameters; 1830 import org.bouncycastle.crypto.DerivationFunction; 1831 import org.bouncycastle.crypto.agreement.ECDHBasicAgreement; 1832 -import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement; 1833 -import org.bouncycastle.crypto.agreement.ECMQVBasicAgreement; 1834 -import org.bouncycastle.crypto.agreement.kdf.DHKDFParameters; 1835 -import org.bouncycastle.crypto.agreement.kdf.ECDHKEKGenerator; 1836 +// BEGIN android-removed 1837 +// import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement; 1838 +// import org.bouncycastle.crypto.agreement.ECMQVBasicAgreement; 1839 +// import org.bouncycastle.crypto.agreement.kdf.DHKDFParameters; 1840 +// import org.bouncycastle.crypto.agreement.kdf.ECDHKEKGenerator; 1841 +// END android-removed 1842 import org.bouncycastle.crypto.digests.SHA1Digest; 1843 import org.bouncycastle.crypto.params.ECDomainParameters; 1844 import org.bouncycastle.crypto.params.ECPrivateKeyParameters; 1845 import org.bouncycastle.crypto.params.ECPublicKeyParameters; 1846 -import org.bouncycastle.crypto.params.MQVPrivateParameters; 1847 -import org.bouncycastle.crypto.params.MQVPublicParameters; 1848 +// BEGIN android-removed 1849 +// import org.bouncycastle.crypto.params.MQVPrivateParameters; 1850 +// import org.bouncycastle.crypto.params.MQVPublicParameters; 1851 +// END android-removed 1852 import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; 1853 import org.bouncycastle.jce.interfaces.ECPrivateKey; 1854 import org.bouncycastle.jce.interfaces.ECPublicKey; 1855 -import org.bouncycastle.jce.interfaces.MQVPrivateKey; 1856 -import org.bouncycastle.jce.interfaces.MQVPublicKey; 1857 +// BEGIN android-removed 1858 +// import org.bouncycastle.jce.interfaces.MQVPrivateKey; 1859 +// import org.bouncycastle.jce.interfaces.MQVPublicKey; 1860 +// END android-removed 1861 import org.bouncycastle.util.Integers; 1862 1863 /** 1864 @@ -71,7 +77,9 @@ 1865 private BigInteger result; 1866 private ECDomainParameters parameters; 1867 private BasicAgreement agreement; 1868 - private DerivationFunction kdf; 1869 + // BEGIN android-removed 1870 + // private DerivationFunction kdf; 1871 + // END android-removed 1872 1873 private byte[] bigIntToBytes( 1874 BigInteger r) 1875 @@ -86,7 +94,9 @@ 1876 { 1877 this.kaAlgorithm = kaAlgorithm; 1878 this.agreement = agreement; 1879 - this.kdf = kdf; 1880 + // BEGIN android-removed 1881 + // this.kdf = kdf; 1882 + // END android-removed 1883 } 1884 1885 protected Key engineDoPhase( 1886 @@ -105,25 +115,27 @@ 1887 } 1888 1889 CipherParameters pubKey; 1890 - if (agreement instanceof ECMQVBasicAgreement) 1891 - { 1892 - if (!(key instanceof MQVPublicKey)) 1893 - { 1894 - throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 1895 - + getSimpleName(MQVPublicKey.class) + " for doPhase"); 1896 - } 1897 - 1898 - MQVPublicKey mqvPubKey = (MQVPublicKey)key; 1899 - ECPublicKeyParameters staticKey = (ECPublicKeyParameters) 1900 - ECUtil.generatePublicKeyParameter(mqvPubKey.getStaticKey()); 1901 - ECPublicKeyParameters ephemKey = (ECPublicKeyParameters) 1902 - ECUtil.generatePublicKeyParameter(mqvPubKey.getEphemeralKey()); 1903 - 1904 - pubKey = new MQVPublicParameters(staticKey, ephemKey); 1905 - 1906 - // TODO Validate that all the keys are using the same parameters? 1907 - } 1908 - else 1909 + // BEGIN android-removed 1910 + // if (agreement instanceof ECMQVBasicAgreement) 1911 + // { 1912 + // if (!(key instanceof MQVPublicKey)) 1913 + // { 1914 + // throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 1915 + // + getSimpleName(MQVPublicKey.class) + " for doPhase"); 1916 + // } 1917 + // 1918 + // MQVPublicKey mqvPubKey = (MQVPublicKey)key; 1919 + // ECPublicKeyParameters staticKey = (ECPublicKeyParameters) 1920 + // ECUtil.generatePublicKeyParameter(mqvPubKey.getStaticKey()); 1921 + // ECPublicKeyParameters ephemKey = (ECPublicKeyParameters) 1922 + // ECUtil.generatePublicKeyParameter(mqvPubKey.getEphemeralKey()); 1923 + // 1924 + // pubKey = new MQVPublicParameters(staticKey, ephemKey); 1925 + // 1926 + // // TODO Validate that all the keys are using the same parameters? 1927 + // } 1928 + // else 1929 + // END android-removed 1930 { 1931 if (!(key instanceof PublicKey)) 1932 { 1933 @@ -144,11 +156,13 @@ 1934 protected byte[] engineGenerateSecret() 1935 throws IllegalStateException 1936 { 1937 - if (kdf != null) 1938 - { 1939 - throw new UnsupportedOperationException( 1940 - "KDF can only be used when algorithm is known"); 1941 - } 1942 + // BEGIN android-removed 1943 + // if (kdf != null) 1944 + // { 1945 + // throw new UnsupportedOperationException( 1946 + // "KDF can only be used when algorithm is known"); 1947 + // } 1948 + // END android-removed 1949 1950 return bigIntToBytes(result); 1951 } 1952 @@ -176,23 +190,25 @@ 1953 { 1954 byte[] secret = bigIntToBytes(result); 1955 1956 - if (kdf != null) 1957 - { 1958 - if (!algorithms.containsKey(algorithm)) 1959 - { 1960 - throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm); 1961 - } 1962 - 1963 - int keySize = ((Integer)algorithms.get(algorithm)).intValue(); 1964 - 1965 - DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, secret); 1966 - 1967 - byte[] keyBytes = new byte[keySize / 8]; 1968 - kdf.init(params); 1969 - kdf.generateBytes(keyBytes, 0, keyBytes.length); 1970 - secret = keyBytes; 1971 - } 1972 - else 1973 + // BEGIN android-removed 1974 + // if (kdf != null) 1975 + // { 1976 + // if (!algorithms.containsKey(algorithm)) 1977 + // { 1978 + // throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm); 1979 + // } 1980 + // 1981 + // int keySize = ((Integer)algorithms.get(algorithm)).intValue(); 1982 + // 1983 + // DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, secret); 1984 + // 1985 + // byte[] keyBytes = new byte[keySize / 8]; 1986 + // kdf.init(params); 1987 + // kdf.generateBytes(keyBytes, 0, keyBytes.length); 1988 + // secret = keyBytes; 1989 + // } 1990 + // else 1991 + // END android-removed 1992 { 1993 // TODO Should we be ensuring the key is the right length? 1994 } 1995 @@ -206,6 +222,12 @@ 1996 SecureRandom random) 1997 throws InvalidKeyException, InvalidAlgorithmParameterException 1998 { 1999 + // BEGIN android-added 2000 + if (params != null) 2001 + { 2002 + throw new InvalidAlgorithmParameterException("No algorithm parameters supported"); 2003 + } 2004 + // END android-added 2005 initFromKey(key); 2006 } 2007 2008 @@ -220,35 +242,37 @@ 2009 private void initFromKey(Key key) 2010 throws InvalidKeyException 2011 { 2012 - if (agreement instanceof ECMQVBasicAgreement) 2013 - { 2014 - if (!(key instanceof MQVPrivateKey)) 2015 - { 2016 - throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 2017 - + getSimpleName(MQVPrivateKey.class) + " for initialisation"); 2018 - } 2019 - 2020 - MQVPrivateKey mqvPrivKey = (MQVPrivateKey)key; 2021 - ECPrivateKeyParameters staticPrivKey = (ECPrivateKeyParameters) 2022 - ECUtil.generatePrivateKeyParameter(mqvPrivKey.getStaticPrivateKey()); 2023 - ECPrivateKeyParameters ephemPrivKey = (ECPrivateKeyParameters) 2024 - ECUtil.generatePrivateKeyParameter(mqvPrivKey.getEphemeralPrivateKey()); 2025 - 2026 - ECPublicKeyParameters ephemPubKey = null; 2027 - if (mqvPrivKey.getEphemeralPublicKey() != null) 2028 - { 2029 - ephemPubKey = (ECPublicKeyParameters) 2030 - ECUtil.generatePublicKeyParameter(mqvPrivKey.getEphemeralPublicKey()); 2031 - } 2032 - 2033 - MQVPrivateParameters localParams = new MQVPrivateParameters(staticPrivKey, ephemPrivKey, ephemPubKey); 2034 - this.parameters = staticPrivKey.getParameters(); 2035 - 2036 - // TODO Validate that all the keys are using the same parameters? 2037 - 2038 - agreement.init(localParams); 2039 - } 2040 - else 2041 + // BEGIN android-removed 2042 + // if (agreement instanceof ECMQVBasicAgreement) 2043 + // { 2044 + // if (!(key instanceof MQVPrivateKey)) 2045 + // { 2046 + // throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 2047 + // + getSimpleName(MQVPrivateKey.class) + " for initialisation"); 2048 + // } 2049 + // 2050 + // MQVPrivateKey mqvPrivKey = (MQVPrivateKey)key; 2051 + // ECPrivateKeyParameters staticPrivKey = (ECPrivateKeyParameters) 2052 + // ECUtil.generatePrivateKeyParameter(mqvPrivKey.getStaticPrivateKey()); 2053 + // ECPrivateKeyParameters ephemPrivKey = (ECPrivateKeyParameters) 2054 + // ECUtil.generatePrivateKeyParameter(mqvPrivKey.getEphemeralPrivateKey()); 2055 + // 2056 + // ECPublicKeyParameters ephemPubKey = null; 2057 + // if (mqvPrivKey.getEphemeralPublicKey() != null) 2058 + // { 2059 + // ephemPubKey = (ECPublicKeyParameters) 2060 + // ECUtil.generatePublicKeyParameter(mqvPrivKey.getEphemeralPublicKey()); 2061 + // } 2062 + // 2063 + // MQVPrivateParameters localParams = new MQVPrivateParameters(staticPrivKey, ephemPrivKey, ephemPubKey); 2064 + // this.parameters = staticPrivKey.getParameters(); 2065 + // 2066 + // // TODO Validate that all the keys are using the same parameters? 2067 + // 2068 + // agreement.init(localParams); 2069 + // } 2070 + // else 2071 + // END android-removed 2072 { 2073 if (!(key instanceof PrivateKey)) 2074 { 2075 @@ -279,39 +303,41 @@ 2076 } 2077 } 2078 2079 - public static class DHC 2080 - extends KeyAgreementSpi 2081 - { 2082 - public DHC() 2083 - { 2084 - super("ECDHC", new ECDHCBasicAgreement(), null); 2085 - } 2086 - } 2087 - 2088 - public static class MQV 2089 - extends KeyAgreementSpi 2090 - { 2091 - public MQV() 2092 - { 2093 - super("ECMQV", new ECMQVBasicAgreement(), null); 2094 - } 2095 - } 2096 - 2097 - public static class DHwithSHA1KDF 2098 - extends KeyAgreementSpi 2099 - { 2100 - public DHwithSHA1KDF() 2101 - { 2102 - super("ECDHwithSHA1KDF", new ECDHBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 2103 - } 2104 - } 2105 - 2106 - public static class MQVwithSHA1KDF 2107 - extends KeyAgreementSpi 2108 - { 2109 - public MQVwithSHA1KDF() 2110 - { 2111 - super("ECMQVwithSHA1KDF", new ECMQVBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 2112 - } 2113 - } 2114 + // BEGIN android-removed 2115 + // public static class DHC 2116 + // extends KeyAgreementSpi 2117 + // { 2118 + // public DHC() 2119 + // { 2120 + // super("ECDHC", new ECDHCBasicAgreement(), null); 2121 + // } 2122 + // } 2123 + // 2124 + // public static class MQV 2125 + // extends KeyAgreementSpi 2126 + // { 2127 + // public MQV() 2128 + // { 2129 + // super("ECMQV", new ECMQVBasicAgreement(), null); 2130 + // } 2131 + // } 2132 + // 2133 + // public static class DHwithSHA1KDF 2134 + // extends KeyAgreementSpi 2135 + // { 2136 + // public DHwithSHA1KDF() 2137 + // { 2138 + // super("ECDHwithSHA1KDF", new ECDHBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 2139 + // } 2140 + // } 2141 + // 2142 + // public static class MQVwithSHA1KDF 2143 + // extends KeyAgreementSpi 2144 + // { 2145 + // public MQVwithSHA1KDF() 2146 + // { 2147 + // super("ECMQVwithSHA1KDF", new ECMQVBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 2148 + // } 2149 + // } 2150 + // END android-removed 2151 } 2152 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java 2153 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java 2013-05-31 21:16:46.000000000 +0000 2154 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java 2013-05-25 02:14:15.000000000 +0000 2155 @@ -201,14 +201,16 @@ 2156 } 2157 } 2158 2159 - public static class ECGOST3410 2160 - extends KeyFactorySpi 2161 - { 2162 - public ECGOST3410() 2163 - { 2164 - super("ECGOST3410", BouncyCastleProvider.CONFIGURATION); 2165 - } 2166 - } 2167 + // BEGIN android-removed 2168 + // public static class ECGOST3410 2169 + // extends KeyFactorySpi 2170 + // { 2171 + // public ECGOST3410() 2172 + // { 2173 + // super("ECGOST3410", BouncyCastleProvider.CONFIGURATION); 2174 + // } 2175 + // } 2176 + // END android-removed 2177 2178 public static class ECDH 2179 extends KeyFactorySpi 2180 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java 2181 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java 2013-05-31 21:16:46.000000000 +0000 2182 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java 2013-05-25 02:14:15.000000000 +0000 2183 @@ -12,7 +12,9 @@ 2184 import org.bouncycastle.asn1.ASN1ObjectIdentifier; 2185 import org.bouncycastle.asn1.nist.NISTNamedCurves; 2186 import org.bouncycastle.asn1.sec.SECNamedCurves; 2187 -import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 2188 +// BEGIN android-removed 2189 +// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 2190 +// END android-removed 2191 import org.bouncycastle.asn1.x9.X962NamedCurves; 2192 import org.bouncycastle.asn1.x9.X9ECParameters; 2193 import org.bouncycastle.crypto.AsymmetricCipherKeyPair; 2194 @@ -87,7 +89,13 @@ 2195 SecureRandom random) 2196 { 2197 this.strength = strength; 2198 + // BEGIN android-added 2199 + if (random != null) { 2200 + // END android-added 2201 this.random = random; 2202 + // BEGIN android-added 2203 + } 2204 + // END android-added 2205 ECGenParameterSpec ecParams = (ECGenParameterSpec)ecParameters.get(Integers.valueOf(strength)); 2206 2207 if (ecParams != null) 2208 @@ -112,6 +120,11 @@ 2209 SecureRandom random) 2210 throws InvalidAlgorithmParameterException 2211 { 2212 + // BEGIN android-added 2213 + if (random == null) { 2214 + random = this.random; 2215 + } 2216 + // END android-added 2217 if (params instanceof ECParameterSpec) 2218 { 2219 ECParameterSpec p = (ECParameterSpec)params; 2220 @@ -156,10 +169,12 @@ 2221 { 2222 ecP = NISTNamedCurves.getByName(curveName); 2223 } 2224 - if (ecP == null) 2225 - { 2226 - ecP = TeleTrusTNamedCurves.getByName(curveName); 2227 - } 2228 + // BEGIN android-removed 2229 + // if (ecP == null) 2230 + // { 2231 + // ecP = TeleTrusTNamedCurves.getByName(curveName); 2232 + // } 2233 + // END android-removed 2234 if (ecP == null) 2235 { 2236 // See if it's actually an OID string (SunJSSE ServerHandshaker setupEphemeralECDHKeys bug) 2237 @@ -175,10 +190,12 @@ 2238 { 2239 ecP = NISTNamedCurves.getByOID(oid); 2240 } 2241 - if (ecP == null) 2242 - { 2243 - ecP = TeleTrusTNamedCurves.getByOID(oid); 2244 - } 2245 + // BEGIN android-removed 2246 + // if (ecP == null) 2247 + // { 2248 + // ecP = TeleTrusTNamedCurves.getByOID(oid); 2249 + // } 2250 + // END android-removed 2251 if (ecP == null) 2252 { 2253 throw new InvalidAlgorithmParameterException("unknown curve OID: " + curveName); 2254 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java 2255 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java 2013-05-31 21:16:46.000000000 +0000 2256 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java 2013-05-25 02:14:15.000000000 +0000 2257 @@ -16,15 +16,22 @@ 2258 import org.bouncycastle.crypto.DSA; 2259 import org.bouncycastle.crypto.Digest; 2260 import org.bouncycastle.crypto.digests.NullDigest; 2261 -import org.bouncycastle.crypto.digests.RIPEMD160Digest; 2262 -import org.bouncycastle.crypto.digests.SHA1Digest; 2263 -import org.bouncycastle.crypto.digests.SHA224Digest; 2264 -import org.bouncycastle.crypto.digests.SHA256Digest; 2265 -import org.bouncycastle.crypto.digests.SHA384Digest; 2266 -import org.bouncycastle.crypto.digests.SHA512Digest; 2267 +// BEGIN android-added 2268 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 2269 +// END android-added 2270 +// BEGIN android-removed 2271 +// import org.bouncycastle.crypto.digests.RIPEMD160Digest; 2272 +// import org.bouncycastle.crypto.digests.SHA1Digest; 2273 +// import org.bouncycastle.crypto.digests.SHA224Digest; 2274 +// import org.bouncycastle.crypto.digests.SHA256Digest; 2275 +// import org.bouncycastle.crypto.digests.SHA384Digest; 2276 +// import org.bouncycastle.crypto.digests.SHA512Digest; 2277 +// END android-removed 2278 import org.bouncycastle.crypto.params.ParametersWithRandom; 2279 import org.bouncycastle.crypto.signers.ECDSASigner; 2280 -import org.bouncycastle.crypto.signers.ECNRSigner; 2281 +// BEGIN android-removed 2282 +// import org.bouncycastle.crypto.signers.ECNRSigner; 2283 +// END android-removed 2284 import org.bouncycastle.jcajce.provider.asymmetric.util.DSABase; 2285 import org.bouncycastle.jcajce.provider.asymmetric.util.DSAEncoder; 2286 import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; 2287 @@ -69,7 +76,9 @@ 2288 { 2289 public ecDSA() 2290 { 2291 - super(new SHA1Digest(), new ECDSASigner(), new StdDSAEncoder()); 2292 + // BEGIN android-changed 2293 + super(AndroidDigestFactory.getSHA1(), new ECDSASigner(), new StdDSAEncoder()); 2294 + // END android-changed 2295 } 2296 } 2297 2298 @@ -82,21 +91,25 @@ 2299 } 2300 } 2301 2302 - static public class ecDSA224 2303 - extends SignatureSpi 2304 - { 2305 - public ecDSA224() 2306 - { 2307 - super(new SHA224Digest(), new ECDSASigner(), new StdDSAEncoder()); 2308 - } 2309 - } 2310 + // BEGIN android-removed 2311 + // static public class ecDSA224 2312 + // extends SignatureSpi 2313 + // { 2314 + // public ecDSA224() 2315 + // { 2316 + // super(new SHA224Digest(), new ECDSASigner(), new StdDSAEncoder()); 2317 + // } 2318 + // } 2319 + // END android-removed 2320 2321 static public class ecDSA256 2322 extends SignatureSpi 2323 { 2324 public ecDSA256() 2325 { 2326 - super(new SHA256Digest(), new ECDSASigner(), new StdDSAEncoder()); 2327 + // BEGIN android-changed 2328 + super(AndroidDigestFactory.getSHA256(), new ECDSASigner(), new StdDSAEncoder()); 2329 + // END android-changed 2330 } 2331 } 2332 2333 @@ -105,7 +118,9 @@ 2334 { 2335 public ecDSA384() 2336 { 2337 - super(new SHA384Digest(), new ECDSASigner(), new StdDSAEncoder()); 2338 + // BEGIN android-changed 2339 + super(AndroidDigestFactory.getSHA384(), new ECDSASigner(), new StdDSAEncoder()); 2340 + // END android-changed 2341 } 2342 } 2343 2344 @@ -114,108 +129,112 @@ 2345 { 2346 public ecDSA512() 2347 { 2348 - super(new SHA512Digest(), new ECDSASigner(), new StdDSAEncoder()); 2349 - } 2350 - } 2351 - 2352 - static public class ecDSARipeMD160 2353 - extends SignatureSpi 2354 - { 2355 - public ecDSARipeMD160() 2356 - { 2357 - super(new RIPEMD160Digest(), new ECDSASigner(), new StdDSAEncoder()); 2358 - } 2359 - } 2360 - 2361 - static public class ecNR 2362 - extends SignatureSpi 2363 - { 2364 - public ecNR() 2365 - { 2366 - super(new SHA1Digest(), new ECNRSigner(), new StdDSAEncoder()); 2367 - } 2368 - } 2369 - 2370 - static public class ecNR224 2371 - extends SignatureSpi 2372 - { 2373 - public ecNR224() 2374 - { 2375 - super(new SHA224Digest(), new ECNRSigner(), new StdDSAEncoder()); 2376 - } 2377 - } 2378 - 2379 - static public class ecNR256 2380 - extends SignatureSpi 2381 - { 2382 - public ecNR256() 2383 - { 2384 - super(new SHA256Digest(), new ECNRSigner(), new StdDSAEncoder()); 2385 - } 2386 - } 2387 - 2388 - static public class ecNR384 2389 - extends SignatureSpi 2390 - { 2391 - public ecNR384() 2392 - { 2393 - super(new SHA384Digest(), new ECNRSigner(), new StdDSAEncoder()); 2394 - } 2395 - } 2396 - 2397 - static public class ecNR512 2398 - extends SignatureSpi 2399 - { 2400 - public ecNR512() 2401 - { 2402 - super(new SHA512Digest(), new ECNRSigner(), new StdDSAEncoder()); 2403 - } 2404 - } 2405 - 2406 - static public class ecCVCDSA 2407 - extends SignatureSpi 2408 - { 2409 - public ecCVCDSA() 2410 - { 2411 - super(new SHA1Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2412 - } 2413 - } 2414 - 2415 - static public class ecCVCDSA224 2416 - extends SignatureSpi 2417 - { 2418 - public ecCVCDSA224() 2419 - { 2420 - super(new SHA224Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2421 - } 2422 - } 2423 - 2424 - static public class ecCVCDSA256 2425 - extends SignatureSpi 2426 - { 2427 - public ecCVCDSA256() 2428 - { 2429 - super(new SHA256Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2430 - } 2431 - } 2432 - 2433 - static public class ecCVCDSA384 2434 - extends SignatureSpi 2435 - { 2436 - public ecCVCDSA384() 2437 - { 2438 - super(new SHA384Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2439 - } 2440 - } 2441 - 2442 - static public class ecCVCDSA512 2443 - extends SignatureSpi 2444 - { 2445 - public ecCVCDSA512() 2446 - { 2447 - super(new SHA512Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2448 - } 2449 - } 2450 + // BEGIN android-changed 2451 + super(AndroidDigestFactory.getSHA512(), new ECDSASigner(), new StdDSAEncoder()); 2452 + // END android-changed 2453 + } 2454 + } 2455 + 2456 + // BEGIN android-removed 2457 + // static public class ecDSARipeMD160 2458 + // extends SignatureSpi 2459 + // { 2460 + // public ecDSARipeMD160() 2461 + // { 2462 + // super(new RIPEMD160Digest(), new ECDSASigner(), new StdDSAEncoder()); 2463 + // } 2464 + // } 2465 + // 2466 + // static public class ecNR 2467 + // extends SignatureSpi 2468 + // { 2469 + // public ecNR() 2470 + // { 2471 + // super(new SHA1Digest(), new ECNRSigner(), new StdDSAEncoder()); 2472 + // } 2473 + // } 2474 + // 2475 + // static public class ecNR224 2476 + // extends SignatureSpi 2477 + // { 2478 + // public ecNR224() 2479 + // { 2480 + // super(new SHA224Digest(), new ECNRSigner(), new StdDSAEncoder()); 2481 + // } 2482 + // } 2483 + // 2484 + // static public class ecNR256 2485 + // extends SignatureSpi 2486 + // { 2487 + // public ecNR256() 2488 + // { 2489 + // super(new SHA256Digest(), new ECNRSigner(), new StdDSAEncoder()); 2490 + // } 2491 + // } 2492 + // 2493 + // static public class ecNR384 2494 + // extends SignatureSpi 2495 + // { 2496 + // public ecNR384() 2497 + // { 2498 + // super(new SHA384Digest(), new ECNRSigner(), new StdDSAEncoder()); 2499 + // } 2500 + // } 2501 + // 2502 + // static public class ecNR512 2503 + // extends SignatureSpi 2504 + // { 2505 + // public ecNR512() 2506 + // { 2507 + // super(new SHA512Digest(), new ECNRSigner(), new StdDSAEncoder()); 2508 + // } 2509 + // } 2510 + // 2511 + // static public class ecCVCDSA 2512 + // extends SignatureSpi 2513 + // { 2514 + // public ecCVCDSA() 2515 + // { 2516 + // super(new SHA1Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2517 + // } 2518 + // } 2519 + // 2520 + // static public class ecCVCDSA224 2521 + // extends SignatureSpi 2522 + // { 2523 + // public ecCVCDSA224() 2524 + // { 2525 + // super(new SHA224Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2526 + // } 2527 + // } 2528 + // 2529 + // static public class ecCVCDSA256 2530 + // extends SignatureSpi 2531 + // { 2532 + // public ecCVCDSA256() 2533 + // { 2534 + // super(new SHA256Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2535 + // } 2536 + // } 2537 + // 2538 + // static public class ecCVCDSA384 2539 + // extends SignatureSpi 2540 + // { 2541 + // public ecCVCDSA384() 2542 + // { 2543 + // super(new SHA384Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2544 + // } 2545 + // } 2546 + // 2547 + // static public class ecCVCDSA512 2548 + // extends SignatureSpi 2549 + // { 2550 + // public ecCVCDSA512() 2551 + // { 2552 + // super(new SHA512Digest(), new ECDSASigner(), new CVCDSAEncoder()); 2553 + // } 2554 + // } 2555 + // END android-removed 2556 2557 private static class StdDSAEncoder 2558 implements DSAEncoder 2559 @@ -309,4 +328,4 @@ 2560 return sig; 2561 } 2562 } 2563 -} 2564 \ No newline at end of file 2565 +} 2566 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java 2567 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java 2013-05-31 21:16:46.000000000 +0000 2568 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java 2013-01-31 02:26:40.000000000 +0000 2569 @@ -26,7 +26,9 @@ 2570 import org.bouncycastle.crypto.CipherParameters; 2571 import org.bouncycastle.crypto.Digest; 2572 import org.bouncycastle.crypto.InvalidCipherTextException; 2573 -import org.bouncycastle.crypto.encodings.ISO9796d1Encoding; 2574 +// BEGIN android-removed 2575 +// import org.bouncycastle.crypto.encodings.ISO9796d1Encoding; 2576 +// END android-removed 2577 import org.bouncycastle.crypto.encodings.OAEPEncoding; 2578 import org.bouncycastle.crypto.encodings.PKCS1Encoding; 2579 import org.bouncycastle.crypto.engines.RSABlindedEngine; 2580 @@ -197,10 +199,12 @@ 2581 { 2582 cipher = new PKCS1Encoding(new RSABlindedEngine()); 2583 } 2584 - else if (pad.equals("ISO9796-1PADDING")) 2585 - { 2586 - cipher = new ISO9796d1Encoding(new RSABlindedEngine()); 2587 - } 2588 + // BEGIN android-removed 2589 + // else if (pad.equals("ISO9796-1PADDING")) 2590 + // { 2591 + // cipher = new ISO9796d1Encoding(new RSABlindedEngine()); 2592 + // } 2593 + // END android-removed 2594 else if (pad.equals("OAEPWITHMD5ANDMGF1PADDING")) 2595 { 2596 initFromSpec(new OAEPParameterSpec("MD5", "MGF1", new MGF1ParameterSpec("MD5"), PSource.PSpecified.DEFAULT)); 2597 @@ -213,10 +217,12 @@ 2598 { 2599 initFromSpec(OAEPParameterSpec.DEFAULT); 2600 } 2601 - else if (pad.equals("OAEPWITHSHA224ANDMGF1PADDING") || pad.equals("OAEPWITHSHA-224ANDMGF1PADDING")) 2602 - { 2603 - initFromSpec(new OAEPParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), PSource.PSpecified.DEFAULT)); 2604 - } 2605 + // BEGIN android-removed 2606 + // else if (pad.equals("OAEPWITHSHA224ANDMGF1PADDING") || pad.equals("OAEPWITHSHA-224ANDMGF1PADDING")) 2607 + // { 2608 + // initFromSpec(new OAEPParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), PSource.PSpecified.DEFAULT)); 2609 + // } 2610 + // END android-removed 2611 else if (pad.equals("OAEPWITHSHA256ANDMGF1PADDING") || pad.equals("OAEPWITHSHA-256ANDMGF1PADDING")) 2612 { 2613 initFromSpec(new OAEPParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT)); 2614 @@ -539,48 +545,50 @@ 2615 } 2616 } 2617 2618 - static public class PKCS1v1_5Padding 2619 - extends CipherSpi 2620 - { 2621 - public PKCS1v1_5Padding() 2622 - { 2623 - super(new PKCS1Encoding(new RSABlindedEngine())); 2624 - } 2625 - } 2626 - 2627 - static public class PKCS1v1_5Padding_PrivateOnly 2628 - extends CipherSpi 2629 - { 2630 - public PKCS1v1_5Padding_PrivateOnly() 2631 - { 2632 - super(false, true, new PKCS1Encoding(new RSABlindedEngine())); 2633 - } 2634 - } 2635 - 2636 - static public class PKCS1v1_5Padding_PublicOnly 2637 - extends CipherSpi 2638 - { 2639 - public PKCS1v1_5Padding_PublicOnly() 2640 - { 2641 - super(true, false, new PKCS1Encoding(new RSABlindedEngine())); 2642 - } 2643 - } 2644 - 2645 - static public class OAEPPadding 2646 - extends CipherSpi 2647 - { 2648 - public OAEPPadding() 2649 - { 2650 - super(OAEPParameterSpec.DEFAULT); 2651 - } 2652 - } 2653 - 2654 - static public class ISO9796d1Padding 2655 - extends CipherSpi 2656 - { 2657 - public ISO9796d1Padding() 2658 - { 2659 - super(new ISO9796d1Encoding(new RSABlindedEngine())); 2660 - } 2661 - } 2662 + // BEGIN android-removed 2663 + // static public class PKCS1v1_5Padding 2664 + // extends CipherSpi 2665 + // { 2666 + // public PKCS1v1_5Padding() 2667 + // { 2668 + // super(new PKCS1Encoding(new RSABlindedEngine())); 2669 + // } 2670 + // } 2671 + // 2672 + // static public class PKCS1v1_5Padding_PrivateOnly 2673 + // extends CipherSpi 2674 + // { 2675 + // public PKCS1v1_5Padding_PrivateOnly() 2676 + // { 2677 + // super(false, true, new PKCS1Encoding(new RSABlindedEngine())); 2678 + // } 2679 + // } 2680 + // 2681 + // static public class PKCS1v1_5Padding_PublicOnly 2682 + // extends CipherSpi 2683 + // { 2684 + // public PKCS1v1_5Padding_PublicOnly() 2685 + // { 2686 + // super(true, false, new PKCS1Encoding(new RSABlindedEngine())); 2687 + // } 2688 + // } 2689 + // 2690 + // static public class OAEPPadding 2691 + // extends CipherSpi 2692 + // { 2693 + // public OAEPPadding() 2694 + // { 2695 + // super(OAEPParameterSpec.DEFAULT); 2696 + // } 2697 + // } 2698 + // 2699 + // static public class ISO9796d1Padding 2700 + // extends CipherSpi 2701 + // { 2702 + // public ISO9796d1Padding() 2703 + // { 2704 + // super(new ISO9796d1Encoding(new RSABlindedEngine())); 2705 + // } 2706 + // } 2707 + // END android-removed 2708 } 2709 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java 2710 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java 2013-05-31 21:16:46.000000000 +0000 2711 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java 2012-09-17 23:04:47.000000000 +0000 2712 @@ -17,24 +17,31 @@ 2713 import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; 2714 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 2715 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 2716 -import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 2717 +// BEGIN android-removed 2718 +// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 2719 +// END android-removed 2720 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 2721 import org.bouncycastle.asn1.x509.DigestInfo; 2722 import org.bouncycastle.crypto.AsymmetricBlockCipher; 2723 import org.bouncycastle.crypto.CipherParameters; 2724 import org.bouncycastle.crypto.Digest; 2725 -import org.bouncycastle.crypto.digests.MD2Digest; 2726 -import org.bouncycastle.crypto.digests.MD4Digest; 2727 -import org.bouncycastle.crypto.digests.MD5Digest; 2728 -import org.bouncycastle.crypto.digests.NullDigest; 2729 -import org.bouncycastle.crypto.digests.RIPEMD128Digest; 2730 -import org.bouncycastle.crypto.digests.RIPEMD160Digest; 2731 -import org.bouncycastle.crypto.digests.RIPEMD256Digest; 2732 -import org.bouncycastle.crypto.digests.SHA1Digest; 2733 -import org.bouncycastle.crypto.digests.SHA224Digest; 2734 -import org.bouncycastle.crypto.digests.SHA256Digest; 2735 -import org.bouncycastle.crypto.digests.SHA384Digest; 2736 -import org.bouncycastle.crypto.digests.SHA512Digest; 2737 +// BEGIN android-removed 2738 +// import org.bouncycastle.crypto.digests.MD2Digest; 2739 +// import org.bouncycastle.crypto.digests.MD4Digest; 2740 +// import org.bouncycastle.crypto.digests.MD5Digest; 2741 +// import org.bouncycastle.crypto.digests.NullDigest; 2742 +// import org.bouncycastle.crypto.digests.RIPEMD128Digest; 2743 +// import org.bouncycastle.crypto.digests.RIPEMD160Digest; 2744 +// import org.bouncycastle.crypto.digests.RIPEMD256Digest; 2745 +// import org.bouncycastle.crypto.digests.SHA1Digest; 2746 +// import org.bouncycastle.crypto.digests.SHA224Digest; 2747 +// import org.bouncycastle.crypto.digests.SHA256Digest; 2748 +// import org.bouncycastle.crypto.digests.SHA384Digest; 2749 +// import org.bouncycastle.crypto.digests.SHA512Digest; 2750 +// END android-removed 2751 +// BEGIN android-added 2752 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 2753 +// END android-added 2754 import org.bouncycastle.crypto.encodings.PKCS1Encoding; 2755 import org.bouncycastle.crypto.engines.RSABlindedEngine; 2756 2757 @@ -261,25 +268,31 @@ 2758 { 2759 public SHA1() 2760 { 2761 - super(OIWObjectIdentifiers.idSHA1, new SHA1Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2762 + // BEGIN android-changed 2763 + super(OIWObjectIdentifiers.idSHA1, AndroidDigestFactory.getSHA1(), new PKCS1Encoding(new RSABlindedEngine())); 2764 + // END android-changed 2765 } 2766 } 2767 2768 - static public class SHA224 2769 - extends DigestSignatureSpi 2770 - { 2771 - public SHA224() 2772 - { 2773 - super(NISTObjectIdentifiers.id_sha224, new SHA224Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2774 - } 2775 - } 2776 + // BEGIN android-removed 2777 + // static public class SHA224 2778 + // extends DigestSignatureSpi 2779 + // { 2780 + // public SHA224() 2781 + // { 2782 + // super(NISTObjectIdentifiers.id_sha224, new SHA224Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2783 + // } 2784 + // } 2785 + // END android-removed 2786 2787 static public class SHA256 2788 extends DigestSignatureSpi 2789 { 2790 public SHA256() 2791 { 2792 - super(NISTObjectIdentifiers.id_sha256, new SHA256Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2793 + // BEGIN android-changed 2794 + super(NISTObjectIdentifiers.id_sha256, AndroidDigestFactory.getSHA256(), new PKCS1Encoding(new RSABlindedEngine())); 2795 + // END android-changed 2796 } 2797 } 2798 2799 @@ -288,7 +301,9 @@ 2800 { 2801 public SHA384() 2802 { 2803 - super(NISTObjectIdentifiers.id_sha384, new SHA384Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2804 + // BEGIN android-changed 2805 + super(NISTObjectIdentifiers.id_sha384, AndroidDigestFactory.getSHA384(), new PKCS1Encoding(new RSABlindedEngine())); 2806 + // END android-changed 2807 } 2808 } 2809 2810 @@ -297,70 +312,78 @@ 2811 { 2812 public SHA512() 2813 { 2814 - super(NISTObjectIdentifiers.id_sha512, new SHA512Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2815 - } 2816 - } 2817 - 2818 - static public class MD2 2819 - extends DigestSignatureSpi 2820 - { 2821 - public MD2() 2822 - { 2823 - super(PKCSObjectIdentifiers.md2, new MD2Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2824 + // BEGIN android-changed 2825 + super(NISTObjectIdentifiers.id_sha512, AndroidDigestFactory.getSHA512(), new PKCS1Encoding(new RSABlindedEngine())); 2826 + // END android-changed 2827 } 2828 } 2829 2830 - static public class MD4 2831 - extends DigestSignatureSpi 2832 - { 2833 - public MD4() 2834 - { 2835 - super(PKCSObjectIdentifiers.md4, new MD4Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2836 - } 2837 - } 2838 + // BEGIN android-removed 2839 + // static public class MD2 2840 + // extends DigestSignatureSpi 2841 + // { 2842 + // public MD2() 2843 + // { 2844 + // super(PKCSObjectIdentifiers.md2, new MD2Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2845 + // } 2846 + // } 2847 + // 2848 + // static public class MD4 2849 + // extends DigestSignatureSpi 2850 + // { 2851 + // public MD4() 2852 + // { 2853 + // super(PKCSObjectIdentifiers.md4, new MD4Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2854 + // } 2855 + // } 2856 + // END android-removed 2857 2858 static public class MD5 2859 extends DigestSignatureSpi 2860 { 2861 public MD5() 2862 { 2863 - super(PKCSObjectIdentifiers.md5, new MD5Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2864 + // BEGIN android-changed 2865 + super(PKCSObjectIdentifiers.md5, AndroidDigestFactory.getMD5(), new PKCS1Encoding(new RSABlindedEngine())); 2866 + // END android-changed 2867 } 2868 } 2869 2870 - static public class RIPEMD160 2871 - extends DigestSignatureSpi 2872 - { 2873 - public RIPEMD160() 2874 - { 2875 - super(TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2876 - } 2877 - } 2878 - 2879 - static public class RIPEMD128 2880 - extends DigestSignatureSpi 2881 - { 2882 - public RIPEMD128() 2883 - { 2884 - super(TeleTrusTObjectIdentifiers.ripemd128, new RIPEMD128Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2885 - } 2886 - } 2887 - 2888 - static public class RIPEMD256 2889 - extends DigestSignatureSpi 2890 - { 2891 - public RIPEMD256() 2892 - { 2893 - super(TeleTrusTObjectIdentifiers.ripemd256, new RIPEMD256Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2894 - } 2895 - } 2896 - 2897 - static public class noneRSA 2898 - extends DigestSignatureSpi 2899 - { 2900 - public noneRSA() 2901 - { 2902 - super(new NullDigest(), new PKCS1Encoding(new RSABlindedEngine())); 2903 - } 2904 - } 2905 + // BEGIN android-removed 2906 + // static public class RIPEMD160 2907 + // extends DigestSignatureSpi 2908 + // { 2909 + // public RIPEMD160() 2910 + // { 2911 + // super(TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2912 + // } 2913 + // } 2914 + // 2915 + // static public class RIPEMD128 2916 + // extends DigestSignatureSpi 2917 + // { 2918 + // public RIPEMD128() 2919 + // { 2920 + // super(TeleTrusTObjectIdentifiers.ripemd128, new RIPEMD128Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2921 + // } 2922 + // } 2923 + // 2924 + // static public class RIPEMD256 2925 + // extends DigestSignatureSpi 2926 + // { 2927 + // public RIPEMD256() 2928 + // { 2929 + // super(TeleTrusTObjectIdentifiers.ripemd256, new RIPEMD256Digest(), new PKCS1Encoding(new RSABlindedEngine())); 2930 + // } 2931 + // } 2932 + // 2933 + // static public class noneRSA 2934 + // extends DigestSignatureSpi 2935 + // { 2936 + // public noneRSA() 2937 + // { 2938 + // super(new NullDigest(), new PKCS1Encoding(new RSABlindedEngine())); 2939 + // } 2940 + // } 2941 + // END android-removed 2942 } 2943 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/util/BaseCipherSpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/util/BaseCipherSpi.java 2944 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/util/BaseCipherSpi.java 2013-05-31 21:16:46.000000000 +0000 2945 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/util/BaseCipherSpi.java 2012-09-17 23:04:47.000000000 +0000 2946 @@ -18,8 +18,10 @@ 2947 import javax.crypto.NoSuchPaddingException; 2948 import javax.crypto.spec.IvParameterSpec; 2949 import javax.crypto.spec.PBEParameterSpec; 2950 -import javax.crypto.spec.RC2ParameterSpec; 2951 -import javax.crypto.spec.RC5ParameterSpec; 2952 +// BEGIN android-removed 2953 +// import javax.crypto.spec.RC2ParameterSpec; 2954 +// import javax.crypto.spec.RC5ParameterSpec; 2955 +// END android-removed 2956 import javax.crypto.spec.SecretKeySpec; 2957 2958 import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 2959 @@ -37,8 +39,10 @@ 2960 { 2961 IvParameterSpec.class, 2962 PBEParameterSpec.class, 2963 - RC2ParameterSpec.class, 2964 - RC5ParameterSpec.class 2965 + // BEGIN android-removed 2966 + // RC2ParameterSpec.class, 2967 + // RC5ParameterSpec.class 2968 + // END android-removed 2969 }; 2970 2971 2972 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/util/ECUtil.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/util/ECUtil.java 2973 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/util/ECUtil.java 2013-05-31 21:16:46.000000000 +0000 2974 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/util/ECUtil.java 2013-05-25 02:14:15.000000000 +0000 2975 @@ -5,11 +5,15 @@ 2976 import java.security.PublicKey; 2977 2978 import org.bouncycastle.asn1.ASN1ObjectIdentifier; 2979 -import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 2980 +// BEGIN android-removed 2981 +// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 2982 +// END android-removed 2983 import org.bouncycastle.asn1.nist.NISTNamedCurves; 2984 import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 2985 import org.bouncycastle.asn1.sec.SECNamedCurves; 2986 -import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 2987 +// BEGIN android-removed 2988 +// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 2989 +// END android-removed 2990 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 2991 import org.bouncycastle.asn1.x9.X962NamedCurves; 2992 import org.bouncycastle.asn1.x9.X9ECParameters; 2993 @@ -225,14 +229,16 @@ 2994 { 2995 oid = NISTNamedCurves.getOID(name); 2996 } 2997 - if (oid == null) 2998 - { 2999 - oid = TeleTrusTNamedCurves.getOID(name); 3000 - } 3001 - if (oid == null) 3002 - { 3003 - oid = ECGOST3410NamedCurves.getOID(name); 3004 - } 3005 + // BEGIN android-removed 3006 + // if (oid == null) 3007 + // { 3008 + // oid = TeleTrusTNamedCurves.getOID(name); 3009 + // } 3010 + // if (oid == null) 3011 + // { 3012 + // oid = ECGOST3410NamedCurves.getOID(name); 3013 + // } 3014 + // END android-removed 3015 } 3016 3017 return oid; 3018 @@ -250,10 +256,12 @@ 3019 { 3020 params = NISTNamedCurves.getByOID(oid); 3021 } 3022 - if (params == null) 3023 - { 3024 - params = TeleTrusTNamedCurves.getByOID(oid); 3025 - } 3026 + // BEGIN android-removed 3027 + // if (params == null) 3028 + // { 3029 + // params = TeleTrusTNamedCurves.getByOID(oid); 3030 + // } 3031 + // END android-removed 3032 } 3033 3034 return params; 3035 @@ -271,14 +279,16 @@ 3036 { 3037 name = NISTNamedCurves.getName(oid); 3038 } 3039 - if (name == null) 3040 - { 3041 - name = TeleTrusTNamedCurves.getName(oid); 3042 - } 3043 - if (name == null) 3044 - { 3045 - name = ECGOST3410NamedCurves.getName(oid); 3046 - } 3047 + // BEGIN android-removed 3048 + // if (name == null) 3049 + // { 3050 + // name = TeleTrusTNamedCurves.getName(oid); 3051 + // } 3052 + // if (name == null) 3053 + // { 3054 + // name = ECGOST3410NamedCurves.getName(oid); 3055 + // } 3056 + // END android-removed 3057 } 3058 3059 return name; 3060 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/x509/PKIXCertPath.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/x509/PKIXCertPath.java 3061 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/x509/PKIXCertPath.java 2013-05-31 21:16:46.000000000 +0000 3062 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/x509/PKIXCertPath.java 2013-02-21 00:01:31.000000000 +0000 3063 @@ -36,7 +36,9 @@ 3064 import org.bouncycastle.asn1.pkcs.SignedData; 3065 import org.bouncycastle.jce.provider.BouncyCastleProvider; 3066 import org.bouncycastle.util.io.pem.PemObject; 3067 -import org.bouncycastle.util.io.pem.PemWriter; 3068 +// BEGIN android-removed 3069 +// import org.bouncycastle.util.io.pem.PemWriter; 3070 +// END android-removed 3071 3072 /** 3073 * CertPath implementation for X.509 certificates. 3074 @@ -51,7 +53,9 @@ 3075 { 3076 List encodings = new ArrayList(); 3077 encodings.add("PkiPath"); 3078 - encodings.add("PEM"); 3079 + // BEGIN android-removed 3080 + // encodings.add("PEM"); 3081 + // END android-removed 3082 encodings.add("PKCS7"); 3083 certPathEncodings = Collections.unmodifiableList(encodings); 3084 } 3085 @@ -298,27 +302,29 @@ 3086 return toDEREncoded(new ContentInfo( 3087 PKCSObjectIdentifiers.signedData, sd)); 3088 } 3089 - else if (encoding.equalsIgnoreCase("PEM")) 3090 - { 3091 - ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 3092 - PemWriter pWrt = new PemWriter(new OutputStreamWriter(bOut)); 3093 - 3094 - try 3095 - { 3096 - for (int i = 0; i != certificates.size(); i++) 3097 - { 3098 - pWrt.writeObject(new PemObject("CERTIFICATE", ((X509Certificate)certificates.get(i)).getEncoded())); 3099 - } 3100 - 3101 - pWrt.close(); 3102 - } 3103 - catch (Exception e) 3104 - { 3105 - throw new CertificateEncodingException("can't encode certificate for PEM encoded path"); 3106 - } 3107 - 3108 - return bOut.toByteArray(); 3109 - } 3110 + // BEGIN android-removed 3111 + // else if (encoding.equalsIgnoreCase("PEM")) 3112 + // { 3113 + // ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 3114 + // PemWriter pWrt = new PemWriter(new OutputStreamWriter(bOut)); 3115 + // 3116 + // try 3117 + // { 3118 + // for (int i = 0; i != certificates.size(); i++) 3119 + // { 3120 + // pWrt.writeObject(new PemObject("CERTIFICATE", ((X509Certificate)certificates.get(i)).getEncoded())); 3121 + // } 3122 + // 3123 + // pWrt.close(); 3124 + // } 3125 + // catch (Exception e) 3126 + // { 3127 + // throw new CertificateEncodingException("can't encode certificate for PEM encoded path"); 3128 + // } 3129 + // 3130 + // return bOut.toByteArray(); 3131 + // } 3132 + // END android-removed 3133 else 3134 { 3135 throw new CertificateEncodingException("unsupported encoding: " + encoding); 3136 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CertificateObject.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CertificateObject.java 3137 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CertificateObject.java 2013-05-31 21:16:46.000000000 +0000 3138 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CertificateObject.java 2013-05-25 02:14:15.000000000 +0000 3139 @@ -57,6 +57,9 @@ 3140 import org.bouncycastle.asn1.x509.Extensions; 3141 import org.bouncycastle.asn1.x509.GeneralName; 3142 import org.bouncycastle.asn1.x509.KeyUsage; 3143 +// BEGIN android-added 3144 +import org.bouncycastle.asn1.x509.X509Name; 3145 +// END android-added 3146 import org.bouncycastle.jcajce.provider.asymmetric.util.PKCS12BagAttributeCarrierImpl; 3147 import org.bouncycastle.jce.X509Principal; 3148 import org.bouncycastle.jce.interfaces.PKCS12BagAttributeCarrier; 3149 @@ -564,12 +567,20 @@ 3150 } 3151 } 3152 3153 + // BEGIN android-changed 3154 + private byte[] encoded; 3155 + // END android-changed 3156 public byte[] getEncoded() 3157 throws CertificateEncodingException 3158 { 3159 try 3160 { 3161 - return c.getEncoded(ASN1Encoding.DER); 3162 + // BEGIN android-changed 3163 + if (encoded == null) { 3164 + encoded = c.getEncoded(ASN1Encoding.DER); 3165 + } 3166 + return encoded; 3167 + // END android-changed 3168 } 3169 catch (IOException e) 3170 { 3171 @@ -860,7 +871,9 @@ 3172 list.add(genName.getEncoded()); 3173 break; 3174 case GeneralName.directoryName: 3175 - list.add(X500Name.getInstance(RFC4519Style.INSTANCE, genName.getName()).toString()); 3176 + // BEGIN android-changed 3177 + list.add(X509Name.getInstance(genName.getName()).toString(true, X509Name.DefaultSymbols)); 3178 + // END android-changed 3179 break; 3180 case GeneralName.dNSName: 3181 case GeneralName.rfc822Name: 3182 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java 3183 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java 2013-05-31 21:16:46.000000000 +0000 3184 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java 2013-05-25 02:14:15.000000000 +0000 3185 @@ -14,12 +14,16 @@ 3186 import org.bouncycastle.asn1.ASN1Sequence; 3187 import org.bouncycastle.asn1.DERNull; 3188 import org.bouncycastle.asn1.DERObjectIdentifier; 3189 -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 3190 +// BEGIN android-removed 3191 +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 3192 +// END android-removed 3193 import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; 3194 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 3195 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 3196 import org.bouncycastle.asn1.pkcs.RSASSAPSSparams; 3197 -import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 3198 +// BEGIN android-removed 3199 +// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 3200 +// END android-removed 3201 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 3202 import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 3203 3204 @@ -114,22 +118,24 @@ 3205 { 3206 return "SHA512"; 3207 } 3208 - else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 3209 - { 3210 - return "RIPEMD128"; 3211 - } 3212 - else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 3213 - { 3214 - return "RIPEMD160"; 3215 - } 3216 - else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 3217 - { 3218 - return "RIPEMD256"; 3219 - } 3220 - else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 3221 - { 3222 - return "GOST3411"; 3223 - } 3224 + // BEGIN android-removed 3225 + // else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 3226 + // { 3227 + // return "RIPEMD128"; 3228 + // } 3229 + // else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 3230 + // { 3231 + // return "RIPEMD160"; 3232 + // } 3233 + // else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 3234 + // { 3235 + // return "RIPEMD256"; 3236 + // } 3237 + // else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 3238 + // { 3239 + // return "GOST3411"; 3240 + // } 3241 + // END android-removed 3242 else 3243 { 3244 return digestAlgOID.getId(); 3245 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/digest/SHA256.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/digest/SHA256.java 3246 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/digest/SHA256.java 2013-05-31 21:16:46.000000000 +0000 3247 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/digest/SHA256.java 2013-05-25 02:14:15.000000000 +0000 3248 @@ -45,17 +45,19 @@ 3249 } 3250 } 3251 3252 - /** 3253 - * PBEWithHmacSHA 3254 - */ 3255 - public static class PBEWithMacKeyFactory 3256 - extends PBESecretKeyFactory 3257 - { 3258 - public PBEWithMacKeyFactory() 3259 - { 3260 - super("PBEwithHmacSHA256", null, false, PKCS12, SHA256, 256, 0); 3261 - } 3262 - } 3263 + // BEGIN android-removed 3264 + // /** 3265 + // * PBEWithHmacSHA 3266 + // */ 3267 + // public static class PBEWithMacKeyFactory 3268 + // extends PBESecretKeyFactory 3269 + // { 3270 + // public PBEWithMacKeyFactory() 3271 + // { 3272 + // super("PBEwithHmacSHA256", null, false, PKCS12, SHA256, 256, 0); 3273 + // } 3274 + // } 3275 + // END android-removed 3276 3277 /** 3278 * HMACSHA256 3279 @@ -84,9 +86,11 @@ 3280 provider.addAlgorithm("Alg.Alias.MessageDigest.SHA256", "SHA-256"); 3281 provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha256, "SHA-256"); 3282 3283 - provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA256", PREFIX + "$PBEWithMacKeyFactory"); 3284 - provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA-256", "PBEWITHHMACSHA256"); 3285 - provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + NISTObjectIdentifiers.id_sha256, "PBEWITHHMACSHA256"); 3286 + // BEGIN android-removed 3287 + // provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA256", PREFIX + "$PBEWithMacKeyFactory"); 3288 + // provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA-256", "PBEWITHHMACSHA256"); 3289 + // provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + NISTObjectIdentifiers.id_sha256, "PBEWITHHMACSHA256"); 3290 + // END android-removed 3291 3292 addHMACAlgorithm(provider, "SHA256", PREFIX + "$HashMac", PREFIX + "$KeyGenerator"); 3293 addHMACAlias(provider, "SHA256", PKCSObjectIdentifiers.id_hmacWithSHA256); 3294 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/digest/SHA384.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/digest/SHA384.java 3295 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/digest/SHA384.java 2013-05-31 21:16:46.000000000 +0000 3296 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/digest/SHA384.java 2013-05-25 02:14:15.000000000 +0000 3297 @@ -5,7 +5,9 @@ 3298 import org.bouncycastle.crypto.CipherKeyGenerator; 3299 import org.bouncycastle.crypto.digests.SHA384Digest; 3300 import org.bouncycastle.crypto.macs.HMac; 3301 -import org.bouncycastle.crypto.macs.OldHMac; 3302 +// BEGIN android-removed 3303 +// import org.bouncycastle.crypto.macs.OldHMac; 3304 +// END android-removed 3305 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 3306 import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 3307 import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 3308 @@ -57,14 +59,16 @@ 3309 } 3310 } 3311 3312 - public static class OldSHA384 3313 - extends BaseMac 3314 - { 3315 - public OldSHA384() 3316 - { 3317 - super(new OldHMac(new SHA384Digest())); 3318 - } 3319 - } 3320 + // BEGIN android-removed 3321 + // public static class OldSHA384 3322 + // extends BaseMac 3323 + // { 3324 + // public OldSHA384() 3325 + // { 3326 + // super(new OldHMac(new SHA384Digest())); 3327 + // } 3328 + // } 3329 + // END android-removed 3330 3331 public static class Mappings 3332 extends DigestAlgorithmProvider 3333 @@ -80,7 +84,9 @@ 3334 provider.addAlgorithm("MessageDigest.SHA-384", PREFIX + "$Digest"); 3335 provider.addAlgorithm("Alg.Alias.MessageDigest.SHA384", "SHA-384"); 3336 provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha384, "SHA-384"); 3337 - provider.addAlgorithm("Mac.OLDHMACSHA384", PREFIX + "$OldSHA384"); 3338 + // BEGIN android-removed 3339 + // provider.addAlgorithm("Mac.OLDHMACSHA384", PREFIX + "$OldSHA384"); 3340 + // END android-removed 3341 3342 addHMACAlgorithm(provider, "SHA384", PREFIX + "$HashMac", PREFIX + "$KeyGenerator"); 3343 addHMACAlias(provider, "SHA384", PKCSObjectIdentifiers.id_hmacWithSHA384); 3344 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/digest/SHA512.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/digest/SHA512.java 3345 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/digest/SHA512.java 2013-05-31 21:16:46.000000000 +0000 3346 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/digest/SHA512.java 2013-05-25 02:14:15.000000000 +0000 3347 @@ -4,9 +4,13 @@ 3348 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 3349 import org.bouncycastle.crypto.CipherKeyGenerator; 3350 import org.bouncycastle.crypto.digests.SHA512Digest; 3351 -import org.bouncycastle.crypto.digests.SHA512tDigest; 3352 +// BEGIN android-removed 3353 +// import org.bouncycastle.crypto.digests.SHA512tDigest; 3354 +// END android-removed 3355 import org.bouncycastle.crypto.macs.HMac; 3356 -import org.bouncycastle.crypto.macs.OldHMac; 3357 +// BEGIN android-removed 3358 +// import org.bouncycastle.crypto.macs.OldHMac; 3359 +// END android-removed 3360 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 3361 import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 3362 import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 3363 @@ -37,42 +41,44 @@ 3364 } 3365 } 3366 3367 - static public class DigestT 3368 - extends BCMessageDigest 3369 - implements Cloneable 3370 - { 3371 - public DigestT(int bitLength) 3372 - { 3373 - super(new SHA512tDigest(bitLength)); 3374 - } 3375 - 3376 - public Object clone() 3377 - throws CloneNotSupportedException 3378 - { 3379 - DigestT d = (DigestT)super.clone(); 3380 - d.digest = new SHA512tDigest((SHA512tDigest)digest); 3381 - 3382 - return d; 3383 - } 3384 - } 3385 - 3386 - static public class DigestT224 3387 - extends DigestT 3388 - { 3389 - public DigestT224() 3390 - { 3391 - super(224); 3392 - } 3393 - } 3394 - 3395 - static public class DigestT256 3396 - extends DigestT 3397 - { 3398 - public DigestT256() 3399 - { 3400 - super(256); 3401 - } 3402 - } 3403 + // BEGIN android-removed 3404 + // static public class DigestT 3405 + // extends BCMessageDigest 3406 + // implements Cloneable 3407 + // { 3408 + // public DigestT(int bitLength) 3409 + // { 3410 + // super(new SHA512tDigest(bitLength)); 3411 + // } 3412 + // 3413 + // public Object clone() 3414 + // throws CloneNotSupportedException 3415 + // { 3416 + // DigestT d = (DigestT)super.clone(); 3417 + // d.digest = new SHA512tDigest((SHA512tDigest)digest); 3418 + // 3419 + // return d; 3420 + // } 3421 + // } 3422 + // 3423 + // static public class DigestT224 3424 + // extends DigestT 3425 + // { 3426 + // public DigestT224() 3427 + // { 3428 + // super(224); 3429 + // } 3430 + // } 3431 + // 3432 + // static public class DigestT256 3433 + // extends DigestT 3434 + // { 3435 + // public DigestT256() 3436 + // { 3437 + // super(256); 3438 + // } 3439 + // } 3440 + // END android-removed 3441 3442 public static class HashMac 3443 extends BaseMac 3444 @@ -83,35 +89,37 @@ 3445 } 3446 } 3447 3448 - public static class HashMacT224 3449 - extends BaseMac 3450 - { 3451 - public HashMacT224() 3452 - { 3453 - super(new HMac(new SHA512tDigest(224))); 3454 - } 3455 - } 3456 - 3457 - public static class HashMacT256 3458 - extends BaseMac 3459 - { 3460 - public HashMacT256() 3461 - { 3462 - super(new HMac(new SHA512tDigest(256))); 3463 - } 3464 - } 3465 - 3466 - /** 3467 - * SHA-512 HMac 3468 - */ 3469 - public static class OldSHA512 3470 - extends BaseMac 3471 - { 3472 - public OldSHA512() 3473 - { 3474 - super(new OldHMac(new SHA512Digest())); 3475 - } 3476 - } 3477 + // BEGIN android-removed 3478 + // public static class HashMacT224 3479 + // extends BaseMac 3480 + // { 3481 + // public HashMacT224() 3482 + // { 3483 + // super(new HMac(new SHA512tDigest(224))); 3484 + // } 3485 + // } 3486 + // 3487 + // public static class HashMacT256 3488 + // extends BaseMac 3489 + // { 3490 + // public HashMacT256() 3491 + // { 3492 + // super(new HMac(new SHA512tDigest(256))); 3493 + // } 3494 + // } 3495 + // 3496 + // /** 3497 + // * SHA-512 HMac 3498 + // */ 3499 + // public static class OldSHA512 3500 + // extends BaseMac 3501 + // { 3502 + // public OldSHA512() 3503 + // { 3504 + // super(new OldHMac(new SHA512Digest())); 3505 + // } 3506 + // } 3507 + // END android-removed 3508 3509 /** 3510 * HMACSHA512 3511 @@ -125,23 +133,25 @@ 3512 } 3513 } 3514 3515 - public static class KeyGeneratorT224 3516 - extends BaseKeyGenerator 3517 - { 3518 - public KeyGeneratorT224() 3519 - { 3520 - super("HMACSHA512/224", 224, new CipherKeyGenerator()); 3521 - } 3522 - } 3523 - 3524 - public static class KeyGeneratorT256 3525 - extends BaseKeyGenerator 3526 - { 3527 - public KeyGeneratorT256() 3528 - { 3529 - super("HMACSHA512/256", 256, new CipherKeyGenerator()); 3530 - } 3531 - } 3532 + // BEGIN android-removed 3533 + // public static class KeyGeneratorT224 3534 + // extends BaseKeyGenerator 3535 + // { 3536 + // public KeyGeneratorT224() 3537 + // { 3538 + // super("HMACSHA512/224", 224, new CipherKeyGenerator()); 3539 + // } 3540 + // } 3541 + // 3542 + // public static class KeyGeneratorT256 3543 + // extends BaseKeyGenerator 3544 + // { 3545 + // public KeyGeneratorT256() 3546 + // { 3547 + // super("HMACSHA512/256", 256, new CipherKeyGenerator()); 3548 + // } 3549 + // } 3550 + // END android-removed 3551 3552 public static class Mappings 3553 extends DigestAlgorithmProvider 3554 @@ -158,21 +168,25 @@ 3555 provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512", "SHA-512"); 3556 provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512, "SHA-512"); 3557 3558 - provider.addAlgorithm("MessageDigest.SHA-512/224", PREFIX + "$DigestT224"); 3559 - provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512/224", "SHA-512/224"); 3560 - provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512_224, "SHA-512/224"); 3561 - 3562 - provider.addAlgorithm("MessageDigest.SHA-512/256", PREFIX + "$DigestT256"); 3563 - provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512256", "SHA-512/256"); 3564 - provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512_256, "SHA-512/256"); 3565 - 3566 - provider.addAlgorithm("Mac.OLDHMACSHA512", PREFIX + "$OldSHA512"); 3567 + // BEGIN android-removed 3568 + // provider.addAlgorithm("MessageDigest.SHA-512/224", PREFIX + "$DigestT224"); 3569 + // provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512/224", "SHA-512/224"); 3570 + // provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512_224, "SHA-512/224"); 3571 + // 3572 + // provider.addAlgorithm("MessageDigest.SHA-512/256", PREFIX + "$DigestT256"); 3573 + // provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512256", "SHA-512/256"); 3574 + // provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512_256, "SHA-512/256"); 3575 + // 3576 + // provider.addAlgorithm("Mac.OLDHMACSHA512", PREFIX + "$OldSHA512"); 3577 + // END android-removed 3578 3579 addHMACAlgorithm(provider, "SHA512", PREFIX + "$HashMac", PREFIX + "$KeyGenerator"); 3580 addHMACAlias(provider, "SHA512", PKCSObjectIdentifiers.id_hmacWithSHA512); 3581 3582 - addHMACAlgorithm(provider, "SHA512/224", PREFIX + "$HashMacT224", PREFIX + "$KeyGeneratorT224"); 3583 - addHMACAlgorithm(provider, "SHA512/256", PREFIX + "$HashMacT256", PREFIX + "$KeyGeneratorT256"); 3584 + // BEGIN android-removed 3585 + // addHMACAlgorithm(provider, "SHA512/224", PREFIX + "$HashMacT224", PREFIX + "$KeyGeneratorT224"); 3586 + // addHMACAlgorithm(provider, "SHA512/256", PREFIX + "$HashMacT256", PREFIX + "$KeyGeneratorT256"); 3587 + // END android-removed 3588 } 3589 } 3590 3591 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/keystore/BC.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/keystore/BC.java 3592 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/keystore/BC.java 2013-05-31 21:16:46.000000000 +0000 3593 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/keystore/BC.java 2013-05-25 02:14:15.000000000 +0000 3594 @@ -17,7 +17,9 @@ 3595 public void configure(ConfigurableProvider provider) 3596 { 3597 provider.addAlgorithm("KeyStore.BKS", PREFIX + "BcKeyStoreSpi$Std"); 3598 - provider.addAlgorithm("KeyStore.BKS-V1", PREFIX + "BcKeyStoreSpi$Version1"); 3599 + // BEGIN android-removed 3600 + // provider.addAlgorithm("KeyStore.BKS-V1", PREFIX + "BcKeyStoreSpi$Version1"); 3601 + // END android-removed 3602 provider.addAlgorithm("KeyStore.BouncyCastle", PREFIX + "BcKeyStoreSpi$BouncyCastleStore"); 3603 provider.addAlgorithm("Alg.Alias.KeyStore.UBER", "BouncyCastle"); 3604 provider.addAlgorithm("Alg.Alias.KeyStore.BOUNCYCASTLE", "BouncyCastle"); 3605 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/keystore/PKCS12.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/keystore/PKCS12.java 3606 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/keystore/PKCS12.java 2013-05-31 21:16:46.000000000 +0000 3607 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/keystore/PKCS12.java 2013-05-25 02:14:15.000000000 +0000 3608 @@ -17,14 +17,16 @@ 3609 public void configure(ConfigurableProvider provider) 3610 { 3611 provider.addAlgorithm("KeyStore.PKCS12", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore"); 3612 - provider.addAlgorithm("KeyStore.BCPKCS12", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore"); 3613 - provider.addAlgorithm("KeyStore.PKCS12-DEF", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore"); 3614 - 3615 - provider.addAlgorithm("KeyStore.PKCS12-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore"); 3616 - provider.addAlgorithm("KeyStore.PKCS12-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore3DES"); 3617 - 3618 - provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore"); 3619 - provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore3DES"); 3620 + // BEGIN android-removed 3621 + // provider.addAlgorithm("KeyStore.BCPKCS12", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore"); 3622 + // provider.addAlgorithm("KeyStore.PKCS12-DEF", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore"); 3623 + // 3624 + // provider.addAlgorithm("KeyStore.PKCS12-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore"); 3625 + // provider.addAlgorithm("KeyStore.PKCS12-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore3DES"); 3626 + // 3627 + // provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore"); 3628 + // provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore3DES"); 3629 + // END android-removed 3630 } 3631 } 3632 } 3633 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/keystore/pkcs12/PKCS12KeyStoreSpi.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/keystore/pkcs12/PKCS12KeyStoreSpi.java 3634 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/keystore/pkcs12/PKCS12KeyStoreSpi.java 2013-05-31 21:16:46.000000000 +0000 3635 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/keystore/pkcs12/PKCS12KeyStoreSpi.java 2013-05-25 02:14:15.000000000 +0000 3636 @@ -1594,32 +1594,34 @@ 3637 } 3638 } 3639 3640 - public static class BCPKCS12KeyStore3DES 3641 - extends PKCS12KeyStoreSpi 3642 - { 3643 - public BCPKCS12KeyStore3DES() 3644 - { 3645 - super(bcProvider, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 3646 - } 3647 - } 3648 - 3649 - public static class DefPKCS12KeyStore 3650 - extends PKCS12KeyStoreSpi 3651 - { 3652 - public DefPKCS12KeyStore() 3653 - { 3654 - super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd40BitRC2_CBC); 3655 - } 3656 - } 3657 - 3658 - public static class DefPKCS12KeyStore3DES 3659 - extends PKCS12KeyStoreSpi 3660 - { 3661 - public DefPKCS12KeyStore3DES() 3662 - { 3663 - super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 3664 - } 3665 - } 3666 + // BEGIN android-removed 3667 + // public static class BCPKCS12KeyStore3DES 3668 + // extends PKCS12KeyStoreSpi 3669 + // { 3670 + // public BCPKCS12KeyStore3DES() 3671 + // { 3672 + // super(bcProvider, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 3673 + // } 3674 + // } 3675 + // 3676 + // public static class DefPKCS12KeyStore 3677 + // extends PKCS12KeyStoreSpi 3678 + // { 3679 + // public DefPKCS12KeyStore() 3680 + // { 3681 + // super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd40BitRC2_CBC); 3682 + // } 3683 + // } 3684 + // 3685 + // public static class DefPKCS12KeyStore3DES 3686 + // extends PKCS12KeyStoreSpi 3687 + // { 3688 + // public DefPKCS12KeyStore3DES() 3689 + // { 3690 + // super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 3691 + // } 3692 + // } 3693 + // END android-removed 3694 3695 private static class IgnoresCaseHashtable 3696 { 3697 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/AES.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/AES.java 3698 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/AES.java 2013-05-31 21:16:46.000000000 +0000 3699 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/AES.java 2013-05-25 02:14:15.000000000 +0000 3700 @@ -1,11 +1,15 @@ 3701 package org.bouncycastle.jcajce.provider.symmetric; 3702 3703 -import java.security.AlgorithmParameters; 3704 -import java.security.InvalidAlgorithmParameterException; 3705 +// BEGIN android-removed 3706 +// import java.security.AlgorithmParameters; 3707 +// import java.security.InvalidAlgorithmParameterException; 3708 +// END android-removed 3709 import java.security.SecureRandom; 3710 -import java.security.spec.AlgorithmParameterSpec; 3711 - 3712 -import javax.crypto.spec.IvParameterSpec; 3713 +// BEGIN android-removed 3714 +// import java.security.spec.AlgorithmParameterSpec; 3715 +// 3716 +// import javax.crypto.spec.IvParameterSpec; 3717 +// END android-removed 3718 3719 import org.bouncycastle.asn1.bc.BCObjectIdentifiers; 3720 import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; 3721 @@ -14,23 +18,31 @@ 3722 import org.bouncycastle.crypto.CipherKeyGenerator; 3723 import org.bouncycastle.crypto.engines.AESFastEngine; 3724 import org.bouncycastle.crypto.engines.AESWrapEngine; 3725 -import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 3726 -import org.bouncycastle.crypto.macs.CMac; 3727 -import org.bouncycastle.crypto.macs.GMac; 3728 +// BEGIN android-removed 3729 +// import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 3730 +// import org.bouncycastle.crypto.macs.CMac; 3731 +// import org.bouncycastle.crypto.macs.GMac; 3732 +// END android-removed 3733 import org.bouncycastle.crypto.modes.CBCBlockCipher; 3734 import org.bouncycastle.crypto.modes.CFBBlockCipher; 3735 import org.bouncycastle.crypto.modes.GCMBlockCipher; 3736 import org.bouncycastle.crypto.modes.OFBBlockCipher; 3737 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 3738 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator; 3739 +// BEGIN android-removed 3740 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator; 3741 +// END android-removed 3742 import org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher; 3743 import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 3744 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 3745 +// BEGIN android-removed 3746 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 3747 +// END android-removed 3748 import org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher; 3749 import org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider; 3750 import org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters; 3751 import org.bouncycastle.jcajce.provider.symmetric.util.PBESecretKeyFactory; 3752 -import org.bouncycastle.jce.provider.BouncyCastleProvider; 3753 +// BEGIN android-removed 3754 +// import org.bouncycastle.jce.provider.BouncyCastleProvider; 3755 +// END android-removed 3756 3757 public final class AES 3758 { 3759 @@ -80,23 +92,25 @@ 3760 } 3761 } 3762 3763 - public static class AESCMAC 3764 - extends BaseMac 3765 - { 3766 - public AESCMAC() 3767 - { 3768 - super(new CMac(new AESFastEngine())); 3769 - } 3770 - } 3771 - 3772 - public static class AESGMAC 3773 - extends BaseMac 3774 - { 3775 - public AESGMAC() 3776 - { 3777 - super(new GMac(new GCMBlockCipher(new AESFastEngine()))); 3778 - } 3779 - } 3780 + // BEGIN android-removed 3781 + // public static class AESCMAC 3782 + // extends BaseMac 3783 + // { 3784 + // public AESCMAC() 3785 + // { 3786 + // super(new CMac(new AESFastEngine())); 3787 + // } 3788 + // } 3789 + // 3790 + // public static class AESGMAC 3791 + // extends BaseMac 3792 + // { 3793 + // public AESGMAC() 3794 + // { 3795 + // super(new GMac(new GCMBlockCipher(new AESFastEngine()))); 3796 + // } 3797 + // } 3798 + // END android-removed 3799 3800 static public class Wrap 3801 extends BaseWrapCipher 3802 @@ -106,15 +120,17 @@ 3803 super(new AESWrapEngine()); 3804 } 3805 } 3806 - 3807 - public static class RFC3211Wrap 3808 - extends BaseWrapCipher 3809 - { 3810 - public RFC3211Wrap() 3811 - { 3812 - super(new RFC3211WrapEngine(new AESFastEngine()), 16); 3813 - } 3814 - } 3815 + 3816 + // BEGIN android-removed 3817 + // public static class RFC3211Wrap 3818 + // extends BaseWrapCipher 3819 + // { 3820 + // public RFC3211Wrap() 3821 + // { 3822 + // super(new RFC3211WrapEngine(new AESFastEngine()), 16); 3823 + // } 3824 + // } 3825 + // END android-removed 3826 3827 3828 /** 3829 @@ -143,32 +159,34 @@ 3830 } 3831 } 3832 3833 - public static class KeyGen128 3834 - extends KeyGen 3835 - { 3836 - public KeyGen128() 3837 - { 3838 - super(128); 3839 - } 3840 - } 3841 - 3842 - public static class KeyGen192 3843 - extends KeyGen 3844 - { 3845 - public KeyGen192() 3846 - { 3847 - super(192); 3848 - } 3849 - } 3850 - 3851 - public static class KeyGen256 3852 - extends KeyGen 3853 - { 3854 - public KeyGen256() 3855 - { 3856 - super(256); 3857 - } 3858 - } 3859 + // BEGIN android-removed 3860 + // public static class KeyGen128 3861 + // extends KeyGen 3862 + // { 3863 + // public KeyGen128() 3864 + // { 3865 + // super(128); 3866 + // } 3867 + // } 3868 + // 3869 + // public static class KeyGen192 3870 + // extends KeyGen 3871 + // { 3872 + // public KeyGen192() 3873 + // { 3874 + // super(192); 3875 + // } 3876 + // } 3877 + // 3878 + // public static class KeyGen256 3879 + // extends KeyGen 3880 + // { 3881 + // public KeyGen256() 3882 + // { 3883 + // super(256); 3884 + // } 3885 + // } 3886 + // END android-removed 3887 3888 /** 3889 * PBEWithSHA1And128BitAES-BC 3890 @@ -278,43 +296,45 @@ 3891 } 3892 } 3893 3894 - public static class AlgParamGen 3895 - extends BaseAlgorithmParameterGenerator 3896 - { 3897 - protected void engineInit( 3898 - AlgorithmParameterSpec genParamSpec, 3899 - SecureRandom random) 3900 - throws InvalidAlgorithmParameterException 3901 - { 3902 - throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation."); 3903 - } 3904 - 3905 - protected AlgorithmParameters engineGenerateParameters() 3906 - { 3907 - byte[] iv = new byte[16]; 3908 - 3909 - if (random == null) 3910 - { 3911 - random = new SecureRandom(); 3912 - } 3913 - 3914 - random.nextBytes(iv); 3915 - 3916 - AlgorithmParameters params; 3917 - 3918 - try 3919 - { 3920 - params = AlgorithmParameters.getInstance("AES", BouncyCastleProvider.PROVIDER_NAME); 3921 - params.init(new IvParameterSpec(iv)); 3922 - } 3923 - catch (Exception e) 3924 - { 3925 - throw new RuntimeException(e.getMessage()); 3926 - } 3927 - 3928 - return params; 3929 - } 3930 - } 3931 + // BEGIN android-removed 3932 + // public static class AlgParamGen 3933 + // extends BaseAlgorithmParameterGenerator 3934 + // { 3935 + // protected void engineInit( 3936 + // AlgorithmParameterSpec genParamSpec, 3937 + // SecureRandom random) 3938 + // throws InvalidAlgorithmParameterException 3939 + // { 3940 + // throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation."); 3941 + // } 3942 + // 3943 + // protected AlgorithmParameters engineGenerateParameters() 3944 + // { 3945 + // byte[] iv = new byte[16]; 3946 + // 3947 + // if (random == null) 3948 + // { 3949 + // random = new SecureRandom(); 3950 + // } 3951 + // 3952 + // random.nextBytes(iv); 3953 + // 3954 + // AlgorithmParameters params; 3955 + // 3956 + // try 3957 + // { 3958 + // params = AlgorithmParameters.getInstance("AES", BouncyCastleProvider.PROVIDER_NAME); 3959 + // params.init(new IvParameterSpec(iv)); 3960 + // } 3961 + // catch (Exception e) 3962 + // { 3963 + // throw new RuntimeException(e.getMessage()); 3964 + // } 3965 + // 3966 + // return params; 3967 + // } 3968 + // } 3969 + // END android-removed 3970 3971 public static class AlgParams 3972 extends IvAlgorithmParameters 3973 @@ -353,58 +373,66 @@ 3974 provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + NISTObjectIdentifiers.id_aes192_CBC, "AES"); 3975 provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + NISTObjectIdentifiers.id_aes256_CBC, "AES"); 3976 3977 - provider.addAlgorithm("AlgorithmParameterGenerator.AES", PREFIX + "$AlgParamGen"); 3978 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + wrongAES128, "AES"); 3979 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + wrongAES192, "AES"); 3980 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + wrongAES256, "AES"); 3981 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes128_CBC, "AES"); 3982 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes192_CBC, "AES"); 3983 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes256_CBC, "AES"); 3984 + // BEGIN android-removed 3985 + // provider.addAlgorithm("AlgorithmParameterGenerator.AES", PREFIX + "$AlgParamGen"); 3986 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + wrongAES128, "AES"); 3987 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + wrongAES192, "AES"); 3988 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + wrongAES256, "AES"); 3989 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes128_CBC, "AES"); 3990 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes192_CBC, "AES"); 3991 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes256_CBC, "AES"); 3992 + // END android-removed 3993 3994 provider.addAlgorithm("Cipher.AES", PREFIX + "$ECB"); 3995 provider.addAlgorithm("Alg.Alias.Cipher." + wrongAES128, "AES"); 3996 provider.addAlgorithm("Alg.Alias.Cipher." + wrongAES192, "AES"); 3997 provider.addAlgorithm("Alg.Alias.Cipher." + wrongAES256, "AES"); 3998 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_ECB, PREFIX + "$ECB"); 3999 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_ECB, PREFIX + "$ECB"); 4000 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_ECB, PREFIX + "$ECB"); 4001 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_CBC, PREFIX + "$CBC"); 4002 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_CBC, PREFIX + "$CBC"); 4003 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_CBC, PREFIX + "$CBC"); 4004 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_OFB, PREFIX + "$OFB"); 4005 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_OFB, PREFIX + "$OFB"); 4006 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_OFB, PREFIX + "$OFB"); 4007 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_CFB, PREFIX + "$CFB"); 4008 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_CFB, PREFIX + "$CFB"); 4009 - provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_CFB, PREFIX + "$CFB"); 4010 + // BEGIN android-removed 4011 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_ECB, PREFIX + "$ECB"); 4012 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_ECB, PREFIX + "$ECB"); 4013 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_ECB, PREFIX + "$ECB"); 4014 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_CBC, PREFIX + "$CBC"); 4015 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_CBC, PREFIX + "$CBC"); 4016 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_CBC, PREFIX + "$CBC"); 4017 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_OFB, PREFIX + "$OFB"); 4018 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_OFB, PREFIX + "$OFB"); 4019 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_OFB, PREFIX + "$OFB"); 4020 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes128_CFB, PREFIX + "$CFB"); 4021 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes192_CFB, PREFIX + "$CFB"); 4022 + // provider.addAlgorithm("Cipher." + NISTObjectIdentifiers.id_aes256_CFB, PREFIX + "$CFB"); 4023 + // END android-removed 4024 provider.addAlgorithm("Cipher.AESWRAP", PREFIX + "$Wrap"); 4025 provider.addAlgorithm("Alg.Alias.Cipher." + NISTObjectIdentifiers.id_aes128_wrap, "AESWRAP"); 4026 provider.addAlgorithm("Alg.Alias.Cipher." + NISTObjectIdentifiers.id_aes192_wrap, "AESWRAP"); 4027 provider.addAlgorithm("Alg.Alias.Cipher." + NISTObjectIdentifiers.id_aes256_wrap, "AESWRAP"); 4028 - provider.addAlgorithm("Cipher.AESRFC3211WRAP", PREFIX + "$RFC3211Wrap"); 4029 + // BEGIN android-removed 4030 + // provider.addAlgorithm("Cipher.AESRFC3211WRAP", PREFIX + "$RFC3211Wrap"); 4031 + // END android-removed 4032 4033 provider.addAlgorithm("KeyGenerator.AES", PREFIX + "$KeyGen"); 4034 - provider.addAlgorithm("KeyGenerator." + wrongAES128, PREFIX + "$KeyGen128"); 4035 - provider.addAlgorithm("KeyGenerator." + wrongAES192, PREFIX + "$KeyGen192"); 4036 - provider.addAlgorithm("KeyGenerator." + wrongAES256, PREFIX + "$KeyGen256"); 4037 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_ECB, PREFIX + "$KeyGen128"); 4038 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CBC, PREFIX + "$KeyGen128"); 4039 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_OFB, PREFIX + "$KeyGen128"); 4040 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CFB, PREFIX + "$KeyGen128"); 4041 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_ECB, PREFIX + "$KeyGen192"); 4042 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CBC, PREFIX + "$KeyGen192"); 4043 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_OFB, PREFIX + "$KeyGen192"); 4044 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CFB, PREFIX + "$KeyGen192"); 4045 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_ECB, PREFIX + "$KeyGen256"); 4046 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CBC, PREFIX + "$KeyGen256"); 4047 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_OFB, PREFIX + "$KeyGen256"); 4048 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CFB, PREFIX + "$KeyGen256"); 4049 - provider.addAlgorithm("KeyGenerator.AESWRAP", PREFIX + "$KeyGen"); 4050 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_wrap, PREFIX + "$KeyGen128"); 4051 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_wrap, PREFIX + "$KeyGen192"); 4052 - provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_wrap, PREFIX + "$KeyGen256"); 4053 - 4054 - provider.addAlgorithm("Mac.AESCMAC", PREFIX + "$AESCMAC"); 4055 + // BEGIN android-removed 4056 + // provider.addAlgorithm("KeyGenerator." + wrongAES128, PREFIX + "$KeyGen128"); 4057 + // provider.addAlgorithm("KeyGenerator." + wrongAES192, PREFIX + "$KeyGen192"); 4058 + // provider.addAlgorithm("KeyGenerator." + wrongAES256, PREFIX + "$KeyGen256"); 4059 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_ECB, PREFIX + "$KeyGen128"); 4060 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CBC, PREFIX + "$KeyGen128"); 4061 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_OFB, PREFIX + "$KeyGen128"); 4062 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CFB, PREFIX + "$KeyGen128"); 4063 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_ECB, PREFIX + "$KeyGen192"); 4064 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CBC, PREFIX + "$KeyGen192"); 4065 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_OFB, PREFIX + "$KeyGen192"); 4066 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CFB, PREFIX + "$KeyGen192"); 4067 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_ECB, PREFIX + "$KeyGen256"); 4068 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CBC, PREFIX + "$KeyGen256"); 4069 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_OFB, PREFIX + "$KeyGen256"); 4070 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CFB, PREFIX + "$KeyGen256"); 4071 + // provider.addAlgorithm("KeyGenerator.AESWRAP", PREFIX + "$KeyGen"); 4072 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes128_wrap, PREFIX + "$KeyGen128"); 4073 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes192_wrap, PREFIX + "$KeyGen192"); 4074 + // provider.addAlgorithm("KeyGenerator." + NISTObjectIdentifiers.id_aes256_wrap, PREFIX + "$KeyGen256"); 4075 + // 4076 + // provider.addAlgorithm("Mac.AESCMAC", PREFIX + "$AESCMAC"); 4077 + // END android-removed 4078 4079 provider.addAlgorithm("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.getId(), "PBEWITHSHAAND128BITAES-CBC-BC"); 4080 provider.addAlgorithm("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.getId(), "PBEWITHSHAAND192BITAES-CBC-BC"); 4081 @@ -483,7 +511,9 @@ 4082 provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.getId(), "PKCS12PBE"); 4083 provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.getId(), "PKCS12PBE"); 4084 4085 - addGMacAlgorithm(provider, "AES", PREFIX + "$AESGMAC", PREFIX + "$KeyGen128"); 4086 + // BEGIN android-removed 4087 + // addGMacAlgorithm(provider, "AES", PREFIX + "$AESGMAC", PREFIX + "$KeyGen128"); 4088 + // END android-removed 4089 } 4090 } 4091 } 4092 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/ARC4.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/ARC4.java 4093 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/ARC4.java 2013-05-31 21:16:46.000000000 +0000 4094 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/ARC4.java 2013-05-25 02:14:15.000000000 +0000 4095 @@ -29,7 +29,9 @@ 4096 { 4097 public KeyGen() 4098 { 4099 - super("RC4", 128, new CipherKeyGenerator()); 4100 + // BEGIN android-changed 4101 + super("ARC4", 128, new CipherKeyGenerator()); 4102 + // END android-changed 4103 } 4104 } 4105 4106 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/Blowfish.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/Blowfish.java 4107 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/Blowfish.java 2013-05-31 21:16:46.000000000 +0000 4108 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/Blowfish.java 2012-09-17 23:04:47.000000000 +0000 4109 @@ -64,7 +64,9 @@ 4110 { 4111 4112 provider.addAlgorithm("Cipher.BLOWFISH", PREFIX + "$ECB"); 4113 - provider.addAlgorithm("Cipher.1.3.6.1.4.1.3029.1.2", PREFIX + "$CBC"); 4114 + // BEGIN android-removed 4115 + // provider.addAlgorithm("Cipher.1.3.6.1.4.1.3029.1.2", PREFIX + "$CBC"); 4116 + // END android-removed 4117 provider.addAlgorithm("KeyGenerator.BLOWFISH", PREFIX + "$KeyGen"); 4118 provider.addAlgorithm("Alg.Alias.KeyGenerator.1.3.6.1.4.1.3029.1.2", "BLOWFISH"); 4119 provider.addAlgorithm("AlgorithmParameters.BLOWFISH", PREFIX + "$AlgParams"); 4120 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/DES.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/DES.java 4121 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/DES.java 2013-05-31 21:16:46.000000000 +0000 4122 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/DES.java 2013-05-25 02:14:15.000000000 +0000 4123 @@ -19,12 +19,16 @@ 4124 import org.bouncycastle.crypto.CipherParameters; 4125 import org.bouncycastle.crypto.KeyGenerationParameters; 4126 import org.bouncycastle.crypto.engines.DESEngine; 4127 -import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 4128 +// BEGIN android-removed 4129 +// import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 4130 +// END android-removed 4131 import org.bouncycastle.crypto.generators.DESKeyGenerator; 4132 import org.bouncycastle.crypto.macs.CBCBlockCipherMac; 4133 -import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 4134 -import org.bouncycastle.crypto.macs.CMac; 4135 -import org.bouncycastle.crypto.macs.ISO9797Alg3Mac; 4136 +// BEGIN android-removed 4137 +// import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 4138 +// import org.bouncycastle.crypto.macs.CMac; 4139 +// import org.bouncycastle.crypto.macs.ISO9797Alg3Mac; 4140 +// END android-removed 4141 import org.bouncycastle.crypto.modes.CBCBlockCipher; 4142 import org.bouncycastle.crypto.paddings.ISO7816d4Padding; 4143 import org.bouncycastle.crypto.params.DESParameters; 4144 @@ -66,17 +70,19 @@ 4145 } 4146 } 4147 4148 - /** 4149 - * DES CFB8 4150 - */ 4151 - public static class DESCFB8 4152 - extends BaseMac 4153 - { 4154 - public DESCFB8() 4155 - { 4156 - super(new CFBBlockCipherMac(new DESEngine())); 4157 - } 4158 - } 4159 + // BEGIN android-removed 4160 + // /** 4161 + // * DES CFB8 4162 + // */ 4163 + // public static class DESCFB8 4164 + // extends BaseMac 4165 + // { 4166 + // public DESCFB8() 4167 + // { 4168 + // super(new CFBBlockCipherMac(new DESEngine())); 4169 + // } 4170 + // } 4171 + // END android-removed 4172 4173 /** 4174 * DES64 4175 @@ -111,47 +117,49 @@ 4176 } 4177 } 4178 4179 - static public class CMAC 4180 - extends BaseMac 4181 - { 4182 - public CMAC() 4183 - { 4184 - super(new CMac(new DESEngine())); 4185 - } 4186 - } 4187 - 4188 - /** 4189 - * DES9797Alg3with7816-4Padding 4190 - */ 4191 - public static class DES9797Alg3with7816d4 4192 - extends BaseMac 4193 - { 4194 - public DES9797Alg3with7816d4() 4195 - { 4196 - super(new ISO9797Alg3Mac(new DESEngine(), new ISO7816d4Padding())); 4197 - } 4198 - } 4199 - 4200 - /** 4201 - * DES9797Alg3 4202 - */ 4203 - public static class DES9797Alg3 4204 - extends BaseMac 4205 - { 4206 - public DES9797Alg3() 4207 - { 4208 - super(new ISO9797Alg3Mac(new DESEngine())); 4209 - } 4210 - } 4211 - 4212 - public static class RFC3211 4213 - extends BaseWrapCipher 4214 - { 4215 - public RFC3211() 4216 - { 4217 - super(new RFC3211WrapEngine(new DESEngine()), 8); 4218 - } 4219 - } 4220 + // BEGIN android-removed 4221 + // static public class CMAC 4222 + // extends BaseMac 4223 + // { 4224 + // public CMAC() 4225 + // { 4226 + // super(new CMac(new DESEngine())); 4227 + // } 4228 + // } 4229 + // 4230 + // /** 4231 + // * DES9797Alg3with7816-4Padding 4232 + // */ 4233 + // public static class DES9797Alg3with7816d4 4234 + // extends BaseMac 4235 + // { 4236 + // public DES9797Alg3with7816d4() 4237 + // { 4238 + // super(new ISO9797Alg3Mac(new DESEngine(), new ISO7816d4Padding())); 4239 + // } 4240 + // } 4241 + // 4242 + // /** 4243 + // * DES9797Alg3 4244 + // */ 4245 + // public static class DES9797Alg3 4246 + // extends BaseMac 4247 + // { 4248 + // public DES9797Alg3() 4249 + // { 4250 + // super(new ISO9797Alg3Mac(new DESEngine())); 4251 + // } 4252 + // } 4253 + // 4254 + // public static class RFC3211 4255 + // extends BaseWrapCipher 4256 + // { 4257 + // public RFC3211() 4258 + // { 4259 + // super(new RFC3211WrapEngine(new DESEngine()), 8); 4260 + // } 4261 + // } 4262 + // END android-removed 4263 4264 public static class AlgParamGen 4265 extends BaseAlgorithmParameterGenerator 4266 @@ -351,17 +359,19 @@ 4267 } 4268 } 4269 4270 - /** 4271 - * PBEWithMD2AndDES 4272 - */ 4273 - static public class PBEWithMD2KeyFactory 4274 - extends DESPBEKeyFactory 4275 - { 4276 - public PBEWithMD2KeyFactory() 4277 - { 4278 - super("PBEwithMD2andDES", PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, true, PKCS5S1, MD2, 64, 64); 4279 - } 4280 - } 4281 + // BEGIN android-removed 4282 + // /** 4283 + // * PBEWithMD2AndDES 4284 + // */ 4285 + // static public class PBEWithMD2KeyFactory 4286 + // extends DESPBEKeyFactory 4287 + // { 4288 + // public PBEWithMD2KeyFactory() 4289 + // { 4290 + // super("PBEwithMD2andDES", PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, true, PKCS5S1, MD2, 64, 64); 4291 + // } 4292 + // } 4293 + // END android-removed 4294 4295 /** 4296 * PBEWithMD5AndDES 4297 @@ -387,17 +397,19 @@ 4298 } 4299 } 4300 4301 - /** 4302 - * PBEWithMD2AndDES 4303 - */ 4304 - static public class PBEWithMD2 4305 - extends BaseBlockCipher 4306 - { 4307 - public PBEWithMD2() 4308 - { 4309 - super(new CBCBlockCipher(new DESEngine())); 4310 - } 4311 - } 4312 + // BEGIN android-removed 4313 + // /** 4314 + // * PBEWithMD2AndDES 4315 + // */ 4316 + // static public class PBEWithMD2 4317 + // extends BaseBlockCipher 4318 + // { 4319 + // public PBEWithMD2() 4320 + // { 4321 + // super(new CBCBlockCipher(new DESEngine())); 4322 + // } 4323 + // } 4324 + // END android-removed 4325 4326 /** 4327 * PBEWithMD5AndDES 4328 @@ -437,61 +449,75 @@ 4329 { 4330 4331 provider.addAlgorithm("Cipher.DES", PREFIX + "$ECB"); 4332 - provider.addAlgorithm("Cipher." + OIWObjectIdentifiers.desCBC, PREFIX + "$CBC"); 4333 - 4334 - addAlias(provider, OIWObjectIdentifiers.desCBC, "DES"); 4335 - 4336 - provider.addAlgorithm("Cipher.DESRFC3211WRAP", PREFIX + "$RFC3211"); 4337 + // BEGIN android-removed 4338 + // provider.addAlgorithm("Cipher." + OIWObjectIdentifiers.desCBC, PREFIX + "$CBC"); 4339 + // 4340 + // addAlias(provider, OIWObjectIdentifiers.desCBC, "DES"); 4341 + // 4342 + // provider.addAlgorithm("Cipher.DESRFC3211WRAP", PREFIX + "$RFC3211"); 4343 + // END android-removed 4344 4345 provider.addAlgorithm("KeyGenerator.DES", PREFIX + "$KeyGenerator"); 4346 4347 provider.addAlgorithm("SecretKeyFactory.DES", PREFIX + "$KeyFactory"); 4348 4349 - provider.addAlgorithm("Mac.DESCMAC", PREFIX + "$CMAC"); 4350 - provider.addAlgorithm("Mac.DESMAC", PREFIX + "$CBCMAC"); 4351 - provider.addAlgorithm("Alg.Alias.Mac.DES", "DESMAC"); 4352 - 4353 - provider.addAlgorithm("Mac.DESMAC/CFB8", PREFIX + "$DESCFB8"); 4354 - provider.addAlgorithm("Alg.Alias.Mac.DES/CFB8", "DESMAC/CFB8"); 4355 - 4356 - provider.addAlgorithm("Mac.DESMAC64", PREFIX + "$DES64"); 4357 - provider.addAlgorithm("Alg.Alias.Mac.DES64", "DESMAC64"); 4358 - 4359 - provider.addAlgorithm("Mac.DESMAC64WITHISO7816-4PADDING", PREFIX + "$DES64with7816d4"); 4360 - provider.addAlgorithm("Alg.Alias.Mac.DES64WITHISO7816-4PADDING", "DESMAC64WITHISO7816-4PADDING"); 4361 - provider.addAlgorithm("Alg.Alias.Mac.DESISO9797ALG1MACWITHISO7816-4PADDING", "DESMAC64WITHISO7816-4PADDING"); 4362 - provider.addAlgorithm("Alg.Alias.Mac.DESISO9797ALG1WITHISO7816-4PADDING", "DESMAC64WITHISO7816-4PADDING"); 4363 - 4364 - provider.addAlgorithm("Mac.DESWITHISO9797", PREFIX + "$DES9797Alg3"); 4365 - provider.addAlgorithm("Alg.Alias.Mac.DESISO9797MAC", "DESWITHISO9797"); 4366 - 4367 - provider.addAlgorithm("Mac.ISO9797ALG3MAC", PREFIX + "$DES9797Alg3"); 4368 - provider.addAlgorithm("Alg.Alias.Mac.ISO9797ALG3", "ISO9797ALG3MAC"); 4369 - provider.addAlgorithm("Mac.ISO9797ALG3WITHISO7816-4PADDING", PREFIX + "$DES9797Alg3with7816d4"); 4370 - provider.addAlgorithm("Alg.Alias.Mac.ISO9797ALG3MACWITHISO7816-4PADDING", "ISO9797ALG3WITHISO7816-4PADDING"); 4371 + // BEGIN android-removed 4372 + // provider.addAlgorithm("Mac.DESCMAC", PREFIX + "$CMAC"); 4373 + // provider.addAlgorithm("Mac.DESMAC", PREFIX + "$CBCMAC"); 4374 + // provider.addAlgorithm("Alg.Alias.Mac.DES", "DESMAC"); 4375 + // 4376 + // provider.addAlgorithm("Mac.DESMAC/CFB8", PREFIX + "$DESCFB8"); 4377 + // provider.addAlgorithm("Alg.Alias.Mac.DES/CFB8", "DESMAC/CFB8"); 4378 + // 4379 + // provider.addAlgorithm("Mac.DESMAC64", PREFIX + "$DES64"); 4380 + // provider.addAlgorithm("Alg.Alias.Mac.DES64", "DESMAC64"); 4381 + // 4382 + // provider.addAlgorithm("Mac.DESMAC64WITHISO7816-4PADDING", PREFIX + "$DES64with7816d4"); 4383 + // provider.addAlgorithm("Alg.Alias.Mac.DES64WITHISO7816-4PADDING", "DESMAC64WITHISO7816-4PADDING"); 4384 + // provider.addAlgorithm("Alg.Alias.Mac.DESISO9797ALG1MACWITHISO7816-4PADDING", "DESMAC64WITHISO7816-4PADDING"); 4385 + // provider.addAlgorithm("Alg.Alias.Mac.DESISO9797ALG1WITHISO7816-4PADDING", "DESMAC64WITHISO7816-4PADDING"); 4386 + // 4387 + // provider.addAlgorithm("Mac.DESWITHISO9797", PREFIX + "$DES9797Alg3"); 4388 + // provider.addAlgorithm("Alg.Alias.Mac.DESISO9797MAC", "DESWITHISO9797"); 4389 + // 4390 + // provider.addAlgorithm("Mac.ISO9797ALG3MAC", PREFIX + "$DES9797Alg3"); 4391 + // provider.addAlgorithm("Alg.Alias.Mac.ISO9797ALG3", "ISO9797ALG3MAC"); 4392 + // provider.addAlgorithm("Mac.ISO9797ALG3WITHISO7816-4PADDING", PREFIX + "$DES9797Alg3with7816d4"); 4393 + // provider.addAlgorithm("Alg.Alias.Mac.ISO9797ALG3MACWITHISO7816-4PADDING", "ISO9797ALG3WITHISO7816-4PADDING"); 4394 + // END android-removed 4395 4396 provider.addAlgorithm("AlgorithmParameters.DES", PACKAGE + ".util.IvAlgorithmParameters"); 4397 provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + OIWObjectIdentifiers.desCBC, "DES"); 4398 4399 - provider.addAlgorithm("AlgorithmParameterGenerator.DES", PREFIX + "$AlgParamGen"); 4400 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + OIWObjectIdentifiers.desCBC, "DES"); 4401 - 4402 - provider.addAlgorithm("Cipher.PBEWITHMD2ANDDES", PREFIX + "$PBEWithMD2"); 4403 + // BEGIN android-removed 4404 + // provider.addAlgorithm("AlgorithmParameterGenerator.DES", PREFIX + "$AlgParamGen"); 4405 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + OIWObjectIdentifiers.desCBC, "DES"); 4406 + // 4407 + // provider.addAlgorithm("Cipher.PBEWITHMD2ANDDES", PREFIX + "$PBEWithMD2"); 4408 + // END android-removed 4409 provider.addAlgorithm("Cipher.PBEWITHMD5ANDDES", PREFIX + "$PBEWithMD5"); 4410 provider.addAlgorithm("Cipher.PBEWITHSHA1ANDDES", PREFIX + "$PBEWithSHA1"); 4411 4412 - provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 4413 + // BEGIN android-removed 4414 + // provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 4415 + // END android-removed 4416 provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES"); 4417 provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES"); 4418 4419 - provider.addAlgorithm("SecretKeyFactory.PBEWITHMD2ANDDES", PREFIX + "$PBEWithMD2KeyFactory"); 4420 + // BEGIN android-removed 4421 + // provider.addAlgorithm("SecretKeyFactory.PBEWITHMD2ANDDES", PREFIX + "$PBEWithMD2KeyFactory"); 4422 + // END android-removed 4423 provider.addAlgorithm("SecretKeyFactory.PBEWITHMD5ANDDES", PREFIX + "$PBEWithMD5KeyFactory"); 4424 provider.addAlgorithm("SecretKeyFactory.PBEWITHSHA1ANDDES", PREFIX + "$PBEWithSHA1KeyFactory"); 4425 4426 - provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDDES-CBC", "PBEWITHMD2ANDDES"); 4427 + // BEGIN android-removed 4428 + // provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDDES-CBC", "PBEWITHMD2ANDDES"); 4429 + // END android-removed 4430 provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDDES-CBC", "PBEWITHMD5ANDDES"); 4431 provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDDES-CBC", "PBEWITHSHA1ANDDES"); 4432 - provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 4433 + // BEGIN android-removed 4434 + // provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 4435 + // END android-removed 4436 provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES"); 4437 provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES"); 4438 } 4439 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/DESede.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/DESede.java 4440 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/DESede.java 2013-05-31 21:16:46.000000000 +0000 4441 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/DESede.java 2013-05-25 02:14:15.000000000 +0000 4442 @@ -1,30 +1,42 @@ 4443 package org.bouncycastle.jcajce.provider.symmetric; 4444 4445 -import java.security.AlgorithmParameters; 4446 -import java.security.InvalidAlgorithmParameterException; 4447 +// BEGIN android-removed 4448 +// import java.security.AlgorithmParameters; 4449 +// import java.security.InvalidAlgorithmParameterException; 4450 +// END android-removed 4451 import java.security.SecureRandom; 4452 -import java.security.spec.AlgorithmParameterSpec; 4453 +// BEGIN android-removed 4454 +// import java.security.spec.AlgorithmParameterSpec; 4455 +// END android-removed 4456 import java.security.spec.InvalidKeySpecException; 4457 import java.security.spec.KeySpec; 4458 4459 import javax.crypto.SecretKey; 4460 import javax.crypto.spec.DESedeKeySpec; 4461 -import javax.crypto.spec.IvParameterSpec; 4462 +// BEGIN android-removed 4463 +// import javax.crypto.spec.IvParameterSpec; 4464 +// END android-removed 4465 import javax.crypto.spec.SecretKeySpec; 4466 4467 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 4468 import org.bouncycastle.crypto.KeyGenerationParameters; 4469 import org.bouncycastle.crypto.engines.DESedeEngine; 4470 import org.bouncycastle.crypto.engines.DESedeWrapEngine; 4471 -import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 4472 +// BEGIN android-removed 4473 +// import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 4474 +// END android-removed 4475 import org.bouncycastle.crypto.generators.DESedeKeyGenerator; 4476 import org.bouncycastle.crypto.macs.CBCBlockCipherMac; 4477 -import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 4478 -import org.bouncycastle.crypto.macs.CMac; 4479 +// BEGIN android-removed 4480 +// import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 4481 +// import org.bouncycastle.crypto.macs.CMac; 4482 +// END android-removed 4483 import org.bouncycastle.crypto.modes.CBCBlockCipher; 4484 import org.bouncycastle.crypto.paddings.ISO7816d4Padding; 4485 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 4486 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator; 4487 +// BEGIN android-removed 4488 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator; 4489 +// END android-removed 4490 import org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher; 4491 import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 4492 import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 4493 @@ -57,17 +69,19 @@ 4494 } 4495 } 4496 4497 - /** 4498 - * DESede CFB8 4499 - */ 4500 - public static class DESedeCFB8 4501 - extends BaseMac 4502 - { 4503 - public DESedeCFB8() 4504 - { 4505 - super(new CFBBlockCipherMac(new DESedeEngine())); 4506 - } 4507 - } 4508 + // BEGIN android-removed 4509 + // /** 4510 + // * DESede CFB8 4511 + // */ 4512 + // public static class DESedeCFB8 4513 + // extends BaseMac 4514 + // { 4515 + // public DESedeCFB8() 4516 + // { 4517 + // super(new CFBBlockCipherMac(new DESedeEngine())); 4518 + // } 4519 + // } 4520 + // END android-removed 4521 4522 /** 4523 * DESede64 4524 @@ -102,15 +116,17 @@ 4525 } 4526 } 4527 4528 - static public class CMAC 4529 - extends BaseMac 4530 - { 4531 - public CMAC() 4532 - { 4533 - super(new CMac(new DESedeEngine())); 4534 - } 4535 - } 4536 - 4537 + // BEGIN android-removed 4538 + // static public class CMAC 4539 + // extends BaseMac 4540 + // { 4541 + // public CMAC() 4542 + // { 4543 + // super(new CMac(new DESedeEngine())); 4544 + // } 4545 + // } 4546 + // END android-removed 4547 + 4548 public static class Wrap 4549 extends BaseWrapCipher 4550 { 4551 @@ -119,15 +135,17 @@ 4552 super(new DESedeWrapEngine()); 4553 } 4554 } 4555 - 4556 - public static class RFC3211 4557 - extends BaseWrapCipher 4558 - { 4559 - public RFC3211() 4560 - { 4561 - super(new RFC3211WrapEngine(new DESedeEngine()), 8); 4562 - } 4563 - } 4564 + 4565 + // BEGIN android-removed 4566 + // public static class RFC3211 4567 + // extends BaseWrapCipher 4568 + // { 4569 + // public RFC3211() 4570 + // { 4571 + // super(new RFC3211WrapEngine(new DESedeEngine()), 8); 4572 + // } 4573 + // } 4574 + // END android-removed 4575 4576 /** 4577 * DESede - the default for this is to generate a key in 4578 @@ -241,43 +259,45 @@ 4579 } 4580 } 4581 4582 - public static class AlgParamGen 4583 - extends BaseAlgorithmParameterGenerator 4584 - { 4585 - protected void engineInit( 4586 - AlgorithmParameterSpec genParamSpec, 4587 - SecureRandom random) 4588 - throws InvalidAlgorithmParameterException 4589 - { 4590 - throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for DES parameter generation."); 4591 - } 4592 - 4593 - protected AlgorithmParameters engineGenerateParameters() 4594 - { 4595 - byte[] iv = new byte[8]; 4596 - 4597 - if (random == null) 4598 - { 4599 - random = new SecureRandom(); 4600 - } 4601 - 4602 - random.nextBytes(iv); 4603 - 4604 - AlgorithmParameters params; 4605 - 4606 - try 4607 - { 4608 - params = AlgorithmParameters.getInstance("DES", BouncyCastleProvider.PROVIDER_NAME); 4609 - params.init(new IvParameterSpec(iv)); 4610 - } 4611 - catch (Exception e) 4612 - { 4613 - throw new RuntimeException(e.getMessage()); 4614 - } 4615 - 4616 - return params; 4617 - } 4618 - } 4619 + // BEGIN android-removed 4620 + // public static class AlgParamGen 4621 + // extends BaseAlgorithmParameterGenerator 4622 + // { 4623 + // protected void engineInit( 4624 + // AlgorithmParameterSpec genParamSpec, 4625 + // SecureRandom random) 4626 + // throws InvalidAlgorithmParameterException 4627 + // { 4628 + // throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for DES parameter generation."); 4629 + // } 4630 + // 4631 + // protected AlgorithmParameters engineGenerateParameters() 4632 + // { 4633 + // byte[] iv = new byte[8]; 4634 + // 4635 + // if (random == null) 4636 + // { 4637 + // random = new SecureRandom(); 4638 + // } 4639 + // 4640 + // random.nextBytes(iv); 4641 + // 4642 + // AlgorithmParameters params; 4643 + // 4644 + // try 4645 + // { 4646 + // params = AlgorithmParameters.getInstance("DES", BouncyCastleProvider.PROVIDER_NAME); 4647 + // params.init(new IvParameterSpec(iv)); 4648 + // } 4649 + // catch (Exception e) 4650 + // { 4651 + // throw new RuntimeException(e.getMessage()); 4652 + // } 4653 + // 4654 + // return params; 4655 + // } 4656 + // } 4657 + // END android-removed 4658 4659 static public class KeyFactory 4660 extends BaseSecretKeyFactory 4661 @@ -361,25 +381,37 @@ 4662 public void configure(ConfigurableProvider provider) 4663 { 4664 provider.addAlgorithm("Cipher.DESEDE", PREFIX + "$ECB"); 4665 - provider.addAlgorithm("Cipher." + PKCSObjectIdentifiers.des_EDE3_CBC, PREFIX + "$CBC"); 4666 + // BEGIN android-removed 4667 + // provider.addAlgorithm("Cipher." + PKCSObjectIdentifiers.des_EDE3_CBC, PREFIX + "$CBC"); 4668 + // END android-removed 4669 provider.addAlgorithm("Cipher.DESEDEWRAP", PREFIX + "$Wrap"); 4670 - provider.addAlgorithm("Cipher." + PKCSObjectIdentifiers.id_alg_CMS3DESwrap, PREFIX + "$Wrap"); 4671 - provider.addAlgorithm("Cipher.DESEDERFC3211WRAP", PREFIX + "$RFC3211"); 4672 + // BEGIN android-changed 4673 + provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.id_alg_CMS3DESwrap, "DESEDEWRAP"); 4674 + // END android-changed 4675 + // BEGIN android-removed 4676 + // provider.addAlgorithm("Cipher.DESEDERFC3211WRAP", PREFIX + "$RFC3211"); 4677 + // END android-removed 4678 4679 provider.addAlgorithm("Alg.Alias.Cipher.TDEA", "DESEDE"); 4680 provider.addAlgorithm("Alg.Alias.Cipher.TDEAWRAP", "DESEDEWRAP"); 4681 provider.addAlgorithm("Alg.Alias.KeyGenerator.TDEA", "DESEDE"); 4682 provider.addAlgorithm("Alg.Alias.AlgorithmParameters.TDEA", "DESEDE"); 4683 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator.TDEA", "DESEDE"); 4684 + // BEGIN android-removed 4685 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator.TDEA", "DESEDE"); 4686 + // END android-removed 4687 provider.addAlgorithm("Alg.Alias.SecretKeyFactory.TDEA", "DESEDE"); 4688 4689 if (provider.hasAlgorithm("MessageDigest", "SHA-1")) 4690 { 4691 provider.addAlgorithm("Cipher.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", PREFIX + "$PBEWithSHAAndDES3Key"); 4692 - provider.addAlgorithm("Cipher.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", PREFIX + "$BrokePBEWithSHAAndDES3Key"); 4693 - provider.addAlgorithm("Cipher.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", PREFIX + "$OldPBEWithSHAAndDES3Key"); 4694 + // BEGIN android-removed 4695 + // provider.addAlgorithm("Cipher.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", PREFIX + "$BrokePBEWithSHAAndDES3Key"); 4696 + // provider.addAlgorithm("Cipher.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", PREFIX + "$OldPBEWithSHAAndDES3Key"); 4697 + // END android-removed 4698 provider.addAlgorithm("Cipher.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", PREFIX + "$PBEWithSHAAndDES2Key"); 4699 - provider.addAlgorithm("Cipher.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", PREFIX + "$BrokePBEWithSHAAndDES2Key"); 4700 + // BEGIN android-removed 4701 + // provider.addAlgorithm("Cipher.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", PREFIX + "$BrokePBEWithSHAAndDES2Key"); 4702 + // END android-removed 4703 provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithSHAAnd3_KeyTripleDES_CBC, "PBEWITHSHAAND3-KEYTRIPLEDES-CBC"); 4704 provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithSHAAnd2_KeyTripleDES_CBC, "PBEWITHSHAAND2-KEYTRIPLEDES-CBC"); 4705 provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA1ANDDESEDE", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC"); 4706 @@ -388,31 +420,37 @@ 4707 } 4708 4709 provider.addAlgorithm("KeyGenerator.DESEDE", PREFIX + "$KeyGenerator"); 4710 - provider.addAlgorithm("KeyGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, PREFIX + "$KeyGenerator3"); 4711 - provider.addAlgorithm("KeyGenerator.DESEDEWRAP", PREFIX + "$KeyGenerator"); 4712 + // BEGIN android-removed 4713 + // provider.addAlgorithm("KeyGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, PREFIX + "$KeyGenerator3"); 4714 + // provider.addAlgorithm("KeyGenerator.DESEDEWRAP", PREFIX + "$KeyGenerator"); 4715 + // END android-removed 4716 4717 provider.addAlgorithm("SecretKeyFactory.DESEDE", PREFIX + "$KeyFactory"); 4718 4719 - provider.addAlgorithm("Mac.DESEDECMAC", PREFIX + "$CMAC"); 4720 - provider.addAlgorithm("Mac.DESEDEMAC", PREFIX + "$CBCMAC"); 4721 - provider.addAlgorithm("Alg.Alias.Mac.DESEDE", "DESEDEMAC"); 4722 - 4723 - provider.addAlgorithm("Mac.DESEDEMAC/CFB8", PREFIX + "$DESedeCFB8"); 4724 - provider.addAlgorithm("Alg.Alias.Mac.DESEDE/CFB8", "DESEDEMAC/CFB8"); 4725 - 4726 - provider.addAlgorithm("Mac.DESEDEMAC64", PREFIX + "$DESede64"); 4727 - provider.addAlgorithm("Alg.Alias.Mac.DESEDE64", "DESEDEMAC64"); 4728 - 4729 - provider.addAlgorithm("Mac.DESEDEMAC64WITHISO7816-4PADDING", PREFIX + "$DESede64with7816d4"); 4730 - provider.addAlgorithm("Alg.Alias.Mac.DESEDE64WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 4731 - provider.addAlgorithm("Alg.Alias.Mac.DESEDEISO9797ALG1MACWITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 4732 - provider.addAlgorithm("Alg.Alias.Mac.DESEDEISO9797ALG1WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 4733 + // BEGIN android-removed 4734 + // provider.addAlgorithm("Mac.DESEDECMAC", PREFIX + "$CMAC"); 4735 + // provider.addAlgorithm("Mac.DESEDEMAC", PREFIX + "$CBCMAC"); 4736 + // provider.addAlgorithm("Alg.Alias.Mac.DESEDE", "DESEDEMAC"); 4737 + // 4738 + // provider.addAlgorithm("Mac.DESEDEMAC/CFB8", PREFIX + "$DESedeCFB8"); 4739 + // provider.addAlgorithm("Alg.Alias.Mac.DESEDE/CFB8", "DESEDEMAC/CFB8"); 4740 + // 4741 + // provider.addAlgorithm("Mac.DESEDEMAC64", PREFIX + "$DESede64"); 4742 + // provider.addAlgorithm("Alg.Alias.Mac.DESEDE64", "DESEDEMAC64"); 4743 + // 4744 + // provider.addAlgorithm("Mac.DESEDEMAC64WITHISO7816-4PADDING", PREFIX + "$DESede64with7816d4"); 4745 + // provider.addAlgorithm("Alg.Alias.Mac.DESEDE64WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 4746 + // provider.addAlgorithm("Alg.Alias.Mac.DESEDEISO9797ALG1MACWITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 4747 + // provider.addAlgorithm("Alg.Alias.Mac.DESEDEISO9797ALG1WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 4748 + // END android-removed 4749 4750 provider.addAlgorithm("AlgorithmParameters.DESEDE", PACKAGE + ".util.IvAlgorithmParameters"); 4751 provider.addAlgorithm("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.des_EDE3_CBC, "DESEDE"); 4752 4753 - provider.addAlgorithm("AlgorithmParameterGenerator.DESEDE", PREFIX + "$AlgParamGen"); 4754 - provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, "DESEDE"); 4755 + // BEGIN android-removed 4756 + // provider.addAlgorithm("AlgorithmParameterGenerator.DESEDE", PREFIX + "$AlgParamGen"); 4757 + // provider.addAlgorithm("Alg.Alias.AlgorithmParameterGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, "DESEDE"); 4758 + // END android-removed 4759 4760 provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", PREFIX + "$PBEWithSHAAndDES3KeyFactory"); 4761 provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", PREFIX + "$PBEWithSHAAndDES2KeyFactory"); 4762 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/RC2.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/RC2.java 4763 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/RC2.java 2013-05-31 21:16:46.000000000 +0000 4764 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/RC2.java 2013-05-25 02:14:15.000000000 +0000 4765 @@ -12,24 +12,34 @@ 4766 4767 import org.bouncycastle.asn1.ASN1Primitive; 4768 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 4769 -import org.bouncycastle.asn1.pkcs.RC2CBCParameter; 4770 -import org.bouncycastle.crypto.CipherKeyGenerator; 4771 +// BEGIN android-removed 4772 +// import org.bouncycastle.asn1.pkcs.RC2CBCParameter; 4773 +// import org.bouncycastle.crypto.CipherKeyGenerator; 4774 +// END android-removed 4775 import org.bouncycastle.crypto.engines.RC2Engine; 4776 -import org.bouncycastle.crypto.engines.RC2WrapEngine; 4777 -import org.bouncycastle.crypto.macs.CBCBlockCipherMac; 4778 -import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 4779 +// BEGIN android-removed 4780 +// import org.bouncycastle.crypto.engines.RC2WrapEngine; 4781 +// import org.bouncycastle.crypto.macs.CBCBlockCipherMac; 4782 +// import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 4783 +// END android-removed 4784 import org.bouncycastle.crypto.modes.CBCBlockCipher; 4785 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 4786 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator; 4787 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameters; 4788 +// BEGIN android-removed 4789 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator; 4790 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameters; 4791 +// END android-removed 4792 import org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher; 4793 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 4794 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 4795 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher; 4796 +// BEGIN android-removed 4797 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 4798 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 4799 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher; 4800 +// END android-removed 4801 import org.bouncycastle.jcajce.provider.symmetric.util.PBESecretKeyFactory; 4802 import org.bouncycastle.jcajce.provider.util.AlgorithmProvider; 4803 import org.bouncycastle.jce.provider.BouncyCastleProvider; 4804 -import org.bouncycastle.util.Arrays; 4805 +// BEGIN android-removed 4806 +// import org.bouncycastle.util.Arrays; 4807 +// END android-removed 4808 4809 public final class RC2 4810 { 4811 @@ -37,59 +47,61 @@ 4812 { 4813 } 4814 4815 - /** 4816 - * RC2 4817 - */ 4818 - static public class ECB 4819 - extends BaseBlockCipher 4820 - { 4821 - public ECB() 4822 - { 4823 - super(new RC2Engine()); 4824 - } 4825 - } 4826 - 4827 - /** 4828 - * RC2CBC 4829 - */ 4830 - static public class CBC 4831 - extends BaseBlockCipher 4832 - { 4833 - public CBC() 4834 - { 4835 - super(new CBCBlockCipher(new RC2Engine()), 64); 4836 - } 4837 - } 4838 - 4839 - public static class Wrap 4840 - extends BaseWrapCipher 4841 - { 4842 - public Wrap() 4843 - { 4844 - super(new RC2WrapEngine()); 4845 - } 4846 - } 4847 - 4848 - /** 4849 - * RC2 4850 - */ 4851 - public static class CBCMAC 4852 - extends BaseMac 4853 - { 4854 - public CBCMAC() 4855 - { 4856 - super(new CBCBlockCipherMac(new RC2Engine())); 4857 - } 4858 - } 4859 - 4860 - public static class CFB8MAC 4861 - extends BaseMac 4862 - { 4863 - public CFB8MAC() 4864 - { 4865 - super(new CFBBlockCipherMac(new RC2Engine())); 4866 - } 4867 - } 4868 + // BEGIN android-removed 4869 + // /** 4870 + // * RC2 4871 + // */ 4872 + // static public class ECB 4873 + // extends BaseBlockCipher 4874 + // { 4875 + // public ECB() 4876 + // { 4877 + // super(new RC2Engine()); 4878 + // } 4879 + // } 4880 + // 4881 + // /** 4882 + // * RC2CBC 4883 + // */ 4884 + // static public class CBC 4885 + // extends BaseBlockCipher 4886 + // { 4887 + // public CBC() 4888 + // { 4889 + // super(new CBCBlockCipher(new RC2Engine()), 64); 4890 + // } 4891 + // } 4892 + // 4893 + // public static class Wrap 4894 + // extends BaseWrapCipher 4895 + // { 4896 + // public Wrap() 4897 + // { 4898 + // super(new RC2WrapEngine()); 4899 + // } 4900 + // } 4901 + // 4902 + // /** 4903 + // * RC2 4904 + // */ 4905 + // public static class CBCMAC 4906 + // extends BaseMac 4907 + // { 4908 + // public CBCMAC() 4909 + // { 4910 + // super(new CBCBlockCipherMac(new RC2Engine())); 4911 + // } 4912 + // } 4913 + // 4914 + // public static class CFB8MAC 4915 + // extends BaseMac 4916 + // { 4917 + // public CFB8MAC() 4918 + // { 4919 + // super(new CFBBlockCipherMac(new RC2Engine())); 4920 + // } 4921 + // } 4922 + // END android-removed 4923 4924 /** 4925 * PBEWithSHA1AndRC2 4926 @@ -175,17 +187,19 @@ 4927 } 4928 } 4929 4930 - /** 4931 - * PBEWithMD2AndRC2 4932 - */ 4933 - static public class PBEWithMD2KeyFactory 4934 - extends PBESecretKeyFactory 4935 - { 4936 - public PBEWithMD2KeyFactory() 4937 - { 4938 - super("PBEwithMD2andRC2", PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, true, PKCS5S1, MD2, 64, 64); 4939 - } 4940 - } 4941 + // BEGIN android-removed 4942 + // /** 4943 + // * PBEWithMD2AndRC2 4944 + // */ 4945 + // static public class PBEWithMD2KeyFactory 4946 + // extends PBESecretKeyFactory 4947 + // { 4948 + // public PBEWithMD2KeyFactory() 4949 + // { 4950 + // super("PBEwithMD2andRC2", PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, true, PKCS5S1, MD2, 64, 64); 4951 + // } 4952 + // } 4953 + // END android-removed 4954 4955 /** 4956 * PBEWithMD5AndRC2 4957 @@ -199,247 +213,249 @@ 4958 } 4959 } 4960 4961 - public static class AlgParamGen 4962 - extends BaseAlgorithmParameterGenerator 4963 - { 4964 - RC2ParameterSpec spec = null; 4965 - 4966 - protected void engineInit( 4967 - AlgorithmParameterSpec genParamSpec, 4968 - SecureRandom random) 4969 - throws InvalidAlgorithmParameterException 4970 - { 4971 - if (genParamSpec instanceof RC2ParameterSpec) 4972 - { 4973 - spec = (RC2ParameterSpec)genParamSpec; 4974 - return; 4975 - } 4976 - 4977 - throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for RC2 parameter generation."); 4978 - } 4979 - 4980 - protected AlgorithmParameters engineGenerateParameters() 4981 - { 4982 - AlgorithmParameters params; 4983 - 4984 - if (spec == null) 4985 - { 4986 - byte[] iv = new byte[8]; 4987 - 4988 - if (random == null) 4989 - { 4990 - random = new SecureRandom(); 4991 - } 4992 - 4993 - random.nextBytes(iv); 4994 - 4995 - try 4996 - { 4997 - params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 4998 - params.init(new IvParameterSpec(iv)); 4999 - } 5000 - catch (Exception e) 5001 - { 5002 - throw new RuntimeException(e.getMessage()); 5003 - } 5004 - } 5005 - else 5006 - { 5007 - try 5008 - { 5009 - params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 5010 - params.init(spec); 5011 - } 5012 - catch (Exception e) 5013 - { 5014 - throw new RuntimeException(e.getMessage()); 5015 - } 5016 - } 5017 - 5018 - return params; 5019 - } 5020 - } 5021 - 5022 - public static class KeyGenerator 5023 - extends BaseKeyGenerator 5024 - { 5025 - public KeyGenerator() 5026 - { 5027 - super("RC2", 128, new CipherKeyGenerator()); 5028 - } 5029 - } 5030 - 5031 - public static class AlgParams 5032 - extends BaseAlgorithmParameters 5033 - { 5034 - private static final short[] table = { 5035 - 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, 5036 - 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 5037 - 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, 5038 - 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c, 5039 - 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 5040 - 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, 5041 - 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e, 5042 - 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 5043 - 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, 5044 - 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3, 5045 - 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 5046 - 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, 5047 - 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5, 5048 - 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 5049 - 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, 5050 - 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab 5051 - }; 5052 - 5053 - private static final short[] ekb = { 5054 - 0x5d, 0xbe, 0x9b, 0x8b, 0x11, 0x99, 0x6e, 0x4d, 0x59, 0xf3, 0x85, 0xa6, 0x3f, 0xb7, 0x83, 0xc5, 5055 - 0xe4, 0x73, 0x6b, 0x3a, 0x68, 0x5a, 0xc0, 0x47, 0xa0, 0x64, 0x34, 0x0c, 0xf1, 0xd0, 0x52, 0xa5, 5056 - 0xb9, 0x1e, 0x96, 0x43, 0x41, 0xd8, 0xd4, 0x2c, 0xdb, 0xf8, 0x07, 0x77, 0x2a, 0xca, 0xeb, 0xef, 5057 - 0x10, 0x1c, 0x16, 0x0d, 0x38, 0x72, 0x2f, 0x89, 0xc1, 0xf9, 0x80, 0xc4, 0x6d, 0xae, 0x30, 0x3d, 5058 - 0xce, 0x20, 0x63, 0xfe, 0xe6, 0x1a, 0xc7, 0xb8, 0x50, 0xe8, 0x24, 0x17, 0xfc, 0x25, 0x6f, 0xbb, 5059 - 0x6a, 0xa3, 0x44, 0x53, 0xd9, 0xa2, 0x01, 0xab, 0xbc, 0xb6, 0x1f, 0x98, 0xee, 0x9a, 0xa7, 0x2d, 5060 - 0x4f, 0x9e, 0x8e, 0xac, 0xe0, 0xc6, 0x49, 0x46, 0x29, 0xf4, 0x94, 0x8a, 0xaf, 0xe1, 0x5b, 0xc3, 5061 - 0xb3, 0x7b, 0x57, 0xd1, 0x7c, 0x9c, 0xed, 0x87, 0x40, 0x8c, 0xe2, 0xcb, 0x93, 0x14, 0xc9, 0x61, 5062 - 0x2e, 0xe5, 0xcc, 0xf6, 0x5e, 0xa8, 0x5c, 0xd6, 0x75, 0x8d, 0x62, 0x95, 0x58, 0x69, 0x76, 0xa1, 5063 - 0x4a, 0xb5, 0x55, 0x09, 0x78, 0x33, 0x82, 0xd7, 0xdd, 0x79, 0xf5, 0x1b, 0x0b, 0xde, 0x26, 0x21, 5064 - 0x28, 0x74, 0x04, 0x97, 0x56, 0xdf, 0x3c, 0xf0, 0x37, 0x39, 0xdc, 0xff, 0x06, 0xa4, 0xea, 0x42, 5065 - 0x08, 0xda, 0xb4, 0x71, 0xb0, 0xcf, 0x12, 0x7a, 0x4e, 0xfa, 0x6c, 0x1d, 0x84, 0x00, 0xc8, 0x7f, 5066 - 0x91, 0x45, 0xaa, 0x2b, 0xc2, 0xb1, 0x8f, 0xd5, 0xba, 0xf2, 0xad, 0x19, 0xb2, 0x67, 0x36, 0xf7, 5067 - 0x0f, 0x0a, 0x92, 0x7d, 0xe3, 0x9d, 0xe9, 0x90, 0x3e, 0x23, 0x27, 0x66, 0x13, 0xec, 0x81, 0x15, 5068 - 0xbd, 0x22, 0xbf, 0x9f, 0x7e, 0xa9, 0x51, 0x4b, 0x4c, 0xfb, 0x02, 0xd3, 0x70, 0x86, 0x31, 0xe7, 5069 - 0x3b, 0x05, 0x03, 0x54, 0x60, 0x48, 0x65, 0x18, 0xd2, 0xcd, 0x5f, 0x32, 0x88, 0x0e, 0x35, 0xfd 5070 - }; 5071 - 5072 - private byte[] iv; 5073 - private int parameterVersion = 58; 5074 - 5075 - protected byte[] engineGetEncoded() 5076 - { 5077 - return Arrays.clone(iv); 5078 - } 5079 - 5080 - protected byte[] engineGetEncoded( 5081 - String format) 5082 - throws IOException 5083 - { 5084 - if (this.isASN1FormatString(format)) 5085 - { 5086 - if (parameterVersion == -1) 5087 - { 5088 - return new RC2CBCParameter(engineGetEncoded()).getEncoded(); 5089 - } 5090 - else 5091 - { 5092 - return new RC2CBCParameter(parameterVersion, engineGetEncoded()).getEncoded(); 5093 - } 5094 - } 5095 - 5096 - if (format.equals("RAW")) 5097 - { 5098 - return engineGetEncoded(); 5099 - } 5100 - 5101 - return null; 5102 - } 5103 - 5104 - protected AlgorithmParameterSpec localEngineGetParameterSpec( 5105 - Class paramSpec) 5106 - throws InvalidParameterSpecException 5107 - { 5108 - if (paramSpec == RC2ParameterSpec.class) 5109 - { 5110 - if (parameterVersion != -1) 5111 - { 5112 - if (parameterVersion < 256) 5113 - { 5114 - return new RC2ParameterSpec(ekb[parameterVersion], iv); 5115 - } 5116 - else 5117 - { 5118 - return new RC2ParameterSpec(parameterVersion, iv); 5119 - } 5120 - } 5121 - } 5122 - 5123 - if (paramSpec == IvParameterSpec.class) 5124 - { 5125 - return new IvParameterSpec(iv); 5126 - } 5127 - 5128 - throw new InvalidParameterSpecException("unknown parameter spec passed to RC2 parameters object."); 5129 - } 5130 - 5131 - protected void engineInit( 5132 - AlgorithmParameterSpec paramSpec) 5133 - throws InvalidParameterSpecException 5134 - { 5135 - if (paramSpec instanceof IvParameterSpec) 5136 - { 5137 - this.iv = ((IvParameterSpec)paramSpec).getIV(); 5138 - } 5139 - else if (paramSpec instanceof RC2ParameterSpec) 5140 - { 5141 - int effKeyBits = ((RC2ParameterSpec)paramSpec).getEffectiveKeyBits(); 5142 - if (effKeyBits != -1) 5143 - { 5144 - if (effKeyBits < 256) 5145 - { 5146 - parameterVersion = table[effKeyBits]; 5147 - } 5148 - else 5149 - { 5150 - parameterVersion = effKeyBits; 5151 - } 5152 - } 5153 - 5154 - this.iv = ((RC2ParameterSpec)paramSpec).getIV(); 5155 - } 5156 - else 5157 - { 5158 - throw new InvalidParameterSpecException("IvParameterSpec or RC2ParameterSpec required to initialise a RC2 parameters algorithm parameters object"); 5159 - } 5160 - } 5161 - 5162 - protected void engineInit( 5163 - byte[] params) 5164 - throws IOException 5165 - { 5166 - this.iv = Arrays.clone(params); 5167 - } 5168 - 5169 - protected void engineInit( 5170 - byte[] params, 5171 - String format) 5172 - throws IOException 5173 - { 5174 - if (this.isASN1FormatString(format)) 5175 - { 5176 - RC2CBCParameter p = RC2CBCParameter.getInstance(ASN1Primitive.fromByteArray(params)); 5177 - 5178 - if (p.getRC2ParameterVersion() != null) 5179 - { 5180 - parameterVersion = p.getRC2ParameterVersion().intValue(); 5181 - } 5182 - 5183 - iv = p.getIV(); 5184 - 5185 - return; 5186 - } 5187 - 5188 - if (format.equals("RAW")) 5189 - { 5190 - engineInit(params); 5191 - return; 5192 - } 5193 - 5194 - throw new IOException("Unknown parameters format in IV parameters object"); 5195 - } 5196 - 5197 - protected String engineToString() 5198 - { 5199 - return "RC2 Parameters"; 5200 - } 5201 - } 5202 + // BEGIN android-removed 5203 + // public static class AlgParamGen 5204 + // extends BaseAlgorithmParameterGenerator 5205 + // { 5206 + // RC2ParameterSpec spec = null; 5207 + // 5208 + // protected void engineInit( 5209 + // AlgorithmParameterSpec genParamSpec, 5210 + // SecureRandom random) 5211 + // throws InvalidAlgorithmParameterException 5212 + // { 5213 + // if (genParamSpec instanceof RC2ParameterSpec) 5214 + // { 5215 + // spec = (RC2ParameterSpec)genParamSpec; 5216 + // return; 5217 + // } 5218 + // 5219 + // throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for RC2 parameter generation."); 5220 + // } 5221 + // 5222 + // protected AlgorithmParameters engineGenerateParameters() 5223 + // { 5224 + // AlgorithmParameters params; 5225 + // 5226 + // if (spec == null) 5227 + // { 5228 + // byte[] iv = new byte[8]; 5229 + // 5230 + // if (random == null) 5231 + // { 5232 + // random = new SecureRandom(); 5233 + // } 5234 + // 5235 + // random.nextBytes(iv); 5236 + // 5237 + // try 5238 + // { 5239 + // params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 5240 + // params.init(new IvParameterSpec(iv)); 5241 + // } 5242 + // catch (Exception e) 5243 + // { 5244 + // throw new RuntimeException(e.getMessage()); 5245 + // } 5246 + // } 5247 + // else 5248 + // { 5249 + // try 5250 + // { 5251 + // params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 5252 + // params.init(spec); 5253 + // } 5254 + // catch (Exception e) 5255 + // { 5256 + // throw new RuntimeException(e.getMessage()); 5257 + // } 5258 + // } 5259 + // 5260 + // return params; 5261 + // } 5262 + // } 5263 + // 5264 + // public static class KeyGenerator 5265 + // extends BaseKeyGenerator 5266 + // { 5267 + // public KeyGenerator() 5268 + // { 5269 + // super("RC2", 128, new CipherKeyGenerator()); 5270 + // } 5271 + // } 5272 + // 5273 + // public static class AlgParams 5274 + // extends BaseAlgorithmParameters 5275 + // { 5276 + // private static final short[] table = { 5277 + // 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, 5278 + // 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 5279 + // 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, 5280 + // 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c, 5281 + // 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 5282 + // 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, 5283 + // 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e, 5284 + // 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 5285 + // 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, 5286 + // 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3, 5287 + // 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 5288 + // 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, 5289 + // 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5, 5290 + // 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 5291 + // 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, 5292 + // 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab 5293 + // }; 5294 + // 5295 + // private static final short[] ekb = { 5296 + // 0x5d, 0xbe, 0x9b, 0x8b, 0x11, 0x99, 0x6e, 0x4d, 0x59, 0xf3, 0x85, 0xa6, 0x3f, 0xb7, 0x83, 0xc5, 5297 + // 0xe4, 0x73, 0x6b, 0x3a, 0x68, 0x5a, 0xc0, 0x47, 0xa0, 0x64, 0x34, 0x0c, 0xf1, 0xd0, 0x52, 0xa5, 5298 + // 0xb9, 0x1e, 0x96, 0x43, 0x41, 0xd8, 0xd4, 0x2c, 0xdb, 0xf8, 0x07, 0x77, 0x2a, 0xca, 0xeb, 0xef, 5299 + // 0x10, 0x1c, 0x16, 0x0d, 0x38, 0x72, 0x2f, 0x89, 0xc1, 0xf9, 0x80, 0xc4, 0x6d, 0xae, 0x30, 0x3d, 5300 + // 0xce, 0x20, 0x63, 0xfe, 0xe6, 0x1a, 0xc7, 0xb8, 0x50, 0xe8, 0x24, 0x17, 0xfc, 0x25, 0x6f, 0xbb, 5301 + // 0x6a, 0xa3, 0x44, 0x53, 0xd9, 0xa2, 0x01, 0xab, 0xbc, 0xb6, 0x1f, 0x98, 0xee, 0x9a, 0xa7, 0x2d, 5302 + // 0x4f, 0x9e, 0x8e, 0xac, 0xe0, 0xc6, 0x49, 0x46, 0x29, 0xf4, 0x94, 0x8a, 0xaf, 0xe1, 0x5b, 0xc3, 5303 + // 0xb3, 0x7b, 0x57, 0xd1, 0x7c, 0x9c, 0xed, 0x87, 0x40, 0x8c, 0xe2, 0xcb, 0x93, 0x14, 0xc9, 0x61, 5304 + // 0x2e, 0xe5, 0xcc, 0xf6, 0x5e, 0xa8, 0x5c, 0xd6, 0x75, 0x8d, 0x62, 0x95, 0x58, 0x69, 0x76, 0xa1, 5305 + // 0x4a, 0xb5, 0x55, 0x09, 0x78, 0x33, 0x82, 0xd7, 0xdd, 0x79, 0xf5, 0x1b, 0x0b, 0xde, 0x26, 0x21, 5306 + // 0x28, 0x74, 0x04, 0x97, 0x56, 0xdf, 0x3c, 0xf0, 0x37, 0x39, 0xdc, 0xff, 0x06, 0xa4, 0xea, 0x42, 5307 + // 0x08, 0xda, 0xb4, 0x71, 0xb0, 0xcf, 0x12, 0x7a, 0x4e, 0xfa, 0x6c, 0x1d, 0x84, 0x00, 0xc8, 0x7f, 5308 + // 0x91, 0x45, 0xaa, 0x2b, 0xc2, 0xb1, 0x8f, 0xd5, 0xba, 0xf2, 0xad, 0x19, 0xb2, 0x67, 0x36, 0xf7, 5309 + // 0x0f, 0x0a, 0x92, 0x7d, 0xe3, 0x9d, 0xe9, 0x90, 0x3e, 0x23, 0x27, 0x66, 0x13, 0xec, 0x81, 0x15, 5310 + // 0xbd, 0x22, 0xbf, 0x9f, 0x7e, 0xa9, 0x51, 0x4b, 0x4c, 0xfb, 0x02, 0xd3, 0x70, 0x86, 0x31, 0xe7, 5311 + // 0x3b, 0x05, 0x03, 0x54, 0x60, 0x48, 0x65, 0x18, 0xd2, 0xcd, 0x5f, 0x32, 0x88, 0x0e, 0x35, 0xfd 5312 + // }; 5313 + // 5314 + // private byte[] iv; 5315 + // private int parameterVersion = 58; 5316 + // 5317 + // protected byte[] engineGetEncoded() 5318 + // { 5319 + // return Arrays.clone(iv); 5320 + // } 5321 + // 5322 + // protected byte[] engineGetEncoded( 5323 + // String format) 5324 + // throws IOException 5325 + // { 5326 + // if (this.isASN1FormatString(format)) 5327 + // { 5328 + // if (parameterVersion == -1) 5329 + // { 5330 + // return new RC2CBCParameter(engineGetEncoded()).getEncoded(); 5331 + // } 5332 + // else 5333 + // { 5334 + // return new RC2CBCParameter(parameterVersion, engineGetEncoded()).getEncoded(); 5335 + // } 5336 + // } 5337 + // 5338 + // if (format.equals("RAW")) 5339 + // { 5340 + // return engineGetEncoded(); 5341 + // } 5342 + // 5343 + // return null; 5344 + // } 5345 + // 5346 + // protected AlgorithmParameterSpec localEngineGetParameterSpec( 5347 + // Class paramSpec) 5348 + // throws InvalidParameterSpecException 5349 + // { 5350 + // if (paramSpec == RC2ParameterSpec.class) 5351 + // { 5352 + // if (parameterVersion != -1) 5353 + // { 5354 + // if (parameterVersion < 256) 5355 + // { 5356 + // return new RC2ParameterSpec(ekb[parameterVersion], iv); 5357 + // } 5358 + // else 5359 + // { 5360 + // return new RC2ParameterSpec(parameterVersion, iv); 5361 + // } 5362 + // } 5363 + // } 5364 + // 5365 + // if (paramSpec == IvParameterSpec.class) 5366 + // { 5367 + // return new IvParameterSpec(iv); 5368 + // } 5369 + // 5370 + // throw new InvalidParameterSpecException("unknown parameter spec passed to RC2 parameters object."); 5371 + // } 5372 + // 5373 + // protected void engineInit( 5374 + // AlgorithmParameterSpec paramSpec) 5375 + // throws InvalidParameterSpecException 5376 + // { 5377 + // if (paramSpec instanceof IvParameterSpec) 5378 + // { 5379 + // this.iv = ((IvParameterSpec)paramSpec).getIV(); 5380 + // } 5381 + // else if (paramSpec instanceof RC2ParameterSpec) 5382 + // { 5383 + // int effKeyBits = ((RC2ParameterSpec)paramSpec).getEffectiveKeyBits(); 5384 + // if (effKeyBits != -1) 5385 + // { 5386 + // if (effKeyBits < 256) 5387 + // { 5388 + // parameterVersion = table[effKeyBits]; 5389 + // } 5390 + // else 5391 + // { 5392 + // parameterVersion = effKeyBits; 5393 + // } 5394 + // } 5395 + // 5396 + // this.iv = ((RC2ParameterSpec)paramSpec).getIV(); 5397 + // } 5398 + // else 5399 + // { 5400 + // throw new InvalidParameterSpecException("IvParameterSpec or RC2ParameterSpec required to initialise a RC2 parameters algorithm parameters object"); 5401 + // } 5402 + // } 5403 + // 5404 + // protected void engineInit( 5405 + // byte[] params) 5406 + // throws IOException 5407 + // { 5408 + // this.iv = Arrays.clone(params); 5409 + // } 5410 + // 5411 + // protected void engineInit( 5412 + // byte[] params, 5413 + // String format) 5414 + // throws IOException 5415 + // { 5416 + // if (this.isASN1FormatString(format)) 5417 + // { 5418 + // RC2CBCParameter p = RC2CBCParameter.getInstance(ASN1Primitive.fromByteArray(params)); 5419 + // 5420 + // if (p.getRC2ParameterVersion() != null) 5421 + // { 5422 + // parameterVersion = p.getRC2ParameterVersion().intValue(); 5423 + // } 5424 + // 5425 + // iv = p.getIV(); 5426 + // 5427 + // return; 5428 + // } 5429 + // 5430 + // if (format.equals("RAW")) 5431 + // { 5432 + // engineInit(params); 5433 + // return; 5434 + // } 5435 + // 5436 + // throw new IOException("Unknown parameters format in IV parameters object"); 5437 + // } 5438 + // 5439 + // protected String engineToString() 5440 + // { 5441 + // return "RC2 Parameters"; 5442 + // } 5443 + // } 5444 + // END android-removed 5445 5446 public static class Mappings 5447 extends AlgorithmProvider 5448 @@ -453,32 +469,36 @@ 5449 public void configure(ConfigurableProvider provider) 5450 { 5451 5452 - provider.addAlgorithm("AlgorithmParameterGenerator.RC2", PREFIX + "$AlgParamGen"); 5453 - provider.addAlgorithm("AlgorithmParameterGenerator.1.2.840.113549.3.2", PREFIX + "$AlgParamGen"); 5454 - 5455 - provider.addAlgorithm("KeyGenerator.RC2", PREFIX + "$KeyGenerator"); 5456 - provider.addAlgorithm("KeyGenerator.1.2.840.113549.3.2", PREFIX + "$KeyGenerator"); 5457 - 5458 - provider.addAlgorithm("AlgorithmParameters.RC2", PREFIX + "$AlgParams"); 5459 - provider.addAlgorithm("AlgorithmParameters.1.2.840.113549.3.2", PREFIX + "$AlgParams"); 5460 - 5461 - provider.addAlgorithm("Cipher.RC2", PREFIX + "$ECB"); 5462 - provider.addAlgorithm("Cipher.RC2WRAP", PREFIX + "$Wrap"); 5463 - provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.id_alg_CMSRC2wrap, "RC2WRAP"); 5464 - provider.addAlgorithm("Cipher.1.2.840.113549.3.2", PREFIX + "$CBC"); 5465 - 5466 - provider.addAlgorithm("Mac.RC2MAC", PREFIX + "$CBCMAC"); 5467 - provider.addAlgorithm("Alg.Alias.Mac.RC2", "RC2MAC"); 5468 - provider.addAlgorithm("Mac.RC2MAC/CFB8", PREFIX + "$CFB8MAC"); 5469 - provider.addAlgorithm("Alg.Alias.Mac.RC2/CFB8", "RC2MAC/CFB8"); 5470 - 5471 - provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDRC2-CBC", "PBEWITHMD2ANDRC2"); 5472 + // BEGIN android-removed 5473 + // provider.addAlgorithm("AlgorithmParameterGenerator.RC2", PREFIX + "$AlgParamGen"); 5474 + // provider.addAlgorithm("AlgorithmParameterGenerator.1.2.840.113549.3.2", PREFIX + "$AlgParamGen"); 5475 + // 5476 + // provider.addAlgorithm("KeyGenerator.RC2", PREFIX + "$KeyGenerator"); 5477 + // provider.addAlgorithm("KeyGenerator.1.2.840.113549.3.2", PREFIX + "$KeyGenerator"); 5478 + // 5479 + // provider.addAlgorithm("AlgorithmParameters.RC2", PREFIX + "$AlgParams"); 5480 + // provider.addAlgorithm("AlgorithmParameters.1.2.840.113549.3.2", PREFIX + "$AlgParams"); 5481 + // 5482 + // provider.addAlgorithm("Cipher.RC2", PREFIX + "$ECB"); 5483 + // provider.addAlgorithm("Cipher.RC2WRAP", PREFIX + "$Wrap"); 5484 + // provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.id_alg_CMSRC2wrap, "RC2WRAP"); 5485 + // provider.addAlgorithm("Cipher.1.2.840.113549.3.2", PREFIX + "$CBC"); 5486 + // 5487 + // provider.addAlgorithm("Mac.RC2MAC", PREFIX + "$CBCMAC"); 5488 + // provider.addAlgorithm("Alg.Alias.Mac.RC2", "RC2MAC"); 5489 + // provider.addAlgorithm("Mac.RC2MAC/CFB8", PREFIX + "$CFB8MAC"); 5490 + // provider.addAlgorithm("Alg.Alias.Mac.RC2/CFB8", "RC2MAC/CFB8"); 5491 + // 5492 + // provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDRC2-CBC", "PBEWITHMD2ANDRC2"); 5493 + // END android-removed 5494 5495 provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDRC2-CBC", "PBEWITHMD5ANDRC2"); 5496 5497 provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDRC2-CBC", "PBEWITHSHA1ANDRC2"); 5498 5499 - provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 5500 + // BEGIN android-removed 5501 + // provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 5502 + // END android-removed 5503 5504 provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDRC2"); 5505 5506 @@ -486,14 +506,18 @@ 5507 provider.addAlgorithm("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.5", "PBEWITHSHAAND128BITRC2-CBC"); 5508 provider.addAlgorithm("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.6", "PBEWITHSHAAND40BITRC2-CBC"); 5509 5510 - provider.addAlgorithm("SecretKeyFactory.PBEWITHMD2ANDRC2", PREFIX + "$PBEWithMD2KeyFactory"); 5511 + // BEGIN android-removed 5512 + // provider.addAlgorithm("SecretKeyFactory.PBEWITHMD2ANDRC2", PREFIX + "$PBEWithMD2KeyFactory"); 5513 + // END android-removed 5514 provider.addAlgorithm("SecretKeyFactory.PBEWITHMD5ANDRC2", PREFIX + "$PBEWithMD5KeyFactory"); 5515 provider.addAlgorithm("SecretKeyFactory.PBEWITHSHA1ANDRC2", PREFIX + "$PBEWithSHA1KeyFactory"); 5516 5517 provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND128BITRC2-CBC", PREFIX + "$PBEWithSHAAnd128BitKeyFactory"); 5518 provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND40BITRC2-CBC", PREFIX + "$PBEWithSHAAnd40BitKeyFactory"); 5519 5520 - provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 5521 + // BEGIN android-removed 5522 + // provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 5523 + // END android-removed 5524 5525 provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDRC2"); 5526 5527 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/SymmetricAlgorithmProvider.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/SymmetricAlgorithmProvider.java 5528 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/SymmetricAlgorithmProvider.java 2013-05-31 21:16:46.000000000 +0000 5529 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/SymmetricAlgorithmProvider.java 2013-05-25 02:14:15.000000000 +0000 5530 @@ -6,16 +6,18 @@ 5531 abstract class SymmetricAlgorithmProvider 5532 extends AlgorithmProvider 5533 { 5534 - protected void addGMacAlgorithm( 5535 - ConfigurableProvider provider, 5536 - String algorithm, 5537 - String algorithmClassName, 5538 - String keyGeneratorClassName) 5539 - { 5540 - provider.addAlgorithm("Mac." + algorithm + "-GMAC", algorithmClassName); 5541 - provider.addAlgorithm("Alg.Alias.Mac." + algorithm + "GMAC", algorithm + "-GMAC"); 5542 - 5543 - provider.addAlgorithm("KeyGenerator." + algorithm + "-GMAC", keyGeneratorClassName); 5544 - provider.addAlgorithm("Alg.Alias.KeyGenerator." + algorithm + "GMAC", algorithm + "-GMAC"); 5545 - } 5546 + // BEGIN android-removed 5547 + // protected void addGMacAlgorithm( 5548 + // ConfigurableProvider provider, 5549 + // String algorithm, 5550 + // String algorithmClassName, 5551 + // String keyGeneratorClassName) 5552 + // { 5553 + // provider.addAlgorithm("Mac." + algorithm + "-GMAC", algorithmClassName); 5554 + // provider.addAlgorithm("Alg.Alias.Mac." + algorithm + "GMAC", algorithm + "-GMAC"); 5555 + // 5556 + // provider.addAlgorithm("KeyGenerator." + algorithm + "-GMAC", keyGeneratorClassName); 5557 + // provider.addAlgorithm("Alg.Alias.KeyGenerator." + algorithm + "GMAC", algorithm + "-GMAC"); 5558 + // } 5559 + // END android-removed 5560 } 5561 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/Twofish.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/Twofish.java 5562 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/Twofish.java 2013-05-31 21:16:46.000000000 +0000 5563 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/Twofish.java 2013-05-25 02:14:15.000000000 +0000 5564 @@ -1,17 +1,25 @@ 5565 package org.bouncycastle.jcajce.provider.symmetric; 5566 5567 -import org.bouncycastle.crypto.BlockCipher; 5568 -import org.bouncycastle.crypto.CipherKeyGenerator; 5569 +// BEGIN android-removed 5570 +// import org.bouncycastle.crypto.BlockCipher; 5571 +// import org.bouncycastle.crypto.CipherKeyGenerator; 5572 +// END android-removed 5573 import org.bouncycastle.crypto.engines.TwofishEngine; 5574 -import org.bouncycastle.crypto.macs.GMac; 5575 +// BEGIN android-removed 5576 +// import org.bouncycastle.crypto.macs.GMac; 5577 +// END android-removed 5578 import org.bouncycastle.crypto.modes.CBCBlockCipher; 5579 -import org.bouncycastle.crypto.modes.GCMBlockCipher; 5580 +// BEGIN android-removed 5581 +// import org.bouncycastle.crypto.modes.GCMBlockCipher; 5582 +// END android-removed 5583 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider; 5584 import org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher; 5585 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 5586 -import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 5587 -import org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider; 5588 -import org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters; 5589 +// BEGIN android-removed 5590 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator; 5591 +// import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac; 5592 +// import org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider; 5593 +// import org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters; 5594 +// END android-removed 5595 import org.bouncycastle.jcajce.provider.symmetric.util.PBESecretKeyFactory; 5596 5597 public final class Twofish 5598 @@ -20,38 +28,40 @@ 5599 { 5600 } 5601 5602 - public static class ECB 5603 - extends BaseBlockCipher 5604 - { 5605 - public ECB() 5606 - { 5607 - super(new BlockCipherProvider() 5608 - { 5609 - public BlockCipher get() 5610 - { 5611 - return new TwofishEngine(); 5612 - } 5613 - }); 5614 - } 5615 - } 5616 - 5617 - public static class KeyGen 5618 - extends BaseKeyGenerator 5619 - { 5620 - public KeyGen() 5621 - { 5622 - super("Twofish", 256, new CipherKeyGenerator()); 5623 - } 5624 - } 5625 - 5626 - public static class GMAC 5627 - extends BaseMac 5628 - { 5629 - public GMAC() 5630 - { 5631 - super(new GMac(new GCMBlockCipher(new TwofishEngine()))); 5632 - } 5633 - } 5634 + // BEGIN android-removed 5635 + // public static class ECB 5636 + // extends BaseBlockCipher 5637 + // { 5638 + // public ECB() 5639 + // { 5640 + // super(new BlockCipherProvider() 5641 + // { 5642 + // public BlockCipher get() 5643 + // { 5644 + // return new TwofishEngine(); 5645 + // } 5646 + // }); 5647 + // } 5648 + // } 5649 + // 5650 + // public static class KeyGen 5651 + // extends BaseKeyGenerator 5652 + // { 5653 + // public KeyGen() 5654 + // { 5655 + // super("Twofish", 256, new CipherKeyGenerator()); 5656 + // } 5657 + // } 5658 + // 5659 + // public static class GMAC 5660 + // extends BaseMac 5661 + // { 5662 + // public GMAC() 5663 + // { 5664 + // super(new GMac(new GCMBlockCipher(new TwofishEngine()))); 5665 + // } 5666 + // } 5667 + // END android-removed 5668 5669 /** 5670 * PBEWithSHAAndTwofish-CBC 5671 @@ -77,14 +87,16 @@ 5672 } 5673 } 5674 5675 - public static class AlgParams 5676 - extends IvAlgorithmParameters 5677 - { 5678 - protected String engineToString() 5679 - { 5680 - return "Twofish IV"; 5681 - } 5682 - } 5683 + // BEGIN android-removed 5684 + // public static class AlgParams 5685 + // extends IvAlgorithmParameters 5686 + // { 5687 + // protected String engineToString() 5688 + // { 5689 + // return "Twofish IV"; 5690 + // } 5691 + // } 5692 + // END android-removed 5693 5694 public static class Mappings 5695 extends SymmetricAlgorithmProvider 5696 @@ -97,16 +109,20 @@ 5697 5698 public void configure(ConfigurableProvider provider) 5699 { 5700 - provider.addAlgorithm("Cipher.Twofish", PREFIX + "$ECB"); 5701 - provider.addAlgorithm("KeyGenerator.Twofish", PREFIX + "$KeyGen"); 5702 - provider.addAlgorithm("AlgorithmParameters.Twofish", PREFIX + "$AlgParams"); 5703 + // BEGIN android-removed 5704 + // provider.addAlgorithm("Cipher.Twofish", PREFIX + "$ECB"); 5705 + // provider.addAlgorithm("KeyGenerator.Twofish", PREFIX + "$KeyGen"); 5706 + // provider.addAlgorithm("AlgorithmParameters.Twofish", PREFIX + "$AlgParams"); 5707 + // END android-removed 5708 5709 provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH", "PKCS12PBE"); 5710 provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH-CBC", "PKCS12PBE"); 5711 provider.addAlgorithm("Cipher.PBEWITHSHAANDTWOFISH-CBC", PREFIX + "$PBEWithSHA"); 5712 provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAANDTWOFISH-CBC", PREFIX + "$PBEWithSHAKeyFactory"); 5713 5714 - addGMacAlgorithm(provider, "Twofish", PREFIX + "$GMAC", PREFIX + "$KeyGen"); 5715 + // BEGIN android-removed 5716 + // addGMacAlgorithm(provider, "Twofish", PREFIX + "$GMAC", PREFIX + "$KeyGen"); 5717 + // END android-removed 5718 } 5719 } 5720 } 5721 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java 5722 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java 2013-05-31 21:16:46.000000000 +0000 5723 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java 2013-05-25 02:14:15.000000000 +0000 5724 @@ -17,8 +17,10 @@ 5725 import javax.crypto.ShortBufferException; 5726 import javax.crypto.spec.IvParameterSpec; 5727 import javax.crypto.spec.PBEParameterSpec; 5728 -import javax.crypto.spec.RC2ParameterSpec; 5729 -import javax.crypto.spec.RC5ParameterSpec; 5730 +// BEGIN android-removed 5731 +// import javax.crypto.spec.RC2ParameterSpec; 5732 +// import javax.crypto.spec.RC5ParameterSpec; 5733 +// END android-removed 5734 5735 import org.bouncycastle.crypto.BlockCipher; 5736 import org.bouncycastle.crypto.BufferedBlockCipher; 5737 @@ -31,13 +33,19 @@ 5738 import org.bouncycastle.crypto.modes.CCMBlockCipher; 5739 import org.bouncycastle.crypto.modes.CFBBlockCipher; 5740 import org.bouncycastle.crypto.modes.CTSBlockCipher; 5741 -import org.bouncycastle.crypto.modes.EAXBlockCipher; 5742 +// BEGIN android-removed 5743 +// import org.bouncycastle.crypto.modes.EAXBlockCipher; 5744 +// END android-removed 5745 import org.bouncycastle.crypto.modes.GCMBlockCipher; 5746 -import org.bouncycastle.crypto.modes.GOFBBlockCipher; 5747 -import org.bouncycastle.crypto.modes.OCBBlockCipher; 5748 +// BEGIN android-removed 5749 +// import org.bouncycastle.crypto.modes.GOFBBlockCipher; 5750 +// import org.bouncycastle.crypto.modes.OCBBlockCipher; 5751 +// END android-removed 5752 import org.bouncycastle.crypto.modes.OFBBlockCipher; 5753 -import org.bouncycastle.crypto.modes.OpenPGPCFBBlockCipher; 5754 -import org.bouncycastle.crypto.modes.PGPCFBBlockCipher; 5755 +// BEGIN android-removed 5756 +// import org.bouncycastle.crypto.modes.OpenPGPCFBBlockCipher; 5757 +// import org.bouncycastle.crypto.modes.PGPCFBBlockCipher; 5758 +// END android-removed 5759 import org.bouncycastle.crypto.modes.SICBlockCipher; 5760 import org.bouncycastle.crypto.paddings.BlockCipherPadding; 5761 import org.bouncycastle.crypto.paddings.ISO10126d2Padding; 5762 @@ -49,11 +57,17 @@ 5763 import org.bouncycastle.crypto.params.KeyParameter; 5764 import org.bouncycastle.crypto.params.ParametersWithIV; 5765 import org.bouncycastle.crypto.params.ParametersWithRandom; 5766 -import org.bouncycastle.crypto.params.ParametersWithSBox; 5767 +// BEGIN android-removed 5768 +// import org.bouncycastle.crypto.params.ParametersWithSBox; 5769 +// END android-removed 5770 import org.bouncycastle.crypto.params.RC2Parameters; 5771 -import org.bouncycastle.crypto.params.RC5Parameters; 5772 +// BEGIN android-removed 5773 +// import org.bouncycastle.crypto.params.RC5Parameters; 5774 +// END android-removed 5775 import org.bouncycastle.jce.provider.BouncyCastleProvider; 5776 -import org.bouncycastle.jce.spec.GOST28147ParameterSpec; 5777 +// BEGIN android-removed 5778 +// import org.bouncycastle.jce.spec.GOST28147ParameterSpec; 5779 +// END android-removed 5780 import org.bouncycastle.jce.spec.RepeatedSecretKeySpec; 5781 import org.bouncycastle.util.Strings; 5782 5783 @@ -66,11 +80,15 @@ 5784 // 5785 private Class[] availableSpecs = 5786 { 5787 - RC2ParameterSpec.class, 5788 - RC5ParameterSpec.class, 5789 + // BEGIN android-removed 5790 + // RC2ParameterSpec.class, 5791 + // RC5ParameterSpec.class, 5792 + // END android-removed 5793 IvParameterSpec.class, 5794 PBEParameterSpec.class, 5795 - GOST28147ParameterSpec.class 5796 + // BEGIN android-removed 5797 + // GOST28147ParameterSpec.class 5798 + // END android-removed 5799 }; 5800 5801 private BlockCipher baseEngine; 5802 @@ -235,20 +253,22 @@ 5803 new CFBBlockCipher(baseEngine, 8 * baseEngine.getBlockSize())); 5804 } 5805 } 5806 - else if (modeName.startsWith("PGP")) 5807 - { 5808 - boolean inlineIV = modeName.equalsIgnoreCase("PGPCFBwithIV"); 5809 - 5810 - ivLength = baseEngine.getBlockSize(); 5811 - cipher = new BufferedGenericBlockCipher( 5812 - new PGPCFBBlockCipher(baseEngine, inlineIV)); 5813 - } 5814 - else if (modeName.equalsIgnoreCase("OpenPGPCFB")) 5815 - { 5816 - ivLength = 0; 5817 - cipher = new BufferedGenericBlockCipher( 5818 - new OpenPGPCFBBlockCipher(baseEngine)); 5819 - } 5820 + // BEGIN android-removed 5821 + // else if (modeName.startsWith("PGP")) 5822 + // { 5823 + // boolean inlineIV = modeName.equalsIgnoreCase("PGPCFBwithIV"); 5824 + 5825 + // ivLength = baseEngine.getBlockSize(); 5826 + // cipher = new BufferedGenericBlockCipher( 5827 + // new PGPCFBBlockCipher(baseEngine, inlineIV)); 5828 + // } 5829 + // else if (modeName.equalsIgnoreCase("OpenPGPCFB")) 5830 + // { 5831 + // ivLength = 0; 5832 + // cipher = new BufferedGenericBlockCipher( 5833 + // new OpenPGPCFBBlockCipher(baseEngine)); 5834 + // } 5835 + // END android-removed 5836 else if (modeName.startsWith("SIC")) 5837 { 5838 ivLength = baseEngine.getBlockSize(); 5839 @@ -265,12 +285,14 @@ 5840 cipher = new BufferedGenericBlockCipher(new BufferedBlockCipher( 5841 new SICBlockCipher(baseEngine))); 5842 } 5843 - else if (modeName.startsWith("GOFB")) 5844 - { 5845 - ivLength = baseEngine.getBlockSize(); 5846 - cipher = new BufferedGenericBlockCipher(new BufferedBlockCipher( 5847 - new GOFBBlockCipher(baseEngine))); 5848 - } 5849 + // BEGIN android-removed 5850 + // else if (modeName.startsWith("GOFB")) 5851 + // { 5852 + // ivLength = baseEngine.getBlockSize(); 5853 + // cipher = new BufferedGenericBlockCipher(new BufferedBlockCipher( 5854 + // new GOFBBlockCipher(baseEngine))); 5855 + // } 5856 + // END android-removed 5857 else if (modeName.startsWith("CTS")) 5858 { 5859 ivLength = baseEngine.getBlockSize(); 5860 @@ -281,23 +303,25 @@ 5861 ivLength = baseEngine.getBlockSize(); 5862 cipher = new AEADGenericBlockCipher(new CCMBlockCipher(baseEngine)); 5863 } 5864 - else if (modeName.startsWith("OCB")) 5865 - { 5866 - if (engineProvider != null) 5867 - { 5868 - ivLength = baseEngine.getBlockSize(); 5869 - cipher = new AEADGenericBlockCipher(new OCBBlockCipher(baseEngine, engineProvider.get())); 5870 - } 5871 - else 5872 - { 5873 - throw new NoSuchAlgorithmException("can't support mode " + mode); 5874 - } 5875 - } 5876 - else if (modeName.startsWith("EAX")) 5877 - { 5878 - ivLength = baseEngine.getBlockSize(); 5879 - cipher = new AEADGenericBlockCipher(new EAXBlockCipher(baseEngine)); 5880 - } 5881 + // BEGIN android-removed 5882 + // else if (modeName.startsWith("OCB")) 5883 + // { 5884 + // if (engineProvider != null) 5885 + // { 5886 + // ivLength = baseEngine.getBlockSize(); 5887 + // cipher = new AEADGenericBlockCipher(new OCBBlockCipher(baseEngine, engineProvider.get())); 5888 + // } 5889 + // else 5890 + // { 5891 + // throw new NoSuchAlgorithmException("can't support mode " + mode); 5892 + // } 5893 + // } 5894 + // else if (modeName.startsWith("EAX")) 5895 + // { 5896 + // ivLength = baseEngine.getBlockSize(); 5897 + // cipher = new AEADGenericBlockCipher(new EAXBlockCipher(baseEngine)); 5898 + // } 5899 + // END android-removed 5900 else if (modeName.startsWith("GCM")) 5901 { 5902 ivLength = baseEngine.getBlockSize(); 5903 @@ -471,63 +495,65 @@ 5904 param = new KeyParameter(key.getEncoded()); 5905 } 5906 } 5907 - else if (params instanceof GOST28147ParameterSpec) 5908 - { 5909 - GOST28147ParameterSpec gost28147Param = (GOST28147ParameterSpec)params; 5910 - 5911 - param = new ParametersWithSBox( 5912 - new KeyParameter(key.getEncoded()), ((GOST28147ParameterSpec)params).getSbox()); 5913 - 5914 - if (gost28147Param.getIV() != null && ivLength != 0) 5915 - { 5916 - param = new ParametersWithIV(param, gost28147Param.getIV()); 5917 - ivParam = (ParametersWithIV)param; 5918 - } 5919 - } 5920 - else if (params instanceof RC2ParameterSpec) 5921 - { 5922 - RC2ParameterSpec rc2Param = (RC2ParameterSpec)params; 5923 - 5924 - param = new RC2Parameters(key.getEncoded(), ((RC2ParameterSpec)params).getEffectiveKeyBits()); 5925 - 5926 - if (rc2Param.getIV() != null && ivLength != 0) 5927 - { 5928 - param = new ParametersWithIV(param, rc2Param.getIV()); 5929 - ivParam = (ParametersWithIV)param; 5930 - } 5931 - } 5932 - else if (params instanceof RC5ParameterSpec) 5933 - { 5934 - RC5ParameterSpec rc5Param = (RC5ParameterSpec)params; 5935 - 5936 - param = new RC5Parameters(key.getEncoded(), ((RC5ParameterSpec)params).getRounds()); 5937 - if (baseEngine.getAlgorithmName().startsWith("RC5")) 5938 - { 5939 - if (baseEngine.getAlgorithmName().equals("RC5-32")) 5940 - { 5941 - if (rc5Param.getWordSize() != 32) 5942 - { 5943 - throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 32 not " + rc5Param.getWordSize() + "."); 5944 - } 5945 - } 5946 - else if (baseEngine.getAlgorithmName().equals("RC5-64")) 5947 - { 5948 - if (rc5Param.getWordSize() != 64) 5949 - { 5950 - throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 64 not " + rc5Param.getWordSize() + "."); 5951 - } 5952 - } 5953 - } 5954 - else 5955 - { 5956 - throw new InvalidAlgorithmParameterException("RC5 parameters passed to a cipher that is not RC5."); 5957 - } 5958 - if ((rc5Param.getIV() != null) && (ivLength != 0)) 5959 - { 5960 - param = new ParametersWithIV(param, rc5Param.getIV()); 5961 - ivParam = (ParametersWithIV)param; 5962 - } 5963 - } 5964 + // BEGIN android-removed 5965 + // else if (params instanceof GOST28147ParameterSpec) 5966 + // { 5967 + // GOST28147ParameterSpec gost28147Param = (GOST28147ParameterSpec)params; 5968 + // 5969 + // param = new ParametersWithSBox( 5970 + // new KeyParameter(key.getEncoded()), ((GOST28147ParameterSpec)params).getSbox()); 5971 + // 5972 + // if (gost28147Param.getIV() != null && ivLength != 0) 5973 + // { 5974 + // param = new ParametersWithIV(param, gost28147Param.getIV()); 5975 + // ivParam = (ParametersWithIV)param; 5976 + // } 5977 + // } 5978 + // else if (params instanceof RC2ParameterSpec) 5979 + // { 5980 + // RC2ParameterSpec rc2Param = (RC2ParameterSpec)params; 5981 + // 5982 + // param = new RC2Parameters(key.getEncoded(), ((RC2ParameterSpec)params).getEffectiveKeyBits()); 5983 + // 5984 + // if (rc2Param.getIV() != null && ivLength != 0) 5985 + // { 5986 + // param = new ParametersWithIV(param, rc2Param.getIV()); 5987 + // ivParam = (ParametersWithIV)param; 5988 + // } 5989 + // } 5990 + // else if (params instanceof RC5ParameterSpec) 5991 + // { 5992 + // RC5ParameterSpec rc5Param = (RC5ParameterSpec)params; 5993 + // 5994 + // param = new RC5Parameters(key.getEncoded(), ((RC5ParameterSpec)params).getRounds()); 5995 + // if (baseEngine.getAlgorithmName().startsWith("RC5")) 5996 + // { 5997 + // if (baseEngine.getAlgorithmName().equals("RC5-32")) 5998 + // { 5999 + // if (rc5Param.getWordSize() != 32) 6000 + // { 6001 + // throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 32 not " + rc5Param.getWordSize() + "."); 6002 + // } 6003 + // } 6004 + // else if (baseEngine.getAlgorithmName().equals("RC5-64")) 6005 + // { 6006 + // if (rc5Param.getWordSize() != 64) 6007 + // { 6008 + // throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 64 not " + rc5Param.getWordSize() + "."); 6009 + // } 6010 + // } 6011 + // } 6012 + // else 6013 + // { 6014 + // throw new InvalidAlgorithmParameterException("RC5 parameters passed to a cipher that is not RC5."); 6015 + // } 6016 + // if ((rc5Param.getIV() != null) && (ivLength != 0)) 6017 + // { 6018 + // param = new ParametersWithIV(param, rc5Param.getIV()); 6019 + // ivParam = (ParametersWithIV)param; 6020 + // } 6021 + // } 6022 + // END android-removed 6023 else 6024 { 6025 throw new InvalidAlgorithmParameterException("unknown parameter type."); 6026 @@ -761,7 +787,9 @@ 6027 private boolean isAEADModeName( 6028 String modeName) 6029 { 6030 - return "CCM".equals(modeName) || "EAX".equals(modeName) || "GCM".equals(modeName) || "OCB".equals(modeName); 6031 + // BEGIN android-changed 6032 + return "CCM".equals(modeName) || "GCM".equals(modeName); 6033 + // END android-changed 6034 } 6035 6036 /* 6037 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/BaseStreamCipher.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/BaseStreamCipher.java 6038 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/BaseStreamCipher.java 2013-05-31 21:16:46.000000000 +0000 6039 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/BaseStreamCipher.java 2012-09-17 23:04:47.000000000 +0000 6040 @@ -13,8 +13,10 @@ 6041 import javax.crypto.ShortBufferException; 6042 import javax.crypto.spec.IvParameterSpec; 6043 import javax.crypto.spec.PBEParameterSpec; 6044 -import javax.crypto.spec.RC2ParameterSpec; 6045 -import javax.crypto.spec.RC5ParameterSpec; 6046 +// BEGIN android-removed 6047 +// import javax.crypto.spec.RC2ParameterSpec; 6048 +// import javax.crypto.spec.RC5ParameterSpec; 6049 +// END android-removed 6050 6051 import org.bouncycastle.crypto.BlockCipher; 6052 import org.bouncycastle.crypto.CipherParameters; 6053 @@ -34,8 +36,10 @@ 6054 // 6055 private Class[] availableSpecs = 6056 { 6057 - RC2ParameterSpec.class, 6058 - RC5ParameterSpec.class, 6059 + // BEGIN android-removed 6060 + // RC2ParameterSpec.class, 6061 + // RC5ParameterSpec.class, 6062 + // END android-removed 6063 IvParameterSpec.class, 6064 PBEParameterSpec.class 6065 }; 6066 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/BaseWrapCipher.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/BaseWrapCipher.java 6067 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/BaseWrapCipher.java 2013-05-31 21:16:46.000000000 +0000 6068 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/BaseWrapCipher.java 2013-01-31 02:26:40.000000000 +0000 6069 @@ -22,8 +22,10 @@ 6070 import javax.crypto.ShortBufferException; 6071 import javax.crypto.spec.IvParameterSpec; 6072 import javax.crypto.spec.PBEParameterSpec; 6073 -import javax.crypto.spec.RC2ParameterSpec; 6074 -import javax.crypto.spec.RC5ParameterSpec; 6075 +// BEGIN android-removed 6076 +// import javax.crypto.spec.RC2ParameterSpec; 6077 +// import javax.crypto.spec.RC5ParameterSpec; 6078 +// END android-removed 6079 import javax.crypto.spec.SecretKeySpec; 6080 6081 import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 6082 @@ -45,8 +47,10 @@ 6083 { 6084 IvParameterSpec.class, 6085 PBEParameterSpec.class, 6086 - RC2ParameterSpec.class, 6087 - RC5ParameterSpec.class 6088 + // BEGIN android-removed 6089 + // RC2ParameterSpec.class, 6090 + // RC5ParameterSpec.class 6091 + // END android-removed 6092 }; 6093 6094 protected int pbeType = PKCS12; 6095 @@ -258,6 +262,8 @@ 6096 return null; 6097 } 6098 6099 + // BEGIN android-changed 6100 + // added ShortBufferException to throws statement 6101 protected int engineDoFinal( 6102 byte[] input, 6103 int inputOffset, 6104 @@ -268,6 +274,7 @@ 6105 { 6106 return 0; 6107 } 6108 + // END android-changed 6109 6110 protected byte[] engineWrap( 6111 Key key) 6112 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/PBE.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/PBE.java 6113 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/symmetric/util/PBE.java 2013-05-31 21:16:46.000000000 +0000 6114 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/symmetric/util/PBE.java 2013-05-25 02:14:15.000000000 +0000 6115 @@ -7,13 +7,18 @@ 6116 6117 import org.bouncycastle.crypto.CipherParameters; 6118 import org.bouncycastle.crypto.PBEParametersGenerator; 6119 -import org.bouncycastle.crypto.digests.GOST3411Digest; 6120 -import org.bouncycastle.crypto.digests.MD2Digest; 6121 -import org.bouncycastle.crypto.digests.MD5Digest; 6122 -import org.bouncycastle.crypto.digests.RIPEMD160Digest; 6123 -import org.bouncycastle.crypto.digests.SHA1Digest; 6124 -import org.bouncycastle.crypto.digests.SHA256Digest; 6125 -import org.bouncycastle.crypto.digests.TigerDigest; 6126 +// BEGIN android-removed 6127 +// import org.bouncycastle.crypto.digests.GOST3411Digest; 6128 +// import org.bouncycastle.crypto.digests.MD2Digest; 6129 +// import org.bouncycastle.crypto.digests.MD5Digest; 6130 +// import org.bouncycastle.crypto.digests.RIPEMD160Digest; 6131 +// import org.bouncycastle.crypto.digests.SHA1Digest; 6132 +// import org.bouncycastle.crypto.digests.SHA256Digest; 6133 +// import org.bouncycastle.crypto.digests.TigerDigest; 6134 +// END android-removed 6135 +// BEGIN android-added 6136 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 6137 +// END android-added 6138 import org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator; 6139 import org.bouncycastle.crypto.generators.PKCS12ParametersGenerator; 6140 import org.bouncycastle.crypto.generators.PKCS5S1ParametersGenerator; 6141 @@ -29,11 +34,15 @@ 6142 // 6143 static final int MD5 = 0; 6144 static final int SHA1 = 1; 6145 - static final int RIPEMD160 = 2; 6146 - static final int TIGER = 3; 6147 + // BEGIN android-removed 6148 + // static final int RIPEMD160 = 2; 6149 + // static final int TIGER = 3; 6150 + // END android-removed 6151 static final int SHA256 = 4; 6152 - static final int MD2 = 5; 6153 - static final int GOST3411 = 6; 6154 + // BEGIN android-removed 6155 + // static final int MD2 = 5; 6156 + // static final int GOST3411 = 6; 6157 + // END android-removed 6158 6159 static final int PKCS5S1 = 0; 6160 static final int PKCS5S2 = 1; 6161 @@ -57,14 +66,20 @@ 6162 { 6163 switch (hash) 6164 { 6165 - case MD2: 6166 - generator = new PKCS5S1ParametersGenerator(new MD2Digest()); 6167 - break; 6168 + // BEGIN android-removed 6169 + // case MD2: 6170 + // generator = new PKCS5S1ParametersGenerator(new MD2Digest()); 6171 + // break; 6172 + // END android-removed 6173 case MD5: 6174 - generator = new PKCS5S1ParametersGenerator(new MD5Digest()); 6175 + // BEGIN android-changed 6176 + generator = new PKCS5S1ParametersGenerator(AndroidDigestFactory.getMD5()); 6177 + // END android-changed 6178 break; 6179 case SHA1: 6180 - generator = new PKCS5S1ParametersGenerator(new SHA1Digest()); 6181 + // BEGIN android-changed 6182 + generator = new PKCS5S1ParametersGenerator(AndroidDigestFactory.getSHA1()); 6183 + // END android-changed 6184 break; 6185 default: 6186 throw new IllegalStateException("PKCS5 scheme 1 only supports MD2, MD5 and SHA1."); 6187 @@ -78,27 +93,39 @@ 6188 { 6189 switch (hash) 6190 { 6191 - case MD2: 6192 - generator = new PKCS12ParametersGenerator(new MD2Digest()); 6193 - break; 6194 + // BEGIN android-removed 6195 + // case MD2: 6196 + // generator = new PKCS12ParametersGenerator(new MD2Digest()); 6197 + // break; 6198 + // END android-removed 6199 case MD5: 6200 - generator = new PKCS12ParametersGenerator(new MD5Digest()); 6201 + // BEGIN android-changed 6202 + generator = new PKCS12ParametersGenerator(AndroidDigestFactory.getMD5()); 6203 + // END android-changed 6204 break; 6205 case SHA1: 6206 - generator = new PKCS12ParametersGenerator(new SHA1Digest()); 6207 - break; 6208 - case RIPEMD160: 6209 - generator = new PKCS12ParametersGenerator(new RIPEMD160Digest()); 6210 - break; 6211 - case TIGER: 6212 - generator = new PKCS12ParametersGenerator(new TigerDigest()); 6213 - break; 6214 + // BEGIN android-changed 6215 + generator = new PKCS12ParametersGenerator(AndroidDigestFactory.getSHA1()); 6216 + // END android-changed 6217 + break; 6218 + // BEGIN android-removed 6219 + // case RIPEMD160: 6220 + // generator = new PKCS12ParametersGenerator(new RIPEMD160Digest()); 6221 + // break; 6222 + // case TIGER: 6223 + // generator = new PKCS12ParametersGenerator(new TigerDigest()); 6224 + // break; 6225 + // END android-removed 6226 case SHA256: 6227 - generator = new PKCS12ParametersGenerator(new SHA256Digest()); 6228 - break; 6229 - case GOST3411: 6230 - generator = new PKCS12ParametersGenerator(new GOST3411Digest()); 6231 - break; 6232 + // BEGIN android-changed 6233 + generator = new PKCS12ParametersGenerator(AndroidDigestFactory.getSHA256()); 6234 + // END android-changed 6235 + break; 6236 + // BEGIN android-removed 6237 + // case GOST3411: 6238 + // generator = new PKCS12ParametersGenerator(new GOST3411Digest()); 6239 + // break; 6240 + // END android-removed 6241 default: 6242 throw new IllegalStateException("unknown digest scheme for PBE encryption."); 6243 } 6244 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/util/DigestFactory.java bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/util/DigestFactory.java 6245 --- bcprov-jdk15on-149.orig/org/bouncycastle/jcajce/provider/util/DigestFactory.java 2013-05-31 21:16:46.000000000 +0000 6246 +++ bcprov-jdk15on-149/org/bouncycastle/jcajce/provider/util/DigestFactory.java 2012-09-17 23:04:47.000000000 +0000 6247 @@ -10,19 +10,26 @@ 6248 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 6249 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 6250 import org.bouncycastle.crypto.Digest; 6251 -import org.bouncycastle.crypto.digests.MD5Digest; 6252 -import org.bouncycastle.crypto.digests.SHA1Digest; 6253 -import org.bouncycastle.crypto.digests.SHA224Digest; 6254 -import org.bouncycastle.crypto.digests.SHA256Digest; 6255 -import org.bouncycastle.crypto.digests.SHA384Digest; 6256 -import org.bouncycastle.crypto.digests.SHA512Digest; 6257 +// BEGIN android-removed 6258 +// import org.bouncycastle.crypto.digests.MD5Digest; 6259 +// import org.bouncycastle.crypto.digests.SHA1Digest; 6260 +// import org.bouncycastle.crypto.digests.SHA224Digest; 6261 +// import org.bouncycastle.crypto.digests.SHA256Digest; 6262 +// import org.bouncycastle.crypto.digests.SHA384Digest; 6263 +// import org.bouncycastle.crypto.digests.SHA512Digest; 6264 +// END android-removed 6265 +// BEGIN android-added 6266 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 6267 +// END android-added 6268 import org.bouncycastle.util.Strings; 6269 6270 public class DigestFactory 6271 { 6272 private static Set md5 = new HashSet(); 6273 private static Set sha1 = new HashSet(); 6274 - private static Set sha224 = new HashSet(); 6275 + // BEGIN android-removed 6276 + // private static Set sha224 = new HashSet(); 6277 + // END android-removed 6278 private static Set sha256 = new HashSet(); 6279 private static Set sha384 = new HashSet(); 6280 private static Set sha512 = new HashSet(); 6281 @@ -38,9 +45,11 @@ 6282 sha1.add("SHA-1"); 6283 sha1.add(OIWObjectIdentifiers.idSHA1.getId()); 6284 6285 - sha224.add("SHA224"); 6286 - sha224.add("SHA-224"); 6287 - sha224.add(NISTObjectIdentifiers.id_sha224.getId()); 6288 + // BEGIN android-removed 6289 + // sha224.add("SHA224"); 6290 + // sha224.add("SHA-224"); 6291 + // sha224.add(NISTObjectIdentifiers.id_sha224.getId()); 6292 + // END android-removed 6293 6294 sha256.add("SHA256"); 6295 sha256.add("SHA-256"); 6296 @@ -61,9 +70,11 @@ 6297 oids.put("SHA-1", OIWObjectIdentifiers.idSHA1); 6298 oids.put(OIWObjectIdentifiers.idSHA1.getId(), OIWObjectIdentifiers.idSHA1); 6299 6300 - oids.put("SHA224", NISTObjectIdentifiers.id_sha224); 6301 - oids.put("SHA-224", NISTObjectIdentifiers.id_sha224); 6302 - oids.put(NISTObjectIdentifiers.id_sha224.getId(), NISTObjectIdentifiers.id_sha224); 6303 + // BEGIN android-removed 6304 + // oids.put("SHA224", NISTObjectIdentifiers.id_sha224); 6305 + // oids.put("SHA-224", NISTObjectIdentifiers.id_sha224); 6306 + // oids.put(NISTObjectIdentifiers.id_sha224.getId(), NISTObjectIdentifiers.id_sha224); 6307 + // END android-removed 6308 6309 oids.put("SHA256", NISTObjectIdentifiers.id_sha256); 6310 oids.put("SHA-256", NISTObjectIdentifiers.id_sha256); 6311 @@ -85,27 +96,39 @@ 6312 6313 if (sha1.contains(digestName)) 6314 { 6315 - return new SHA1Digest(); 6316 + // BEGIN android-changed 6317 + return AndroidDigestFactory.getSHA1(); 6318 + // END android-changed 6319 } 6320 if (md5.contains(digestName)) 6321 { 6322 - return new MD5Digest(); 6323 - } 6324 - if (sha224.contains(digestName)) 6325 - { 6326 - return new SHA224Digest(); 6327 - } 6328 + // BEGIN android-changed 6329 + return AndroidDigestFactory.getMD5(); 6330 + // END android-changed 6331 + } 6332 + // BEGIN android-removed 6333 + // if (sha224.contains(digestName)) 6334 + // { 6335 + // return new SHA224Digest(); 6336 + // } 6337 + // END android-removed 6338 if (sha256.contains(digestName)) 6339 { 6340 - return new SHA256Digest(); 6341 + // BEGIN android-changed 6342 + return AndroidDigestFactory.getSHA256(); 6343 + // END android-changed 6344 } 6345 if (sha384.contains(digestName)) 6346 { 6347 - return new SHA384Digest(); 6348 + // BEGIN android-changed 6349 + return AndroidDigestFactory.getSHA384(); 6350 + // END android-changed 6351 } 6352 if (sha512.contains(digestName)) 6353 { 6354 - return new SHA512Digest(); 6355 + // BEGIN android-changed 6356 + return AndroidDigestFactory.getSHA512(); 6357 + // END android-changed 6358 } 6359 6360 return null; 6361 @@ -116,7 +139,9 @@ 6362 String digest2) 6363 { 6364 return (sha1.contains(digest1) && sha1.contains(digest2)) 6365 - || (sha224.contains(digest1) && sha224.contains(digest2)) 6366 + // BEGIN android-removed 6367 + // || (sha224.contains(digest1) && sha224.contains(digest2)) 6368 + // END android-removed 6369 || (sha256.contains(digest1) && sha256.contains(digest2)) 6370 || (sha384.contains(digest1) && sha384.contains(digest2)) 6371 || (sha512.contains(digest1) && sha512.contains(digest2)) 6372 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/PKCS10CertificationRequest.java bcprov-jdk15on-149/org/bouncycastle/jce/PKCS10CertificationRequest.java 6373 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/PKCS10CertificationRequest.java 2013-05-31 21:16:46.000000000 +0000 6374 +++ bcprov-jdk15on-149/org/bouncycastle/jce/PKCS10CertificationRequest.java 2013-01-31 02:26:40.000000000 +0000 6375 @@ -30,14 +30,18 @@ 6376 import org.bouncycastle.asn1.DERBitString; 6377 import org.bouncycastle.asn1.DERNull; 6378 import org.bouncycastle.asn1.DERObjectIdentifier; 6379 -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 6380 +// BEGIN android-removed 6381 +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 6382 +// END android-removed 6383 import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; 6384 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 6385 import org.bouncycastle.asn1.pkcs.CertificationRequest; 6386 import org.bouncycastle.asn1.pkcs.CertificationRequestInfo; 6387 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 6388 import org.bouncycastle.asn1.pkcs.RSASSAPSSparams; 6389 -import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 6390 +// BEGIN android-removed 6391 +// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 6392 +// END android-removed 6393 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 6394 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 6395 import org.bouncycastle.asn1.x509.X509Name; 6396 @@ -81,15 +85,20 @@ 6397 6398 static 6399 { 6400 - algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 6401 - algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 6402 + // BEGIN android-removed 6403 + // Dropping MD2 6404 + // algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 6405 + // algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 6406 + // END android-removed 6407 algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4")); 6408 algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4")); 6409 algorithms.put("RSAWITHMD5", new DERObjectIdentifier("1.2.840.113549.1.1.4")); 6410 algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5")); 6411 algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5")); 6412 - algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 6413 - algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 6414 + // BEGIN android-removed 6415 + // algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 6416 + // algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 6417 + // END android-removed 6418 algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption); 6419 algorithms.put("SHA256WITHRSA", PKCSObjectIdentifiers.sha256WithRSAEncryption); 6420 algorithms.put("SHA384WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha384WithRSAEncryption); 6421 @@ -97,57 +106,78 @@ 6422 algorithms.put("SHA512WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha512WithRSAEncryption); 6423 algorithms.put("SHA512WITHRSA", PKCSObjectIdentifiers.sha512WithRSAEncryption); 6424 algorithms.put("SHA1WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 6425 - algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 6426 + // BEGIN android-removed 6427 + // algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 6428 + // END android-removed 6429 algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 6430 algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 6431 algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 6432 algorithms.put("RSAWITHSHA1", new DERObjectIdentifier("1.2.840.113549.1.1.5")); 6433 - algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 6434 - algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 6435 - algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 6436 - algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 6437 - algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 6438 - algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 6439 + // BEGIN android-removed 6440 + // algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 6441 + // algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 6442 + // algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 6443 + // algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 6444 + // algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 6445 + // algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 6446 + // END android-removed 6447 algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3")); 6448 algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3")); 6449 - algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 6450 + // BEGIN android-removed 6451 + // algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 6452 + // END android-removed 6453 algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256); 6454 algorithms.put("SHA384WITHDSA", NISTObjectIdentifiers.dsa_with_sha384); 6455 algorithms.put("SHA512WITHDSA", NISTObjectIdentifiers.dsa_with_sha512); 6456 algorithms.put("SHA1WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1); 6457 - algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 6458 + // BEGIN android-removed 6459 + // algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 6460 + // END android-removed 6461 algorithms.put("SHA256WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256); 6462 algorithms.put("SHA384WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); 6463 algorithms.put("SHA512WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); 6464 algorithms.put("ECDSAWITHSHA1", X9ObjectIdentifiers.ecdsa_with_SHA1); 6465 - algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 6466 - algorithms.put("GOST3410WITHGOST3411", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 6467 - algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6468 - algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6469 - algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6470 + // BEGIN android-removed 6471 + // algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 6472 + // algorithms.put("GOST3410WITHGOST3411", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 6473 + // algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6474 + // algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6475 + // algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6476 + // END android-removed 6477 6478 // 6479 // reverse mappings 6480 // 6481 oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.5"), "SHA1WITHRSA"); 6482 - oids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WITHRSA"); 6483 + // BEGIN android-removed 6484 + // oids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WITHRSA"); 6485 + // END android-removed 6486 oids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256WITHRSA"); 6487 oids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384WITHRSA"); 6488 oids.put(PKCSObjectIdentifiers.sha512WithRSAEncryption, "SHA512WITHRSA"); 6489 - oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3411WITHGOST3410"); 6490 - oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "GOST3411WITHECGOST3410"); 6491 + // BEGIN android-removed 6492 + // oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3411WITHGOST3410"); 6493 + // oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "GOST3411WITHECGOST3410"); 6494 + // END android-removed 6495 6496 oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA"); 6497 - oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); 6498 + // BEGIN android-removed 6499 + // Dropping MD2 6500 + // oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); 6501 + // END android-removed 6502 oids.put(new DERObjectIdentifier("1.2.840.10040.4.3"), "SHA1WITHDSA"); 6503 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA1, "SHA1WITHECDSA"); 6504 - oids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224WITHECDSA"); 6505 + // BEGIN android-removed 6506 + // oids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224WITHECDSA"); 6507 + // END android-removed 6508 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA256, "SHA256WITHECDSA"); 6509 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA384, "SHA384WITHECDSA"); 6510 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA512, "SHA512WITHECDSA"); 6511 oids.put(OIWObjectIdentifiers.sha1WithRSA, "SHA1WITHRSA"); 6512 oids.put(OIWObjectIdentifiers.dsaWithSHA1, "SHA1WITHDSA"); 6513 - oids.put(NISTObjectIdentifiers.dsa_with_sha224, "SHA224WITHDSA"); 6514 + // BEGIN android-removed 6515 + // oids.put(NISTObjectIdentifiers.dsa_with_sha224, "SHA224WITHDSA"); 6516 + // END android-removed 6517 oids.put(NISTObjectIdentifiers.dsa_with_sha256, "SHA256WITHDSA"); 6518 6519 // 6520 @@ -161,27 +191,35 @@ 6521 // The parameters field SHALL be NULL for RSA based signature algorithms. 6522 // 6523 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA1); 6524 - noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 6525 + // BEGIN android-removed 6526 + // noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 6527 + // END android-removed 6528 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA256); 6529 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA384); 6530 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA512); 6531 noParams.add(X9ObjectIdentifiers.id_dsa_with_sha1); 6532 - noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 6533 + // BEGIN android-removed 6534 + // noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 6535 + // END android-removed 6536 noParams.add(NISTObjectIdentifiers.dsa_with_sha256); 6537 6538 // 6539 // RFC 4491 6540 // 6541 - noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 6542 - noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6543 + // BEGIN android-removed 6544 + // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 6545 + // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 6546 + // END android-removed 6547 // 6548 // explicit params 6549 // 6550 AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE); 6551 params.put("SHA1WITHRSAANDMGF1", creatPSSParams(sha1AlgId, 20)); 6552 6553 - AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, DERNull.INSTANCE); 6554 - params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 6555 + // BEGIN android-removed 6556 + // AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, DERNull.INSTANCE); 6557 + // params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 6558 + // END android-removed 6559 6560 AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, DERNull.INSTANCE); 6561 params.put("SHA256WITHRSAANDMGF1", creatPSSParams(sha256AlgId, 32)); 6562 @@ -600,10 +638,12 @@ 6563 { 6564 return "SHA1"; 6565 } 6566 - else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 6567 - { 6568 - return "SHA224"; 6569 - } 6570 + // BEGIN android-removed 6571 + // else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 6572 + // { 6573 + // return "SHA224"; 6574 + // } 6575 + // END android-removed 6576 else if (NISTObjectIdentifiers.id_sha256.equals(digestAlgOID)) 6577 { 6578 return "SHA256"; 6579 @@ -616,22 +656,24 @@ 6580 { 6581 return "SHA512"; 6582 } 6583 - else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 6584 - { 6585 - return "RIPEMD128"; 6586 - } 6587 - else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 6588 - { 6589 - return "RIPEMD160"; 6590 - } 6591 - else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 6592 - { 6593 - return "RIPEMD256"; 6594 - } 6595 - else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 6596 - { 6597 - return "GOST3411"; 6598 - } 6599 + // BEGIN android-removed 6600 + // else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 6601 + // { 6602 + // return "RIPEMD128"; 6603 + // } 6604 + // else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 6605 + // { 6606 + // return "RIPEMD160"; 6607 + // } 6608 + // else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 6609 + // { 6610 + // return "RIPEMD256"; 6611 + // } 6612 + // else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 6613 + // { 6614 + // return "GOST3411"; 6615 + // } 6616 + // END android-removed 6617 else 6618 { 6619 return digestAlgOID.getId(); 6620 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/BouncyCastleProvider.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/BouncyCastleProvider.java 6621 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/BouncyCastleProvider.java 2013-05-31 21:16:46.000000000 +0000 6622 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/BouncyCastleProvider.java 2013-05-25 02:14:15.000000000 +0000 6623 @@ -64,13 +64,20 @@ 6624 6625 private static final String[] SYMMETRIC_MACS = 6626 { 6627 - "SipHash" 6628 + // BEGIN android-removed 6629 + // "SipHash" 6630 + // END android-removed 6631 }; 6632 6633 private static final String[] SYMMETRIC_CIPHERS = 6634 { 6635 - "AES", "ARC4", "Blowfish", "Camellia", "CAST5", "CAST6", "DES", "DESede", "GOST28147", "Grainv1", "Grain128", "HC128", "HC256", "IDEA", 6636 - "Noekeon", "RC2", "RC5", "RC6", "Rijndael", "Salsa20", "SEED", "Serpent", "Skipjack", "TEA", "Twofish", "VMPC", "VMPCKSA3", "XTEA" 6637 + // BEGIN android-removed 6638 + // "AES", "ARC4", "Blowfish", "Camellia", "CAST5", "CAST6", "DES", "DESede", "GOST28147", "Grainv1", "Grain128", "HC128", "HC256", "IDEA", 6639 + // "Noekeon", "RC2", "RC5", "RC6", "Rijndael", "Salsa20", "SEED", "Serpent", "Skipjack", "TEA", "Twofish", "VMPC", "VMPCKSA3", "XTEA" 6640 + // END android-removed 6641 + // BEGIN android-added 6642 + "AES", "ARC4", "Blowfish", "DES", "DESede", "RC2", "Twofish" 6643 + // END android-added 6644 }; 6645 6646 /* 6647 @@ -82,12 +89,22 @@ 6648 // later ones configure it. 6649 private static final String[] ASYMMETRIC_GENERIC = 6650 { 6651 - "X509", "IES" 6652 + // BEGIN android-removed 6653 + // "X509", "IES" 6654 + // END android-removed 6655 + // BEGIN android-added 6656 + "X509" 6657 + // END android-added 6658 }; 6659 6660 private static final String[] ASYMMETRIC_CIPHERS = 6661 { 6662 - "DSA", "DH", "EC", "RSA", "GOST", "ECGOST", "ElGamal", "DSTU4145" 6663 + // BEGIN android-removed 6664 + // "DSA", "DH", "EC", "RSA", "GOST", "ECGOST", "ElGamal", "DSTU4145" 6665 + // END android-removed 6666 + // BEGIN android-added 6667 + "DSA", "DH", "EC", "RSA", 6668 + // END android-added 6669 }; 6670 6671 /* 6672 @@ -96,7 +113,12 @@ 6673 private static final String DIGEST_PACKAGE = "org.bouncycastle.jcajce.provider.digest."; 6674 private static final String[] DIGESTS = 6675 { 6676 - "GOST3411", "MD2", "MD4", "MD5", "SHA1", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320", "SHA224", "SHA256", "SHA384", "SHA512", "SHA3", "Tiger", "Whirlpool" 6677 + // BEGIN android-removed 6678 + // "GOST3411", "MD2", "MD4", "MD5", "SHA1", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320", "SHA224", "SHA256", "SHA384", "SHA512", "SHA3", "Tiger", "Whirlpool" 6679 + // END android-removed 6680 + // BEGIN android-added 6681 + "MD5", "SHA1", "SHA256", "SHA384", "SHA512", 6682 + // END android-added 6683 }; 6684 6685 /* 6686 @@ -143,48 +165,52 @@ 6687 6688 loadAlgorithms(KEYSTORE_PACKAGE, KEYSTORES); 6689 6690 - // 6691 - // X509Store 6692 - // 6693 - put("X509Store.CERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertCollection"); 6694 - put("X509Store.ATTRIBUTECERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreAttrCertCollection"); 6695 - put("X509Store.CRL/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCRLCollection"); 6696 - put("X509Store.CERTIFICATEPAIR/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertPairCollection"); 6697 - 6698 - put("X509Store.CERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCerts"); 6699 - put("X509Store.CRL/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCRLs"); 6700 - put("X509Store.ATTRIBUTECERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPAttrCerts"); 6701 - put("X509Store.CERTIFICATEPAIR/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCertPairs"); 6702 - 6703 - // 6704 - // X509StreamParser 6705 - // 6706 - put("X509StreamParser.CERTIFICATE", "org.bouncycastle.jce.provider.X509CertParser"); 6707 - put("X509StreamParser.ATTRIBUTECERTIFICATE", "org.bouncycastle.jce.provider.X509AttrCertParser"); 6708 - put("X509StreamParser.CRL", "org.bouncycastle.jce.provider.X509CRLParser"); 6709 - put("X509StreamParser.CERTIFICATEPAIR", "org.bouncycastle.jce.provider.X509CertPairParser"); 6710 - 6711 - // 6712 - // cipher engines 6713 - // 6714 - put("Cipher.BROKENPBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithMD5AndDES"); 6715 - 6716 - put("Cipher.BROKENPBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHA1AndDES"); 6717 - 6718 - 6719 - put("Cipher.OLDPBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndTwofish"); 6720 - 6721 - // Certification Path API 6722 - put("CertPathValidator.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathValidatorSpi"); 6723 - put("CertPathBuilder.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathBuilderSpi"); 6724 - put("CertPathValidator.RFC3280", "org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi"); 6725 - put("CertPathBuilder.RFC3280", "org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi"); 6726 + // BEGIN android-removed 6727 + // // 6728 + // // X509Store 6729 + // // 6730 + // put("X509Store.CERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertCollection"); 6731 + // put("X509Store.ATTRIBUTECERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreAttrCertCollection"); 6732 + // put("X509Store.CRL/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCRLCollection"); 6733 + // put("X509Store.CERTIFICATEPAIR/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertPairCollection"); 6734 + // 6735 + // put("X509Store.CERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCerts"); 6736 + // put("X509Store.CRL/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCRLs"); 6737 + // put("X509Store.ATTRIBUTECERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPAttrCerts"); 6738 + // put("X509Store.CERTIFICATEPAIR/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCertPairs"); 6739 + // 6740 + // // 6741 + // // X509StreamParser 6742 + // // 6743 + // put("X509StreamParser.CERTIFICATE", "org.bouncycastle.jce.provider.X509CertParser"); 6744 + // put("X509StreamParser.ATTRIBUTECERTIFICATE", "org.bouncycastle.jce.provider.X509AttrCertParser"); 6745 + // put("X509StreamParser.CRL", "org.bouncycastle.jce.provider.X509CRLParser"); 6746 + // put("X509StreamParser.CERTIFICATEPAIR", "org.bouncycastle.jce.provider.X509CertPairParser"); 6747 + // 6748 + // // 6749 + // // cipher engines 6750 + // // 6751 + // put("Cipher.BROKENPBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithMD5AndDES"); 6752 + // 6753 + // put("Cipher.BROKENPBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHA1AndDES"); 6754 + // 6755 + // 6756 + // put("Cipher.OLDPBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndTwofish"); 6757 + // 6758 + // // Certification Path API 6759 + // put("CertPathValidator.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathValidatorSpi"); 6760 + // put("CertPathBuilder.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathBuilderSpi"); 6761 + // put("CertPathValidator.RFC3280", "org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi"); 6762 + // put("CertPathBuilder.RFC3280", "org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi"); 6763 + // END android-removed 6764 put("CertPathValidator.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi"); 6765 put("CertPathBuilder.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi"); 6766 put("CertStore.Collection", "org.bouncycastle.jce.provider.CertStoreCollectionSpi"); 6767 - put("CertStore.LDAP", "org.bouncycastle.jce.provider.X509LDAPCertStoreSpi"); 6768 - put("CertStore.Multi", "org.bouncycastle.jce.provider.MultiCertStoreSpi"); 6769 - put("Alg.Alias.CertStore.X509LDAP", "LDAP"); 6770 + // BEGIN android-removed 6771 + // put("CertStore.LDAP", "org.bouncycastle.jce.provider.X509LDAPCertStoreSpi"); 6772 + // put("CertStore.Multi", "org.bouncycastle.jce.provider.MultiCertStoreSpi"); 6773 + // put("Alg.Alias.CertStore.X509LDAP", "LDAP"); 6774 + // END android-removed 6775 } 6776 6777 private void loadAlgorithms(String packageName, String[] names) 6778 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/CertBlacklist.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/CertBlacklist.java 6779 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/CertBlacklist.java 1970-01-01 00:00:00.000000000 +0000 6780 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/CertBlacklist.java 2013-01-16 01:38:43.000000000 +0000 6781 @@ -0,0 +1,224 @@ 6782 +/* 6783 + * Copyright (C) 2012 The Android Open Source Project 6784 + * 6785 + * Licensed under the Apache License, Version 2.0 (the "License"); 6786 + * you may not use this file except in compliance with the License. 6787 + * You may obtain a copy of the License at 6788 + * 6789 + * http://www.apache.org/licenses/LICENSE-2.0 6790 + * 6791 + * Unless required by applicable law or agreed to in writing, software 6792 + * distributed under the License is distributed on an "AS IS" BASIS, 6793 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6794 + * See the License for the specific language governing permissions and 6795 + * limitations under the License. 6796 + */ 6797 + 6798 +package org.bouncycastle.jce.provider; 6799 + 6800 +import java.io.Closeable; 6801 +import java.io.ByteArrayOutputStream; 6802 +import java.io.FileNotFoundException; 6803 +import java.io.IOException; 6804 +import java.io.RandomAccessFile; 6805 +import java.math.BigInteger; 6806 +import java.security.PublicKey; 6807 +import java.util.Arrays; 6808 +import java.util.Collections; 6809 +import java.util.HashSet; 6810 +import java.util.Set; 6811 +import java.util.logging.Level; 6812 +import java.util.logging.Logger; 6813 +import org.bouncycastle.crypto.Digest; 6814 +import org.bouncycastle.crypto.digests.AndroidDigestFactory; 6815 +import org.bouncycastle.util.encoders.Hex; 6816 + 6817 +public class CertBlacklist { 6818 + 6819 + private static final String ANDROID_DATA = System.getenv("ANDROID_DATA"); 6820 + private static final String BLACKLIST_ROOT = ANDROID_DATA + "/misc/keychain/"; 6821 + public static final String DEFAULT_PUBKEY_BLACKLIST_PATH = BLACKLIST_ROOT + "pubkey_blacklist.txt"; 6822 + public static final String DEFAULT_SERIAL_BLACKLIST_PATH = BLACKLIST_ROOT + "serial_blacklist.txt"; 6823 + 6824 + private static final Logger logger = Logger.getLogger(CertBlacklist.class.getName()); 6825 + 6826 + // public for testing 6827 + public final Set<BigInteger> serialBlacklist; 6828 + public final Set<byte[]> pubkeyBlacklist; 6829 + 6830 + public CertBlacklist() { 6831 + this(DEFAULT_PUBKEY_BLACKLIST_PATH, DEFAULT_SERIAL_BLACKLIST_PATH); 6832 + } 6833 + 6834 + /** Test only interface, not for public use */ 6835 + public CertBlacklist(String pubkeyBlacklistPath, String serialBlacklistPath) { 6836 + serialBlacklist = readSerialBlackList(serialBlacklistPath); 6837 + pubkeyBlacklist = readPublicKeyBlackList(pubkeyBlacklistPath); 6838 + } 6839 + 6840 + private static boolean isHex(String value) { 6841 + try { 6842 + new BigInteger(value, 16); 6843 + return true; 6844 + } catch (NumberFormatException e) { 6845 + logger.log(Level.WARNING, "Could not parse hex value " + value, e); 6846 + return false; 6847 + } 6848 + } 6849 + 6850 + private static boolean isPubkeyHash(String value) { 6851 + if (value.length() != 40) { 6852 + logger.log(Level.WARNING, "Invalid pubkey hash length: " + value.length()); 6853 + return false; 6854 + } 6855 + return isHex(value); 6856 + } 6857 + 6858 + private static String readBlacklist(String path) { 6859 + try { 6860 + return readFileAsString(path); 6861 + } catch (FileNotFoundException ignored) { 6862 + } catch (IOException e) { 6863 + logger.log(Level.WARNING, "Could not read blacklist", e); 6864 + } 6865 + return ""; 6866 + } 6867 + 6868 + // From IoUtils.readFileAsString 6869 + private static String readFileAsString(String path) throws IOException { 6870 + return readFileAsBytes(path).toString("UTF-8"); 6871 + } 6872 + 6873 + // Based on IoUtils.readFileAsBytes 6874 + private static ByteArrayOutputStream readFileAsBytes(String path) throws IOException { 6875 + RandomAccessFile f = null; 6876 + try { 6877 + f = new RandomAccessFile(path, "r"); 6878 + ByteArrayOutputStream bytes = new ByteArrayOutputStream((int) f.length()); 6879 + byte[] buffer = new byte[8192]; 6880 + while (true) { 6881 + int byteCount = f.read(buffer); 6882 + if (byteCount == -1) { 6883 + return bytes; 6884 + } 6885 + bytes.write(buffer, 0, byteCount); 6886 + } 6887 + } finally { 6888 + closeQuietly(f); 6889 + } 6890 + } 6891 + 6892 + // Base on IoUtils.closeQuietly 6893 + private static void closeQuietly(Closeable closeable) { 6894 + if (closeable != null) { 6895 + try { 6896 + closeable.close(); 6897 + } catch (RuntimeException rethrown) { 6898 + throw rethrown; 6899 + } catch (Exception ignored) { 6900 + } 6901 + } 6902 + } 6903 + 6904 + private static final Set<BigInteger> readSerialBlackList(String path) { 6905 + 6906 + // start out with a base set of known bad values 6907 + Set<BigInteger> bl = new HashSet<BigInteger>(Arrays.asList( 6908 + // From http://src.chromium.org/viewvc/chrome/trunk/src/net/base/x509_certificate.cc?revision=78748&view=markup 6909 + // Not a real certificate. For testing only. 6910 + new BigInteger("077a59bcd53459601ca6907267a6dd1c", 16), 6911 + new BigInteger("047ecbe9fca55f7bd09eae36e10cae1e", 16), 6912 + new BigInteger("d8f35f4eb7872b2dab0692e315382fb0", 16), 6913 + new BigInteger("b0b7133ed096f9b56fae91c874bd3ac0", 16), 6914 + new BigInteger("9239d5348f40d1695a745470e1f23f43", 16), 6915 + new BigInteger("e9028b9578e415dc1a710a2b88154447", 16), 6916 + new BigInteger("d7558fdaf5f1105bb213282b707729a3", 16), 6917 + new BigInteger("f5c86af36162f13a64f54f6dc9587c06", 16), 6918 + new BigInteger("392a434f0e07df1f8aa305de34e0c229", 16), 6919 + new BigInteger("3e75ced46b693021218830ae86a82a71", 16), 6920 + new BigInteger("864", 16), 6921 + new BigInteger("827", 16) 6922 + )); 6923 + 6924 + // attempt to augment it with values taken from gservices 6925 + String serialBlacklist = readBlacklist(path); 6926 + if (!serialBlacklist.equals("")) { 6927 + for(String value : serialBlacklist.split(",")) { 6928 + try { 6929 + bl.add(new BigInteger(value, 16)); 6930 + } catch (NumberFormatException e) { 6931 + logger.log(Level.WARNING, "Tried to blacklist invalid serial number " + value, e); 6932 + } 6933 + } 6934 + } 6935 + 6936 + // whether that succeeds or fails, send it on its merry way 6937 + return Collections.unmodifiableSet(bl); 6938 + } 6939 + 6940 + private static final Set<byte[]> readPublicKeyBlackList(String path) { 6941 + 6942 + // start out with a base set of known bad values 6943 + Set<byte[]> bl = new HashSet<byte[]>(Arrays.asList( 6944 + // From http://src.chromium.org/viewvc/chrome/branches/782/src/net/base/x509_certificate.cc?r1=98750&r2=98749&pathrev=98750 6945 + // C=NL, O=DigiNotar, CN=DigiNotar Root CA/emailAddress=info (a] diginotar.nl 6946 + "410f36363258f30b347d12ce4863e433437806a8".getBytes(), 6947 + // Subject: CN=DigiNotar Cyber CA 6948 + // Issuer: CN=GTE CyberTrust Global Root 6949 + "ba3e7bd38cd7e1e6b9cd4c219962e59d7a2f4e37".getBytes(), 6950 + // Subject: CN=DigiNotar Services 1024 CA 6951 + // Issuer: CN=Entrust.net 6952 + "e23b8d105f87710a68d9248050ebefc627be4ca6".getBytes(), 6953 + // Subject: CN=DigiNotar PKIoverheid CA Organisatie - G2 6954 + // Issuer: CN=Staat der Nederlanden Organisatie CA - G2 6955 + "7b2e16bc39bcd72b456e9f055d1de615b74945db".getBytes(), 6956 + // Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven 6957 + // Issuer: CN=Staat der Nederlanden Overheid CA 6958 + "e8f91200c65cee16e039b9f883841661635f81c5".getBytes(), 6959 + // From http://src.chromium.org/viewvc/chrome?view=rev&revision=108479 6960 + // Subject: O=Digicert Sdn. Bhd. 6961 + // Issuer: CN=GTE CyberTrust Global Root 6962 + "0129bcd5b448ae8d2496d1c3e19723919088e152".getBytes(), 6963 + // Subject: CN=e-islem.kktcmerkezbankasi.org/emailAddress=ileti (a] kktcmerkezbankasi.org 6964 + // Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sunucu Sertifikas\xC4\xB1 Hizmetleri 6965 + "5f3ab33d55007054bc5e3e5553cd8d8465d77c61".getBytes(), 6966 + // Subject: CN=*.EGO.GOV.TR 93 6967 + // Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sunucu Sertifikas\xC4\xB1 Hizmetleri 6968 + "783333c9687df63377efceddd82efa9101913e8e".getBytes() 6969 + )); 6970 + 6971 + // attempt to augment it with values taken from gservices 6972 + String pubkeyBlacklist = readBlacklist(path); 6973 + if (!pubkeyBlacklist.equals("")) { 6974 + for (String value : pubkeyBlacklist.split(",")) { 6975 + value = value.trim(); 6976 + if (isPubkeyHash(value)) { 6977 + bl.add(value.getBytes()); 6978 + } else { 6979 + logger.log(Level.WARNING, "Tried to blacklist invalid pubkey " + value); 6980 + } 6981 + } 6982 + } 6983 + 6984 + return bl; 6985 + } 6986 + 6987 + public boolean isPublicKeyBlackListed(PublicKey publicKey) { 6988 + byte[] encoded = publicKey.getEncoded(); 6989 + Digest digest = AndroidDigestFactory.getSHA1(); 6990 + digest.update(encoded, 0, encoded.length); 6991 + byte[] out = new byte[digest.getDigestSize()]; 6992 + digest.doFinal(out, 0); 6993 + for (byte[] blacklisted : pubkeyBlacklist) { 6994 + if (Arrays.equals(blacklisted, Hex.encode(out))) { 6995 + return true; 6996 + } 6997 + } 6998 + return false; 6999 + } 7000 + 7001 + public boolean isSerialNumberBlackListed(BigInteger serial) { 7002 + return serialBlacklist.contains(serial); 7003 + } 7004 + 7005 +} 7006 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java 7007 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java 2013-05-31 21:16:46.000000000 +0000 7008 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java 2013-01-31 02:26:40.000000000 +0000 7009 @@ -61,14 +61,18 @@ 7010 import org.bouncycastle.asn1.x509.PolicyInformation; 7011 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 7012 import org.bouncycastle.asn1.x509.X509Extension; 7013 -import org.bouncycastle.jce.X509LDAPCertStoreParameters; 7014 +// BEGIN android-removed 7015 +// import org.bouncycastle.jce.X509LDAPCertStoreParameters; 7016 +// END android-removed 7017 import org.bouncycastle.jce.exception.ExtCertPathValidatorException; 7018 import org.bouncycastle.util.Integers; 7019 import org.bouncycastle.util.Selector; 7020 import org.bouncycastle.util.StoreException; 7021 import org.bouncycastle.x509.ExtendedPKIXBuilderParameters; 7022 import org.bouncycastle.x509.ExtendedPKIXParameters; 7023 -import org.bouncycastle.x509.X509AttributeCertStoreSelector; 7024 +// BEGIN android-removed 7025 +// import org.bouncycastle.x509.X509AttributeCertStoreSelector; 7026 +// END android-removed 7027 import org.bouncycastle.x509.X509AttributeCertificate; 7028 import org.bouncycastle.x509.X509CRLStoreSelector; 7029 import org.bouncycastle.x509.X509CertStoreSelector; 7030 @@ -656,38 +660,40 @@ 7031 { 7032 try 7033 { 7034 - if (location.startsWith("ldap://")) 7035 - { 7036 - // ldap://directory.d-trust.net/CN=D-TRUST 7037 - // Qualified CA 2003 1:PN,O=D-Trust GmbH,C=DE 7038 - // skip "ldap://" 7039 - location = location.substring(7); 7040 - // after first / baseDN starts 7041 - String base = null; 7042 - String url = null; 7043 - if (location.indexOf("/") != -1) 7044 - { 7045 - base = location.substring(location.indexOf("/")); 7046 - // URL 7047 - url = "ldap://" 7048 - + location.substring(0, location.indexOf("/")); 7049 - } 7050 - else 7051 - { 7052 - url = "ldap://" + location; 7053 - } 7054 - // use all purpose parameters 7055 - X509LDAPCertStoreParameters params = new X509LDAPCertStoreParameters.Builder( 7056 - url, base).build(); 7057 - pkixParams.addAdditionalStore(X509Store.getInstance( 7058 - "CERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7059 - pkixParams.addAdditionalStore(X509Store.getInstance( 7060 - "CRL/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7061 - pkixParams.addAdditionalStore(X509Store.getInstance( 7062 - "ATTRIBUTECERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7063 - pkixParams.addAdditionalStore(X509Store.getInstance( 7064 - "CERTIFICATEPAIR/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7065 - } 7066 + // BEGIN android-removed 7067 + // if (location.startsWith("ldap://")) 7068 + // { 7069 + // // ldap://directory.d-trust.net/CN=D-TRUST 7070 + // // Qualified CA 2003 1:PN,O=D-Trust GmbH,C=DE 7071 + // // skip "ldap://" 7072 + // location = location.substring(7); 7073 + // // after first / baseDN starts 7074 + // String base = null; 7075 + // String url = null; 7076 + // if (location.indexOf("/") != -1) 7077 + // { 7078 + // base = location.substring(location.indexOf("/")); 7079 + // // URL 7080 + // url = "ldap://" 7081 + // + location.substring(0, location.indexOf("/")); 7082 + // } 7083 + // else 7084 + // { 7085 + // url = "ldap://" + location; 7086 + // } 7087 + // // use all purpose parameters 7088 + // X509LDAPCertStoreParameters params = new X509LDAPCertStoreParameters.Builder( 7089 + // url, base).build(); 7090 + // pkixParams.addAdditionalStore(X509Store.getInstance( 7091 + // "CERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7092 + // pkixParams.addAdditionalStore(X509Store.getInstance( 7093 + // "CRL/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7094 + // pkixParams.addAdditionalStore(X509Store.getInstance( 7095 + // "ATTRIBUTECERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7096 + // pkixParams.addAdditionalStore(X509Store.getInstance( 7097 + // "CERTIFICATEPAIR/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 7098 + // } 7099 + // END android-removed 7100 } 7101 catch (Exception e) 7102 { 7103 @@ -752,33 +758,35 @@ 7104 return certs; 7105 } 7106 7107 - protected static Collection findCertificates(X509AttributeCertStoreSelector certSelect, 7108 - List certStores) 7109 - throws AnnotatedException 7110 - { 7111 - Set certs = new HashSet(); 7112 - Iterator iter = certStores.iterator(); 7113 - 7114 - while (iter.hasNext()) 7115 - { 7116 - Object obj = iter.next(); 7117 - 7118 - if (obj instanceof X509Store) 7119 - { 7120 - X509Store certStore = (X509Store)obj; 7121 - try 7122 - { 7123 - certs.addAll(certStore.getMatches(certSelect)); 7124 - } 7125 - catch (StoreException e) 7126 - { 7127 - throw new AnnotatedException( 7128 - "Problem while picking certificates from X.509 store.", e); 7129 - } 7130 - } 7131 - } 7132 - return certs; 7133 - } 7134 + // BEGIN android-removed 7135 + // protected static Collection findCertificates(X509AttributeCertStoreSelector certSelect, 7136 + // List certStores) 7137 + // throws AnnotatedException 7138 + // { 7139 + // Set certs = new HashSet(); 7140 + // Iterator iter = certStores.iterator(); 7141 + // 7142 + // while (iter.hasNext()) 7143 + // { 7144 + // Object obj = iter.next(); 7145 + // 7146 + // if (obj instanceof X509Store) 7147 + // { 7148 + // X509Store certStore = (X509Store)obj; 7149 + // try 7150 + // { 7151 + // certs.addAll(certStore.getMatches(certSelect)); 7152 + // } 7153 + // catch (StoreException e) 7154 + // { 7155 + // throw new AnnotatedException( 7156 + // "Problem while picking certificates from X.509 store.", e); 7157 + // } 7158 + // } 7159 + // } 7160 + // return certs; 7161 + // } 7162 + // END android-removed 7163 7164 protected static void addAdditionalStoresFromCRLDistributionPoint( 7165 CRLDistPoint crldp, ExtendedPKIXParameters pkixParams) 7166 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/JCEECPrivateKey.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/JCEECPrivateKey.java 7167 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/JCEECPrivateKey.java 2013-05-31 21:16:46.000000000 +0000 7168 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/JCEECPrivateKey.java 2013-05-25 02:14:15.000000000 +0000 7169 @@ -20,8 +20,10 @@ 7170 import org.bouncycastle.asn1.DERInteger; 7171 import org.bouncycastle.asn1.DERNull; 7172 import org.bouncycastle.asn1.DERObjectIdentifier; 7173 -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 7174 -import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 7175 +// BEGIN android-removed 7176 +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 7177 +// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 7178 +// END android-removed 7179 import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 7180 import org.bouncycastle.asn1.sec.ECPrivateKeyStructure; 7181 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 7182 @@ -203,21 +205,23 @@ 7183 ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(params.getParameters()); 7184 X9ECParameters ecP = ECUtil.getNamedCurveByOid(oid); 7185 7186 - if (ecP == null) // GOST Curve 7187 - { 7188 - ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); 7189 - EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); 7190 - 7191 - ecSpec = new ECNamedCurveSpec( 7192 - ECGOST3410NamedCurves.getName(oid), 7193 - ellipticCurve, 7194 - new ECPoint( 7195 - gParam.getG().getX().toBigInteger(), 7196 - gParam.getG().getY().toBigInteger()), 7197 - gParam.getN(), 7198 - gParam.getH()); 7199 - } 7200 - else 7201 + // BEGIN android-removed 7202 + // if (ecP == null) // GOST Curve 7203 + // { 7204 + // ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); 7205 + // EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); 7206 + // 7207 + // ecSpec = new ECNamedCurveSpec( 7208 + // ECGOST3410NamedCurves.getName(oid), 7209 + // ellipticCurve, 7210 + // new ECPoint( 7211 + // gParam.getG().getX().toBigInteger(), 7212 + // gParam.getG().getY().toBigInteger()), 7213 + // gParam.getN(), 7214 + // gParam.getH()); 7215 + // } 7216 + // else 7217 + // END android-removed 7218 { 7219 EllipticCurve ellipticCurve = EC5Util.convertCurve(ecP.getCurve(), ecP.getSeed()); 7220 7221 @@ -331,11 +335,13 @@ 7222 7223 try 7224 { 7225 - if (algorithm.equals("ECGOST3410")) 7226 - { 7227 - info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.toASN1Primitive()), keyStructure.toASN1Primitive()); 7228 - } 7229 - else 7230 + // BEGIN android-removed 7231 + // if (algorithm.equals("ECGOST3410")) 7232 + // { 7233 + // info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.toASN1Primitive()), keyStructure.toASN1Primitive()); 7234 + // } 7235 + // else 7236 + // END android-removed 7237 { 7238 7239 info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.toASN1Primitive()), keyStructure.toASN1Primitive()); 7240 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/JCEECPublicKey.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/JCEECPublicKey.java 7241 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/JCEECPublicKey.java 2013-05-31 21:16:46.000000000 +0000 7242 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/JCEECPublicKey.java 2013-05-25 02:14:15.000000000 +0000 7243 @@ -18,9 +18,11 @@ 7244 import org.bouncycastle.asn1.DERBitString; 7245 import org.bouncycastle.asn1.DERNull; 7246 import org.bouncycastle.asn1.DEROctetString; 7247 -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 7248 -import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 7249 -import org.bouncycastle.asn1.cryptopro.GOST3410PublicKeyAlgParameters; 7250 +// BEGIN android-removed 7251 +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 7252 +// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 7253 +// import org.bouncycastle.asn1.cryptopro.GOST3410PublicKeyAlgParameters; 7254 +// END android-removed 7255 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 7256 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 7257 import org.bouncycastle.asn1.x9.X962Parameters; 7258 @@ -33,9 +35,13 @@ 7259 import org.bouncycastle.jcajce.provider.asymmetric.util.EC5Util; 7260 import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; 7261 import org.bouncycastle.jcajce.provider.asymmetric.util.KeyUtil; 7262 -import org.bouncycastle.jce.ECGOST3410NamedCurveTable; 7263 +// BEGIN android-removed 7264 +// import org.bouncycastle.jce.ECGOST3410NamedCurveTable; 7265 +// END android-removed 7266 import org.bouncycastle.jce.interfaces.ECPointEncoder; 7267 -import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec; 7268 +// BEGIN android-removed 7269 +// import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec; 7270 +// END android-removed 7271 import org.bouncycastle.jce.spec.ECNamedCurveSpec; 7272 import org.bouncycastle.math.ec.ECCurve; 7273 7274 @@ -46,7 +52,9 @@ 7275 private org.bouncycastle.math.ec.ECPoint q; 7276 private ECParameterSpec ecSpec; 7277 private boolean withCompression; 7278 - private GOST3410PublicKeyAlgParameters gostParams; 7279 + // BEGIN android-removed 7280 + // private GOST3410PublicKeyAlgParameters gostParams; 7281 + // END android-removed 7282 7283 public JCEECPublicKey( 7284 String algorithm, 7285 @@ -56,7 +64,9 @@ 7286 this.q = key.q; 7287 this.ecSpec = key.ecSpec; 7288 this.withCompression = key.withCompression; 7289 - this.gostParams = key.gostParams; 7290 + // BEGIN android-removed 7291 + // this.gostParams = key.gostParams; 7292 + // END android-removed 7293 } 7294 7295 public JCEECPublicKey( 7296 @@ -179,54 +189,56 @@ 7297 7298 private void populateFromPubKeyInfo(SubjectPublicKeyInfo info) 7299 { 7300 - if (info.getAlgorithmId().getObjectId().equals(CryptoProObjectIdentifiers.gostR3410_2001)) 7301 - { 7302 - DERBitString bits = info.getPublicKeyData(); 7303 - ASN1OctetString key; 7304 - this.algorithm = "ECGOST3410"; 7305 - 7306 - try 7307 - { 7308 - key = (ASN1OctetString) ASN1Primitive.fromByteArray(bits.getBytes()); 7309 - } 7310 - catch (IOException ex) 7311 - { 7312 - throw new IllegalArgumentException("error recovering public key"); 7313 - } 7314 - 7315 - byte[] keyEnc = key.getOctets(); 7316 - byte[] x = new byte[32]; 7317 - byte[] y = new byte[32]; 7318 - 7319 - for (int i = 0; i != x.length; i++) 7320 - { 7321 - x[i] = keyEnc[32 - 1 - i]; 7322 - } 7323 - 7324 - for (int i = 0; i != y.length; i++) 7325 - { 7326 - y[i] = keyEnc[64 - 1 - i]; 7327 - } 7328 - 7329 - gostParams = new GOST3410PublicKeyAlgParameters((ASN1Sequence)info.getAlgorithmId().getParameters()); 7330 - 7331 - ECNamedCurveParameterSpec spec = ECGOST3410NamedCurveTable.getParameterSpec(ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet())); 7332 - 7333 - ECCurve curve = spec.getCurve(); 7334 - EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getSeed()); 7335 - 7336 - this.q = curve.createPoint(new BigInteger(1, x), new BigInteger(1, y), false); 7337 - 7338 - ecSpec = new ECNamedCurveSpec( 7339 - ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet()), 7340 - ellipticCurve, 7341 - new ECPoint( 7342 - spec.getG().getX().toBigInteger(), 7343 - spec.getG().getY().toBigInteger()), 7344 - spec.getN(), spec.getH()); 7345 - 7346 - } 7347 - else 7348 + // BEGIN android-removed 7349 + // if (info.getAlgorithmId().getObjectId().equals(CryptoProObjectIdentifiers.gostR3410_2001)) 7350 + // { 7351 + // DERBitString bits = info.getPublicKeyData(); 7352 + // ASN1OctetString key; 7353 + // this.algorithm = "ECGOST3410"; 7354 + // 7355 + // try 7356 + // { 7357 + // key = (ASN1OctetString) ASN1Primitive.fromByteArray(bits.getBytes()); 7358 + // } 7359 + // catch (IOException ex) 7360 + // { 7361 + // throw new IllegalArgumentException("error recovering public key"); 7362 + // } 7363 + // 7364 + // byte[] keyEnc = key.getOctets(); 7365 + // byte[] x = new byte[32]; 7366 + // byte[] y = new byte[32]; 7367 + // 7368 + // for (int i = 0; i != x.length; i++) 7369 + // { 7370 + // x[i] = keyEnc[32 - 1 - i]; 7371 + // } 7372 + // 7373 + // for (int i = 0; i != y.length; i++) 7374 + // { 7375 + // y[i] = keyEnc[64 - 1 - i]; 7376 + // } 7377 + // 7378 + // gostParams = new GOST3410PublicKeyAlgParameters((ASN1Sequence)info.getAlgorithmId().getParameters()); 7379 + // 7380 + // ECNamedCurveParameterSpec spec = ECGOST3410NamedCurveTable.getParameterSpec(ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet())); 7381 + // 7382 + // ECCurve curve = spec.getCurve(); 7383 + // EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getSeed()); 7384 + // 7385 + // this.q = curve.createPoint(new BigInteger(1, x), new BigInteger(1, y), false); 7386 + // 7387 + // ecSpec = new ECNamedCurveSpec( 7388 + // ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet()), 7389 + // ellipticCurve, 7390 + // new ECPoint( 7391 + // spec.getG().getX().toBigInteger(), 7392 + // spec.getG().getY().toBigInteger()), 7393 + // spec.getN(), spec.getH()); 7394 + // 7395 + // } 7396 + // else 7397 + // END android-removed 7398 { 7399 X962Parameters params = new X962Parameters((ASN1Primitive)info.getAlgorithmId().getParameters()); 7400 ECCurve curve; 7401 @@ -315,52 +327,54 @@ 7402 ASN1Encodable params; 7403 SubjectPublicKeyInfo info; 7404 7405 - if (algorithm.equals("ECGOST3410")) 7406 - { 7407 - if (gostParams != null) 7408 - { 7409 - params = gostParams; 7410 - } 7411 - else 7412 - { 7413 - if (ecSpec instanceof ECNamedCurveSpec) 7414 - { 7415 - params = new GOST3410PublicKeyAlgParameters( 7416 - ECGOST3410NamedCurves.getOID(((ECNamedCurveSpec)ecSpec).getName()), 7417 - CryptoProObjectIdentifiers.gostR3411_94_CryptoProParamSet); 7418 - } 7419 - else 7420 - { // strictly speaking this may not be applicable... 7421 - ECCurve curve = EC5Util.convertCurve(ecSpec.getCurve()); 7422 - 7423 - X9ECParameters ecP = new X9ECParameters( 7424 - curve, 7425 - EC5Util.convertPoint(curve, ecSpec.getGenerator(), withCompression), 7426 - ecSpec.getOrder(), 7427 - BigInteger.valueOf(ecSpec.getCofactor()), 7428 - ecSpec.getCurve().getSeed()); 7429 - 7430 - params = new X962Parameters(ecP); 7431 - } 7432 - } 7433 - 7434 - BigInteger bX = this.q.getX().toBigInteger(); 7435 - BigInteger bY = this.q.getY().toBigInteger(); 7436 - byte[] encKey = new byte[64]; 7437 - 7438 - extractBytes(encKey, 0, bX); 7439 - extractBytes(encKey, 32, bY); 7440 - 7441 - try 7442 - { 7443 - info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params), new DEROctetString(encKey)); 7444 - } 7445 - catch (IOException e) 7446 - { 7447 - return null; 7448 - } 7449 - } 7450 - else 7451 + // BEGIN android-removed 7452 + // if (algorithm.equals("ECGOST3410")) 7453 + // { 7454 + // if (gostParams != null) 7455 + // { 7456 + // params = gostParams; 7457 + // } 7458 + // else 7459 + // { 7460 + // if (ecSpec instanceof ECNamedCurveSpec) 7461 + // { 7462 + // params = new GOST3410PublicKeyAlgParameters( 7463 + // ECGOST3410NamedCurves.getOID(((ECNamedCurveSpec)ecSpec).getName()), 7464 + // CryptoProObjectIdentifiers.gostR3411_94_CryptoProParamSet); 7465 + // } 7466 + // else 7467 + // { // strictly speaking this may not be applicable... 7468 + // ECCurve curve = EC5Util.convertCurve(ecSpec.getCurve()); 7469 + // 7470 + // X9ECParameters ecP = new X9ECParameters( 7471 + // curve, 7472 + // EC5Util.convertPoint(curve, ecSpec.getGenerator(), withCompression), 7473 + // ecSpec.getOrder(), 7474 + // BigInteger.valueOf(ecSpec.getCofactor()), 7475 + // ecSpec.getCurve().getSeed()); 7476 + // 7477 + // params = new X962Parameters(ecP); 7478 + // } 7479 + // } 7480 + // 7481 + // BigInteger bX = this.q.getX().toBigInteger(); 7482 + // BigInteger bY = this.q.getY().toBigInteger(); 7483 + // byte[] encKey = new byte[64]; 7484 + // 7485 + // extractBytes(encKey, 0, bX); 7486 + // extractBytes(encKey, 32, bY); 7487 + // 7488 + // try 7489 + // { 7490 + // info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params), new DEROctetString(encKey)); 7491 + // } 7492 + // catch (IOException e) 7493 + // { 7494 + // return null; 7495 + // } 7496 + // } 7497 + // else 7498 + // END android-removed 7499 { 7500 if (ecSpec instanceof ECNamedCurveSpec) 7501 { 7502 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/JCEStreamCipher.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/JCEStreamCipher.java 7503 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/JCEStreamCipher.java 2013-05-31 21:16:46.000000000 +0000 7504 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/JCEStreamCipher.java 2013-05-25 02:14:15.000000000 +0000 7505 @@ -23,8 +23,10 @@ 7506 import javax.crypto.ShortBufferException; 7507 import javax.crypto.spec.IvParameterSpec; 7508 import javax.crypto.spec.PBEParameterSpec; 7509 -import javax.crypto.spec.RC2ParameterSpec; 7510 -import javax.crypto.spec.RC5ParameterSpec; 7511 +// BEGIN android-removed 7512 +// import javax.crypto.spec.RC2ParameterSpec; 7513 +// import javax.crypto.spec.RC5ParameterSpec; 7514 +// END android-removed 7515 import javax.crypto.spec.SecretKeySpec; 7516 7517 import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 7518 @@ -33,12 +35,16 @@ 7519 import org.bouncycastle.crypto.DataLengthException; 7520 import org.bouncycastle.crypto.StreamBlockCipher; 7521 import org.bouncycastle.crypto.StreamCipher; 7522 -import org.bouncycastle.crypto.engines.BlowfishEngine; 7523 -import org.bouncycastle.crypto.engines.DESEngine; 7524 -import org.bouncycastle.crypto.engines.DESedeEngine; 7525 +// BEGIN android-removed 7526 +// import org.bouncycastle.crypto.engines.BlowfishEngine; 7527 +// import org.bouncycastle.crypto.engines.DESEngine; 7528 +// import org.bouncycastle.crypto.engines.DESedeEngine; 7529 +// END android-removed 7530 import org.bouncycastle.crypto.engines.RC4Engine; 7531 -import org.bouncycastle.crypto.engines.SkipjackEngine; 7532 -import org.bouncycastle.crypto.engines.TwofishEngine; 7533 +// BEGIN android-removed 7534 +// import org.bouncycastle.crypto.engines.SkipjackEngine; 7535 +// import org.bouncycastle.crypto.engines.TwofishEngine; 7536 +// END android-removed 7537 import org.bouncycastle.crypto.modes.CFBBlockCipher; 7538 import org.bouncycastle.crypto.modes.OFBBlockCipher; 7539 import org.bouncycastle.crypto.params.KeyParameter; 7540 @@ -55,8 +61,10 @@ 7541 // 7542 private Class[] availableSpecs = 7543 { 7544 - RC2ParameterSpec.class, 7545 - RC5ParameterSpec.class, 7546 + // BEGIN android-removed 7547 + // RC2ParameterSpec.class, 7548 + // RC5ParameterSpec.class, 7549 + // END android-removed 7550 IvParameterSpec.class, 7551 PBEParameterSpec.class 7552 }; 7553 @@ -491,123 +499,125 @@ 7554 * The ciphers that inherit from us. 7555 */ 7556 7557 - /** 7558 - * DES 7559 - */ 7560 - static public class DES_CFB8 7561 - extends JCEStreamCipher 7562 - { 7563 - public DES_CFB8() 7564 - { 7565 - super(new CFBBlockCipher(new DESEngine(), 8), 64); 7566 - } 7567 - } 7568 - 7569 - /** 7570 - * DESede 7571 - */ 7572 - static public class DESede_CFB8 7573 - extends JCEStreamCipher 7574 - { 7575 - public DESede_CFB8() 7576 - { 7577 - super(new CFBBlockCipher(new DESedeEngine(), 8), 64); 7578 - } 7579 - } 7580 - 7581 - /** 7582 - * SKIPJACK 7583 - */ 7584 - static public class Skipjack_CFB8 7585 - extends JCEStreamCipher 7586 - { 7587 - public Skipjack_CFB8() 7588 - { 7589 - super(new CFBBlockCipher(new SkipjackEngine(), 8), 64); 7590 - } 7591 - } 7592 - 7593 - /** 7594 - * Blowfish 7595 - */ 7596 - static public class Blowfish_CFB8 7597 - extends JCEStreamCipher 7598 - { 7599 - public Blowfish_CFB8() 7600 - { 7601 - super(new CFBBlockCipher(new BlowfishEngine(), 8), 64); 7602 - } 7603 - } 7604 - 7605 - /** 7606 - * Twofish 7607 - */ 7608 - static public class Twofish_CFB8 7609 - extends JCEStreamCipher 7610 - { 7611 - public Twofish_CFB8() 7612 - { 7613 - super(new CFBBlockCipher(new TwofishEngine(), 8), 128); 7614 - } 7615 - } 7616 - 7617 - /** 7618 - * DES 7619 - */ 7620 - static public class DES_OFB8 7621 - extends JCEStreamCipher 7622 - { 7623 - public DES_OFB8() 7624 - { 7625 - super(new OFBBlockCipher(new DESEngine(), 8), 64); 7626 - } 7627 - } 7628 - 7629 - /** 7630 - * DESede 7631 - */ 7632 - static public class DESede_OFB8 7633 - extends JCEStreamCipher 7634 - { 7635 - public DESede_OFB8() 7636 - { 7637 - super(new OFBBlockCipher(new DESedeEngine(), 8), 64); 7638 - } 7639 - } 7640 - 7641 - /** 7642 - * SKIPJACK 7643 - */ 7644 - static public class Skipjack_OFB8 7645 - extends JCEStreamCipher 7646 - { 7647 - public Skipjack_OFB8() 7648 - { 7649 - super(new OFBBlockCipher(new SkipjackEngine(), 8), 64); 7650 - } 7651 - } 7652 - 7653 - /** 7654 - * Blowfish 7655 - */ 7656 - static public class Blowfish_OFB8 7657 - extends JCEStreamCipher 7658 - { 7659 - public Blowfish_OFB8() 7660 - { 7661 - super(new OFBBlockCipher(new BlowfishEngine(), 8), 64); 7662 - } 7663 - } 7664 - 7665 - /** 7666 - * Twofish 7667 - */ 7668 - static public class Twofish_OFB8 7669 - extends JCEStreamCipher 7670 - { 7671 - public Twofish_OFB8() 7672 - { 7673 - super(new OFBBlockCipher(new TwofishEngine(), 8), 128); 7674 - } 7675 - } 7676 + // BEGIN android-removed 7677 + // /** 7678 + // * DES 7679 + // */ 7680 + // static public class DES_CFB8 7681 + // extends JCEStreamCipher 7682 + // { 7683 + // public DES_CFB8() 7684 + // { 7685 + // super(new CFBBlockCipher(new DESEngine(), 8), 64); 7686 + // } 7687 + // } 7688 + // 7689 + // /** 7690 + // * DESede 7691 + // */ 7692 + // static public class DESede_CFB8 7693 + // extends JCEStreamCipher 7694 + // { 7695 + // public DESede_CFB8() 7696 + // { 7697 + // super(new CFBBlockCipher(new DESedeEngine(), 8), 64); 7698 + // } 7699 + // } 7700 + // 7701 + // /** 7702 + // * SKIPJACK 7703 + // */ 7704 + // static public class Skipjack_CFB8 7705 + // extends JCEStreamCipher 7706 + // { 7707 + // public Skipjack_CFB8() 7708 + // { 7709 + // super(new CFBBlockCipher(new SkipjackEngine(), 8), 64); 7710 + // } 7711 + // } 7712 + // 7713 + // /** 7714 + // * Blowfish 7715 + // */ 7716 + // static public class Blowfish_CFB8 7717 + // extends JCEStreamCipher 7718 + // { 7719 + // public Blowfish_CFB8() 7720 + // { 7721 + // super(new CFBBlockCipher(new BlowfishEngine(), 8), 64); 7722 + // } 7723 + // } 7724 + // 7725 + // /** 7726 + // * Twofish 7727 + // */ 7728 + // static public class Twofish_CFB8 7729 + // extends JCEStreamCipher 7730 + // { 7731 + // public Twofish_CFB8() 7732 + // { 7733 + // super(new CFBBlockCipher(new TwofishEngine(), 8), 128); 7734 + // } 7735 + // } 7736 + // 7737 + // /** 7738 + // * DES 7739 + // */ 7740 + // static public class DES_OFB8 7741 + // extends JCEStreamCipher 7742 + // { 7743 + // public DES_OFB8() 7744 + // { 7745 + // super(new OFBBlockCipher(new DESEngine(), 8), 64); 7746 + // } 7747 + // } 7748 + // 7749 + // /** 7750 + // * DESede 7751 + // */ 7752 + // static public class DESede_OFB8 7753 + // extends JCEStreamCipher 7754 + // { 7755 + // public DESede_OFB8() 7756 + // { 7757 + // super(new OFBBlockCipher(new DESedeEngine(), 8), 64); 7758 + // } 7759 + // } 7760 + // 7761 + // /** 7762 + // * SKIPJACK 7763 + // */ 7764 + // static public class Skipjack_OFB8 7765 + // extends JCEStreamCipher 7766 + // { 7767 + // public Skipjack_OFB8() 7768 + // { 7769 + // super(new OFBBlockCipher(new SkipjackEngine(), 8), 64); 7770 + // } 7771 + // } 7772 + // 7773 + // /** 7774 + // * Blowfish 7775 + // */ 7776 + // static public class Blowfish_OFB8 7777 + // extends JCEStreamCipher 7778 + // { 7779 + // public Blowfish_OFB8() 7780 + // { 7781 + // super(new OFBBlockCipher(new BlowfishEngine(), 8), 64); 7782 + // } 7783 + // } 7784 + // 7785 + // /** 7786 + // * Twofish 7787 + // */ 7788 + // static public class Twofish_OFB8 7789 + // extends JCEStreamCipher 7790 + // { 7791 + // public Twofish_OFB8() 7792 + // { 7793 + // super(new OFBBlockCipher(new TwofishEngine(), 8), 128); 7794 + // } 7795 + // } 7796 + // END android-removed 7797 } 7798 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java 7799 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java 2013-05-31 21:16:46.000000000 +0000 7800 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java 2012-09-17 23:04:47.000000000 +0000 7801 @@ -1,5 +1,8 @@ 7802 package org.bouncycastle.jce.provider; 7803 7804 +// BEGIN android-added 7805 +import java.math.BigInteger; 7806 +// END android-added 7807 import java.security.InvalidAlgorithmParameterException; 7808 import java.security.PublicKey; 7809 import java.security.cert.CertPath; 7810 @@ -33,6 +36,9 @@ 7811 public class PKIXCertPathValidatorSpi 7812 extends CertPathValidatorSpi 7813 { 7814 + // BEGIN android-added 7815 + private final static CertBlacklist blacklist = new CertBlacklist(); 7816 + // END android-added 7817 7818 public CertPathValidatorResult engineValidate( 7819 CertPath certPath, 7820 @@ -75,6 +81,22 @@ 7821 { 7822 throw new CertPathValidatorException("Certification path is empty.", null, certPath, 0); 7823 } 7824 + // BEGIN android-added 7825 + { 7826 + X509Certificate cert = (X509Certificate) certs.get(0); 7827 + 7828 + if (cert != null) { 7829 + BigInteger serial = cert.getSerialNumber(); 7830 + if (blacklist.isSerialNumberBlackListed(serial)) { 7831 + // emulate CRL exception message in RFC3280CertPathUtilities.checkCRLs 7832 + String message = "Certificate revocation of serial 0x" + serial.toString(16); 7833 + System.out.println(message); 7834 + AnnotatedException e = new AnnotatedException(message); 7835 + throw new CertPathValidatorException(e.getMessage(), e, certPath, 0); 7836 + } 7837 + } 7838 + } 7839 + // END android-added 7840 7841 // 7842 // (b) 7843 @@ -251,6 +273,15 @@ 7844 7845 for (index = certs.size() - 1; index >= 0; index--) 7846 { 7847 + // BEGIN android-added 7848 + if (blacklist.isPublicKeyBlackListed(workingPublicKey)) { 7849 + // emulate CRL exception message in RFC3280CertPathUtilities.checkCRLs 7850 + String message = "Certificate revocation of public key " + workingPublicKey; 7851 + System.out.println(message); 7852 + AnnotatedException e = new AnnotatedException(message); 7853 + throw new CertPathValidatorException(e.getMessage(), e, certPath, index); 7854 + } 7855 + // END android-added 7856 // try 7857 // { 7858 // 7859 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/X509CertificateObject.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/X509CertificateObject.java 7860 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/X509CertificateObject.java 2013-05-31 21:16:46.000000000 +0000 7861 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/X509CertificateObject.java 2013-01-31 02:26:40.000000000 +0000 7862 @@ -57,6 +57,9 @@ 7863 import org.bouncycastle.asn1.x509.Extensions; 7864 import org.bouncycastle.asn1.x509.GeneralName; 7865 import org.bouncycastle.asn1.x509.KeyUsage; 7866 +// BEGIN android-added 7867 +import org.bouncycastle.asn1.x509.X509Name; 7868 +// END android-added 7869 import org.bouncycastle.jcajce.provider.asymmetric.util.PKCS12BagAttributeCarrierImpl; 7870 import org.bouncycastle.jce.X509Principal; 7871 import org.bouncycastle.jce.interfaces.PKCS12BagAttributeCarrier; 7872 @@ -562,12 +565,20 @@ 7873 } 7874 } 7875 7876 + // BEGIN android-changed 7877 + private byte[] encoded; 7878 + // END android-changed 7879 public byte[] getEncoded() 7880 throws CertificateEncodingException 7881 { 7882 try 7883 { 7884 - return c.getEncoded(ASN1Encoding.DER); 7885 + // BEGIN android-changed 7886 + if (encoded == null) { 7887 + encoded = c.getEncoded(ASN1Encoding.DER); 7888 + } 7889 + return encoded; 7890 + // END android-changed 7891 } 7892 catch (IOException e) 7893 { 7894 @@ -858,7 +869,9 @@ 7895 list.add(genName.getEncoded()); 7896 break; 7897 case GeneralName.directoryName: 7898 - list.add(X500Name.getInstance(RFC4519Style.INSTANCE, genName.getName()).toString()); 7899 + // BEGIN android-changed 7900 + list.add(X509Name.getInstance(genName.getName()).toString(true, X509Name.DefaultSymbols)); 7901 + // END android-changed 7902 break; 7903 case GeneralName.dNSName: 7904 case GeneralName.rfc822Name: 7905 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/X509SignatureUtil.java bcprov-jdk15on-149/org/bouncycastle/jce/provider/X509SignatureUtil.java 7906 --- bcprov-jdk15on-149.orig/org/bouncycastle/jce/provider/X509SignatureUtil.java 2013-05-31 21:16:46.000000000 +0000 7907 +++ bcprov-jdk15on-149/org/bouncycastle/jce/provider/X509SignatureUtil.java 2013-01-31 02:26:40.000000000 +0000 7908 @@ -14,7 +14,9 @@ 7909 import org.bouncycastle.asn1.ASN1Sequence; 7910 import org.bouncycastle.asn1.DERNull; 7911 import org.bouncycastle.asn1.DERObjectIdentifier; 7912 -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 7913 +// BEGIN android-removed 7914 +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 7915 +// END android-removed 7916 import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; 7917 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 7918 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 7919 @@ -66,12 +68,14 @@ 7920 7921 if (params != null && !derNull.equals(params)) 7922 { 7923 - if (sigAlgId.getObjectId().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) 7924 - { 7925 - RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params); 7926 - 7927 - return getDigestAlgName(rsaParams.getHashAlgorithm().getObjectId()) + "withRSAandMGF1"; 7928 - } 7929 + // BEGIN android-removed 7930 + // if (sigAlgId.getObjectId().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) 7931 + // { 7932 + // RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params); 7933 + // 7934 + // return getDigestAlgName(rsaParams.getHashAlgorithm().getObjectId()) + "withRSAandMGF1"; 7935 + // } 7936 + // END android-removed 7937 if (sigAlgId.getObjectId().equals(X9ObjectIdentifiers.ecdsa_with_SHA2)) 7938 { 7939 ASN1Sequence ecDsaParams = ASN1Sequence.getInstance(params); 7940 @@ -98,10 +102,12 @@ 7941 { 7942 return "SHA1"; 7943 } 7944 - else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 7945 - { 7946 - return "SHA224"; 7947 - } 7948 + // BEGIN android-removed 7949 + // else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 7950 + // { 7951 + // return "SHA224"; 7952 + // } 7953 + // END android-removed 7954 else if (NISTObjectIdentifiers.id_sha256.equals(digestAlgOID)) 7955 { 7956 return "SHA256"; 7957 @@ -114,22 +120,24 @@ 7958 { 7959 return "SHA512"; 7960 } 7961 - else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 7962 - { 7963 - return "RIPEMD128"; 7964 - } 7965 - else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 7966 - { 7967 - return "RIPEMD160"; 7968 - } 7969 - else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 7970 - { 7971 - return "RIPEMD256"; 7972 - } 7973 - else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 7974 - { 7975 - return "GOST3411"; 7976 - } 7977 + // BEGIN android-removed 7978 + // else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 7979 + // { 7980 + // return "RIPEMD128"; 7981 + // } 7982 + // else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 7983 + // { 7984 + // return "RIPEMD160"; 7985 + // } 7986 + // else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 7987 + // { 7988 + // return "RIPEMD256"; 7989 + // } 7990 + // else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 7991 + // { 7992 + // return "GOST3411"; 7993 + // } 7994 + // END android-removed 7995 else 7996 { 7997 return digestAlgOID.getId(); 7998 diff -Naur bcprov-jdk15on-149.orig/org/bouncycastle/x509/X509Util.java bcprov-jdk15on-149/org/bouncycastle/x509/X509Util.java 7999 --- bcprov-jdk15on-149.orig/org/bouncycastle/x509/X509Util.java 2013-05-31 21:16:46.000000000 +0000 8000 +++ bcprov-jdk15on-149/org/bouncycastle/x509/X509Util.java 2013-01-31 02:26:40.000000000 +0000 8001 @@ -25,12 +25,16 @@ 8002 import org.bouncycastle.asn1.ASN1Integer; 8003 import org.bouncycastle.asn1.DERNull; 8004 import org.bouncycastle.asn1.DERObjectIdentifier; 8005 -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 8006 +// BEGIN android-removed 8007 +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 8008 +// END android-removed 8009 import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; 8010 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 8011 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 8012 import org.bouncycastle.asn1.pkcs.RSASSAPSSparams; 8013 -import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 8014 +// BEGIN android-removed 8015 +// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 8016 +// END android-removed 8017 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 8018 import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 8019 import org.bouncycastle.jce.X509Principal; 8020 @@ -44,14 +48,18 @@ 8021 8022 static 8023 { 8024 - algorithms.put("MD2WITHRSAENCRYPTION", PKCSObjectIdentifiers.md2WithRSAEncryption); 8025 - algorithms.put("MD2WITHRSA", PKCSObjectIdentifiers.md2WithRSAEncryption); 8026 + // BEGIN android-removed 8027 + // algorithms.put("MD2WITHRSAENCRYPTION", PKCSObjectIdentifiers.md2WithRSAEncryption); 8028 + // algorithms.put("MD2WITHRSA", PKCSObjectIdentifiers.md2WithRSAEncryption); 8029 + // END android-removed 8030 algorithms.put("MD5WITHRSAENCRYPTION", PKCSObjectIdentifiers.md5WithRSAEncryption); 8031 algorithms.put("MD5WITHRSA", PKCSObjectIdentifiers.md5WithRSAEncryption); 8032 algorithms.put("SHA1WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha1WithRSAEncryption); 8033 algorithms.put("SHA1WITHRSA", PKCSObjectIdentifiers.sha1WithRSAEncryption); 8034 - algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 8035 - algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 8036 + // BEGIN android-removed 8037 + // algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 8038 + // algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 8039 + // END android-removed 8040 algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption); 8041 algorithms.put("SHA256WITHRSA", PKCSObjectIdentifiers.sha256WithRSAEncryption); 8042 algorithms.put("SHA384WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha384WithRSAEncryption); 8043 @@ -59,45 +67,59 @@ 8044 algorithms.put("SHA512WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha512WithRSAEncryption); 8045 algorithms.put("SHA512WITHRSA", PKCSObjectIdentifiers.sha512WithRSAEncryption); 8046 algorithms.put("SHA1WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 8047 - algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 8048 + // BEGIN android-removed 8049 + // algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 8050 + // END android-removed 8051 algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 8052 algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 8053 algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 8054 - algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 8055 - algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 8056 - algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 8057 - algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 8058 - algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 8059 - algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 8060 + // BEGIN android-removed 8061 + // algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 8062 + // algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 8063 + // algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 8064 + // algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 8065 + // algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 8066 + // algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 8067 + // END android-removed 8068 algorithms.put("SHA1WITHDSA", X9ObjectIdentifiers.id_dsa_with_sha1); 8069 algorithms.put("DSAWITHSHA1", X9ObjectIdentifiers.id_dsa_with_sha1); 8070 - algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 8071 + // BEGIN android-removed 8072 + // algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 8073 + // END android-removed 8074 algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256); 8075 algorithms.put("SHA384WITHDSA", NISTObjectIdentifiers.dsa_with_sha384); 8076 algorithms.put("SHA512WITHDSA", NISTObjectIdentifiers.dsa_with_sha512); 8077 algorithms.put("SHA1WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1); 8078 algorithms.put("ECDSAWITHSHA1", X9ObjectIdentifiers.ecdsa_with_SHA1); 8079 - algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 8080 + // BEGIN android-removed 8081 + // algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 8082 + // END android-removed 8083 algorithms.put("SHA256WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256); 8084 algorithms.put("SHA384WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); 8085 algorithms.put("SHA512WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); 8086 - algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 8087 - algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 8088 - algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8089 - algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8090 - algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8091 + // BEGIN android-removed 8092 + // algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 8093 + // algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 8094 + // algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8095 + // algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8096 + // algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8097 + // END android-removed 8098 8099 // 8100 // According to RFC 3279, the ASN.1 encoding SHALL (id-dsa-with-sha1) or MUST (ecdsa-with-SHA*) omit the parameters field. 8101 // The parameters field SHALL be NULL for RSA based signature algorithms. 8102 // 8103 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA1); 8104 - noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 8105 + // BEGIN android-removed 8106 + // noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 8107 + // END android-removed 8108 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA256); 8109 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA384); 8110 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA512); 8111 noParams.add(X9ObjectIdentifiers.id_dsa_with_sha1); 8112 - noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 8113 + // BEGIN android-removed 8114 + // noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 8115 + // END android-removed 8116 noParams.add(NISTObjectIdentifiers.dsa_with_sha256); 8117 noParams.add(NISTObjectIdentifiers.dsa_with_sha384); 8118 noParams.add(NISTObjectIdentifiers.dsa_with_sha512); 8119 @@ -105,8 +127,10 @@ 8120 // 8121 // RFC 4491 8122 // 8123 - noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 8124 - noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8125 + // BEGIN android-removed 8126 + // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 8127 + // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 8128 + // END android-removed 8129 8130 // 8131 // explicit params 8132 @@ -114,8 +138,10 @@ 8133 AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE); 8134 params.put("SHA1WITHRSAANDMGF1", creatPSSParams(sha1AlgId, 20)); 8135 8136 - AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, DERNull.INSTANCE); 8137 - params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 8138 + // BEGIN android-removed 8139 + // AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, DERNull.INSTANCE); 8140 + // params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 8141 + // END android-removed 8142 8143 AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, DERNull.INSTANCE); 8144 params.put("SHA256WITHRSAANDMGF1", creatPSSParams(sha256AlgId, 32)); 8145