1diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/ASN1InputStream.java bcprov-jdk16-146/org/bouncycastle/asn1/ASN1InputStream.java 2--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/ASN1InputStream.java 2011-02-23 20:08:56.000000000 +0000 3+++ bcprov-jdk16-146/org/bouncycastle/asn1/ASN1InputStream.java 2012-05-11 05:31:26.610725423 +0000 4@@ -363,7 +363,9 @@ 5 case BMP_STRING: 6 return new DERBMPString(bytes); 7 case BOOLEAN: 8- return new ASN1Boolean(bytes); 9+ // BEGIN android-changed 10+ return DERBoolean.getInstance(bytes); 11+ // END android-changed 12 case ENUMERATED: 13 return new ASN1Enumerated(bytes); 14 case GENERALIZED_TIME: 15diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/ASN1Null.java bcprov-jdk16-146/org/bouncycastle/asn1/ASN1Null.java 16--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/ASN1Null.java 2011-02-23 20:08:56.000000000 +0000 17+++ bcprov-jdk16-146/org/bouncycastle/asn1/ASN1Null.java 2012-05-11 05:31:26.610725423 +0000 18@@ -8,9 +8,11 @@ 19 public abstract class ASN1Null 20 extends ASN1Object 21 { 22- public ASN1Null() 23+ // BEGIN android-changed 24+ /*package*/ ASN1Null() 25 { 26 } 27+ // END android-changed 28 29 public int hashCode() 30 { 31diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERBoolean.java bcprov-jdk16-146/org/bouncycastle/asn1/DERBoolean.java 32--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERBoolean.java 2011-02-23 20:08:56.000000000 +0000 33+++ bcprov-jdk16-146/org/bouncycastle/asn1/DERBoolean.java 2012-05-11 05:31:26.610725423 +0000 34@@ -5,7 +5,9 @@ 35 public class DERBoolean 36 extends ASN1Object 37 { 38- byte value; 39+ // BEGIN android-changed 40+ private final byte value; 41+ // END android-changed 42 43 public static final DERBoolean FALSE = new DERBoolean(false); 44 public static final DERBoolean TRUE = new DERBoolean(true); 45@@ -35,6 +37,17 @@ 46 return (value ? TRUE : FALSE); 47 } 48 49+ // BEGIN android-added 50+ /** 51+ * return a DERBoolean from the passed in array. 52+ */ 53+ public static DERBoolean getInstance( 54+ byte[] octets) 55+ { 56+ return (octets[0] != 0) ? TRUE : FALSE; 57+ } 58+ // END android-added 59+ 60 /** 61 * return a Boolean from a tagged object. 62 * 63@@ -56,23 +69,29 @@ 64 } 65 else 66 { 67- return new DERBoolean(((ASN1OctetString)o).getOctets()); 68+ // BEGIN android-changed 69+ return getInstance(((ASN1OctetString)o).getOctets()); 70+ // END android-changed 71 } 72 } 73 74- public DERBoolean( 75- byte[] value) 76- { 77- if (value.length != 1) 78- { 79- throw new IllegalArgumentException("byte value should have 1 byte in it"); 80- } 81- 82- this.value = value[0]; 83- } 84+ // BEGIN android-removed 85+ // public DERBoolean( 86+ // byte[] value) 87+ // { 88+ // if (value.length != 1) 89+ // { 90+ // throw new IllegalArgumentException("byte value should have 1 byte in it"); 91+ // } 92+ // 93+ // this.value = value[0]; 94+ // } 95+ // END android-removed 96 97- public DERBoolean( 98+ // BEGIN android-changed 99+ protected DERBoolean( 100 boolean value) 101+ // END android-changed 102 { 103 this.value = (value) ? (byte)0xff : (byte)0; 104 } 105diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERNull.java bcprov-jdk16-146/org/bouncycastle/asn1/DERNull.java 106--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERNull.java 2011-02-23 20:08:56.000000000 +0000 107+++ bcprov-jdk16-146/org/bouncycastle/asn1/DERNull.java 2012-05-11 05:31:26.610725423 +0000 108@@ -10,9 +10,13 @@ 109 { 110 public static final DERNull INSTANCE = new DERNull(); 111 112- byte[] zeroBytes = new byte[0]; 113+ // BEGIN android-changed 114+ private static final byte[] zeroBytes = new byte[0]; 115+ // END android-changed 116 117- public DERNull() 118+ // BEGIN android-changed 119+ protected DERNull() 120+ // END android-changed 121 { 122 } 123 124diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERObjectIdentifier.java bcprov-jdk16-146/org/bouncycastle/asn1/DERObjectIdentifier.java 125--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERObjectIdentifier.java 2011-02-23 20:08:56.000000000 +0000 126+++ bcprov-jdk16-146/org/bouncycastle/asn1/DERObjectIdentifier.java 2012-05-11 05:31:26.610725423 +0000 127@@ -110,7 +110,13 @@ 128 } 129 } 130 131- this.identifier = objId.toString(); 132+ // BEGIN android-changed 133+ /* 134+ * Intern the identifier so there aren't hundreds of duplicates 135+ * (in practice). 136+ */ 137+ this.identifier = objId.toString().intern(); 138+ // END android-changed 139 } 140 141 public DERObjectIdentifier( 142@@ -121,7 +127,13 @@ 143 throw new IllegalArgumentException("string " + identifier + " not an OID"); 144 } 145 146- this.identifier = identifier; 147+ // BEGIN android-changed 148+ /* 149+ * Intern the identifier so there aren't hundreds of duplicates 150+ * (in practice). 151+ */ 152+ this.identifier = identifier.intern(); 153+ // END android-changed 154 } 155 156 public String getId() 157diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERPrintableString.java bcprov-jdk16-146/org/bouncycastle/asn1/DERPrintableString.java 158--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/DERPrintableString.java 2011-02-23 20:08:56.000000000 +0000 159+++ bcprov-jdk16-146/org/bouncycastle/asn1/DERPrintableString.java 2012-05-11 05:31:26.620725599 +0000 160@@ -9,7 +9,9 @@ 161 extends ASN1Object 162 implements DERString 163 { 164- String string; 165+ // BEGIN android-changed 166+ private final String string; 167+ // END android-changed 168 169 /** 170 * return a printable string from the passed in object. 171@@ -65,7 +67,9 @@ 172 cs[i] = (char)(string[i] & 0xff); 173 } 174 175- this.string = new String(cs); 176+ // BEGIN android-changed 177+ this.string = new String(cs).intern(); 178+ // END android-changed 179 } 180 181 /** 182@@ -94,7 +98,9 @@ 183 throw new IllegalArgumentException("string contains illegal characters"); 184 } 185 186- this.string = string; 187+ // BEGIN android-changed 188+ this.string = string.intern(); 189+ // END android-changed 190 } 191 192 public String getString() 193diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/cms/ContentInfo.java bcprov-jdk16-146/org/bouncycastle/asn1/cms/ContentInfo.java 194--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/cms/ContentInfo.java 2011-02-23 20:08:56.000000000 +0000 195+++ bcprov-jdk16-146/org/bouncycastle/asn1/cms/ContentInfo.java 2012-05-11 05:31:26.620725599 +0000 196@@ -12,7 +12,9 @@ 197 198 public class ContentInfo 199 extends ASN1Encodable 200- implements CMSObjectIdentifiers 201+ // BEGIN android-removed 202+ // implements CMSObjectIdentifiers 203+ // END android-removed 204 { 205 private ASN1ObjectIdentifier contentType; 206 private DEREncodable content; 207diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java 208--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java 2011-02-23 20:08:56.000000000 +0000 209+++ bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java 2012-05-11 05:31:26.610725423 +0000 210@@ -37,10 +37,13 @@ 211 public static EncryptedPrivateKeyInfo getInstance( 212 Object obj) 213 { 214- if (obj instanceof EncryptedData) 215+ // BEGIN android-changed 216+ // fix copy and paste error in instanceof call 217+ if (obj instanceof EncryptedPrivateKeyInfo) 218 { 219 return (EncryptedPrivateKeyInfo)obj; 220 } 221+ // END android-changed 222 else if (obj instanceof ASN1Sequence) 223 { 224 return new EncryptedPrivateKeyInfo((ASN1Sequence)obj); 225diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 226--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2011-02-23 20:08:56.000000000 +0000 227+++ bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2012-05-11 05:31:26.610725423 +0000 228@@ -10,8 +10,10 @@ 229 // 230 static final ASN1ObjectIdentifier pkcs_1 = new ASN1ObjectIdentifier("1.2.840.113549.1.1"); 231 static final ASN1ObjectIdentifier rsaEncryption = pkcs_1.branch("1"); 232- static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2"); 233- static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3"); 234+ // BEGIN android-removed 235+ // static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2"); 236+ // static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3"); 237+ // END android-removed 238 static final ASN1ObjectIdentifier md5WithRSAEncryption = pkcs_1.branch("4"); 239 static final ASN1ObjectIdentifier sha1WithRSAEncryption = pkcs_1.branch("5"); 240 static final ASN1ObjectIdentifier srsaOAEPEncryptionSET = pkcs_1.branch("6"); 241@@ -22,7 +24,9 @@ 242 static final ASN1ObjectIdentifier sha256WithRSAEncryption = pkcs_1.branch("11"); 243 static final ASN1ObjectIdentifier sha384WithRSAEncryption = pkcs_1.branch("12"); 244 static final ASN1ObjectIdentifier sha512WithRSAEncryption = pkcs_1.branch("13"); 245- static final ASN1ObjectIdentifier sha224WithRSAEncryption = pkcs_1.branch("14"); 246+ // BEGIN android-removed 247+ // static final ASN1ObjectIdentifier sha224WithRSAEncryption = pkcs_1.branch("14"); 248+ // END android-removed 249 250 // 251 // pkcs-3 OBJECT IDENTIFIER ::= { 252@@ -65,13 +69,17 @@ 253 // md2 OBJECT IDENTIFIER ::= 254 // {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 2} 255 // 256- static final ASN1ObjectIdentifier md2 = digestAlgorithm.branch("2"); 257+ // BEGIN android-removed 258+ // static final ASN1ObjectIdentifier md2 = digestAlgorithm.branch("2"); 259+ // END android-removed 260 261 // 262 // md4 OBJECT IDENTIFIER ::= 263 // {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 4} 264 // 265- static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4"); 266+ // BEGIN android-removed 267+ // static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4"); 268+ // END android-removed 269 270 // 271 // md5 OBJECT IDENTIFIER ::= 272@@ -80,7 +88,9 @@ 273 static final ASN1ObjectIdentifier md5 = digestAlgorithm.branch("5"); 274 275 static final ASN1ObjectIdentifier id_hmacWithSHA1 = digestAlgorithm.branch("7"); 276- static final ASN1ObjectIdentifier id_hmacWithSHA224 = digestAlgorithm.branch("8"); 277+ // BEGIN android-removed 278+ // static final ASN1ObjectIdentifier id_hmacWithSHA224 = digestAlgorithm.branch("8"); 279+ // END android-removed 280 static final ASN1ObjectIdentifier id_hmacWithSHA256 = digestAlgorithm.branch("9"); 281 static final ASN1ObjectIdentifier id_hmacWithSHA384 = digestAlgorithm.branch("10"); 282 static final ASN1ObjectIdentifier id_hmacWithSHA512 = digestAlgorithm.branch("11"); 283diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/RSAESOAEPparams.java bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/RSAESOAEPparams.java 284--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/RSAESOAEPparams.java 2011-02-23 20:08:56.000000000 +0000 285+++ bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/RSAESOAEPparams.java 2012-05-11 05:31:26.610725423 +0000 286@@ -19,7 +19,9 @@ 287 private AlgorithmIdentifier maskGenAlgorithm; 288 private AlgorithmIdentifier pSourceAlgorithm; 289 290- public final static AlgorithmIdentifier DEFAULT_HASH_ALGORITHM = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, new DERNull()); 291+ // BEGIN android-changed 292+ public final static AlgorithmIdentifier DEFAULT_HASH_ALGORITHM = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE); 293+ // END android-changed 294 public final static AlgorithmIdentifier DEFAULT_MASK_GEN_FUNCTION = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1, DEFAULT_HASH_ALGORITHM); 295 public final static AlgorithmIdentifier DEFAULT_P_SOURCE_ALGORITHM = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified, new DEROctetString(new byte[0])); 296 297diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/RSASSAPSSparams.java bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/RSASSAPSSparams.java 298--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/pkcs/RSASSAPSSparams.java 2011-02-23 20:08:56.000000000 +0000 299+++ bcprov-jdk16-146/org/bouncycastle/asn1/pkcs/RSASSAPSSparams.java 2012-05-11 05:31:26.610725423 +0000 300@@ -20,7 +20,9 @@ 301 private DERInteger saltLength; 302 private DERInteger trailerField; 303 304- public final static AlgorithmIdentifier DEFAULT_HASH_ALGORITHM = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, new DERNull()); 305+ // BEGIN android-changed 306+ public final static AlgorithmIdentifier DEFAULT_HASH_ALGORITHM = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE); 307+ // END android-changed 308 public final static AlgorithmIdentifier DEFAULT_MASK_GEN_FUNCTION = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1, DEFAULT_HASH_ALGORITHM); 309 public final static DERInteger DEFAULT_SALT_LENGTH = new DERInteger(20); 310 public final static DERInteger DEFAULT_TRAILER_FIELD = new DERInteger(1); 311diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/util/ASN1Dump.java bcprov-jdk16-146/org/bouncycastle/asn1/util/ASN1Dump.java 312--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/util/ASN1Dump.java 2011-02-23 20:08:56.000000000 +0000 313+++ bcprov-jdk16-146/org/bouncycastle/asn1/util/ASN1Dump.java 2012-05-11 05:31:26.620725599 +0000 314@@ -79,7 +79,9 @@ 315 { 316 Object o = e.nextElement(); 317 318- if (o == null || o.equals(new DERNull())) 319+ // BEGIN android-changed 320+ if (o == null || o.equals(DERNull.INSTANCE)) 321+ // END android-changed 322 { 323 buf.append(tab); 324 buf.append("NULL"); 325diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/AttCertIssuer.java bcprov-jdk16-146/org/bouncycastle/asn1/x509/AttCertIssuer.java 326--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/AttCertIssuer.java 2011-02-23 20:08:56.000000000 +0000 327+++ bcprov-jdk16-146/org/bouncycastle/asn1/x509/AttCertIssuer.java 2012-05-11 05:31:26.610725423 +0000 328@@ -45,7 +45,7 @@ 329 ASN1TaggedObject obj, 330 boolean explicit) 331 { 332- return getInstance(obj.getObject()); // must be explictly tagged 333+ return getInstance(obj.getObject()); // must be explicitly tagged 334 } 335 336 /** 337diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/BasicConstraints.java bcprov-jdk16-146/org/bouncycastle/asn1/x509/BasicConstraints.java 338--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/BasicConstraints.java 2011-02-23 20:08:56.000000000 +0000 339+++ bcprov-jdk16-146/org/bouncycastle/asn1/x509/BasicConstraints.java 2012-05-11 05:31:26.610725423 +0000 340@@ -14,7 +14,9 @@ 341 public class BasicConstraints 342 extends ASN1Encodable 343 { 344- DERBoolean cA = new DERBoolean(false); 345+ // BEGIN android-changed 346+ DERBoolean cA = DERBoolean.FALSE; 347+ // END android-changed 348 DERInteger pathLenConstraint = null; 349 350 public static BasicConstraints getInstance( 351@@ -89,7 +91,9 @@ 352 { 353 if (cA) 354 { 355- this.cA = new DERBoolean(cA); 356+ // BEGIN android-changed 357+ this.cA = DERBoolean.getInstance(cA); 358+ // END android-changed 359 this.pathLenConstraint = new DERInteger(pathLenConstraint); 360 } 361 else 362@@ -104,7 +108,9 @@ 363 { 364 if (cA) 365 { 366- this.cA = new DERBoolean(true); 367+ // BEGIN android-changed 368+ this.cA = DERBoolean.TRUE; 369+ // END android-changed 370 } 371 else 372 { 373@@ -121,7 +127,9 @@ 374 public BasicConstraints( 375 int pathLenConstraint) 376 { 377- this.cA = new DERBoolean(true); 378+ // BEGIN android-changed 379+ this.cA = DERBoolean.TRUE; 380+ // END android-changed 381 this.pathLenConstraint = new DERInteger(pathLenConstraint); 382 } 383 384diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/IssuingDistributionPoint.java bcprov-jdk16-146/org/bouncycastle/asn1/x509/IssuingDistributionPoint.java 385--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/IssuingDistributionPoint.java 2011-02-23 20:08:56.000000000 +0000 386+++ bcprov-jdk16-146/org/bouncycastle/asn1/x509/IssuingDistributionPoint.java 2012-05-11 05:31:26.610725423 +0000 387@@ -96,11 +96,15 @@ 388 } 389 if (onlyContainsUserCerts) 390 { 391- vec.add(new DERTaggedObject(false, 1, new DERBoolean(true))); 392+ // BEGIN android-changed 393+ vec.add(new DERTaggedObject(false, 1, DERBoolean.TRUE)); 394+ // END android-changed 395 } 396 if (onlyContainsCACerts) 397 { 398- vec.add(new DERTaggedObject(false, 2, new DERBoolean(true))); 399+ // BEGIN android-changed 400+ vec.add(new DERTaggedObject(false, 2, DERBoolean.TRUE)); 401+ // END android-changed 402 } 403 if (onlySomeReasons != null) 404 { 405@@ -108,11 +112,15 @@ 406 } 407 if (indirectCRL) 408 { 409- vec.add(new DERTaggedObject(false, 4, new DERBoolean(true))); 410+ // BEGIN android-changed 411+ vec.add(new DERTaggedObject(false, 4, DERBoolean.TRUE)); 412+ // END android-changed 413 } 414 if (onlyContainsAttributeCerts) 415 { 416- vec.add(new DERTaggedObject(false, 5, new DERBoolean(true))); 417+ // BEGIN android-changed 418+ vec.add(new DERTaggedObject(false, 5, DERBoolean.TRUE)); 419+ // END android-changed 420 } 421 422 seq = new DERSequence(vec); 423diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/X509Extensions.java bcprov-jdk16-146/org/bouncycastle/asn1/x509/X509Extensions.java 424--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/X509Extensions.java 2011-02-23 20:08:56.000000000 +0000 425+++ bcprov-jdk16-146/org/bouncycastle/asn1/x509/X509Extensions.java 2012-05-11 05:31:26.610725423 +0000 426@@ -400,7 +400,9 @@ 427 428 if (ext.isCritical()) 429 { 430- v.add(new DERBoolean(true)); 431+ // BEGIN android-changed 432+ v.add(DERBoolean.TRUE); 433+ // END android-changed 434 } 435 436 v.add(ext.getValue()); 437diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/X509Name.java bcprov-jdk16-146/org/bouncycastle/asn1/x509/X509Name.java 438--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/X509Name.java 2011-02-23 20:08:56.000000000 +0000 439+++ bcprov-jdk16-146/org/bouncycastle/asn1/x509/X509Name.java 2012-05-11 05:31:26.610725423 +0000 440@@ -249,8 +249,10 @@ 441 */ 442 public static final Hashtable SymbolLookUp = DefaultLookUp; 443 444- private static final Boolean TRUE = new Boolean(true); // for J2ME compatibility 445- private static final Boolean FALSE = new Boolean(false); 446+ // BEGIN android-changed 447+ private static final Boolean TRUE = Boolean.TRUE; 448+ private static final Boolean FALSE = Boolean.FALSE; 449+ // END android-changed 450 451 static 452 { 453@@ -432,7 +434,9 @@ 454 { 455 values.addElement("#" + bytesToString(Hex.encode(value.getDERObject().getDEREncoded()))); 456 } 457- added.addElement((i != 0) ? TRUE : FALSE); // to allow earlier JDK compatibility 458+ // BEGIN android-changed 459+ added.addElement(Boolean.valueOf(i != 0)); 460+ // END android-changed 461 } 462 } 463 } 464@@ -689,7 +693,9 @@ 465 466 if (index == -1) 467 { 468- throw new IllegalArgumentException("badly formated directory string"); 469+ // BEGIN android-changed 470+ throw new IllegalArgumentException("badly formatted directory string"); 471+ // END android-changed 472 } 473 474 String name = token.substring(0, index); 475diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java bcprov-jdk16-146/org/bouncycastle/asn1/x509/X509NameTokenizer.java 476--- bcprov-jdk16-146.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2011-02-23 20:08:56.000000000 +0000 477+++ bcprov-jdk16-146/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2012-05-11 05:31:26.610725423 +0000 478@@ -58,6 +58,17 @@ 479 } 480 else 481 { 482+ // BEGIN android-added 483+ // copied from a newer version of BouncyCastle 484+ if (c == '#' && buf.charAt(buf.length() - 1) == '=') 485+ { 486+ buf.append('\\'); 487+ } 488+ else if (c == '+' && seperator != '+') 489+ { 490+ buf.append('\\'); 491+ } 492+ // END android-added 493 buf.append(c); 494 } 495 escaped = false; 496@@ -96,4 +107,4 @@ 497 index = end; 498 return buf.toString().trim(); 499 } 500-} 501+} 502\ No newline at end of file 503diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/PBEParametersGenerator.java bcprov-jdk16-146/org/bouncycastle/crypto/PBEParametersGenerator.java 504--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/PBEParametersGenerator.java 2011-02-23 20:08:56.000000000 +0000 505+++ bcprov-jdk16-146/org/bouncycastle/crypto/PBEParametersGenerator.java 2012-05-11 05:31:26.620725599 +0000 506@@ -136,7 +136,8 @@ 507 public static byte[] PKCS12PasswordToBytes( 508 char[] password) 509 { 510- if (password.length > 0) 511+ // BEGIN android-changed 512+ if (password != null && password.length > 0) 513 { 514 // +1 for extra 2 pad bytes. 515 byte[] bytes = new byte[(password.length + 1) * 2]; 516@@ -153,5 +154,6 @@ 517 { 518 return new byte[0]; 519 } 520+ // END android-changed 521 } 522 } 523diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java bcprov-jdk16-146/org/bouncycastle/crypto/digests/OpenSSLDigest.java 524--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java 1970-01-01 00:00:00.000000000 +0000 525+++ bcprov-jdk16-146/org/bouncycastle/crypto/digests/OpenSSLDigest.java 2012-05-11 05:31:26.620725599 +0000 526@@ -0,0 +1,159 @@ 527+/* 528+ * Copyright (C) 2008 The Android Open Source Project 529+ * 530+ * Licensed under the Apache License, Version 2.0 (the "License"); 531+ * you may not use this file except in compliance with the License. 532+ * You may obtain a copy of the License at 533+ * 534+ * http://www.apache.org/licenses/LICENSE-2.0 535+ * 536+ * Unless required by applicable law or agreed to in writing, software 537+ * distributed under the License is distributed on an "AS IS" BASIS, 538+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 539+ * See the License for the specific language governing permissions and 540+ * limitations under the License. 541+ */ 542+ 543+package org.bouncycastle.crypto.digests; 544+ 545+import org.apache.harmony.xnet.provider.jsse.NativeCrypto; 546+import org.bouncycastle.crypto.ExtendedDigest; 547+ 548+/** 549+ * Implements the BouncyCastle Digest interface using OpenSSL's EVP API. 550+ */ 551+public class OpenSSLDigest implements ExtendedDigest { 552+ 553+ /** 554+ * Holds the standard name of the hashing algorithm, e.g. "SHA-1"; 555+ */ 556+ private final String algorithm; 557+ 558+ /** 559+ * Holds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1"); 560+ */ 561+ private final int evp_md; 562+ 563+ /** 564+ * Holds the output size of the message digest. 565+ */ 566+ private final int size; 567+ 568+ /** 569+ * Holds the block size of the message digest. 570+ */ 571+ private final int blockSize; 572+ 573+ /** 574+ * Holds a pointer to the native message digest context. It is 575+ * lazily initialized to avoid having to reallocate on reset when 576+ * its unlikely to be reused. 577+ */ 578+ private int ctx; 579+ 580+ /** 581+ * Holds a dummy buffer for writing single bytes to the digest. 582+ */ 583+ private final byte[] singleByte = new byte[1]; 584+ 585+ /** 586+ * Creates a new OpenSSLMessageDigest instance for the given algorithm 587+ * name. 588+ */ 589+ private OpenSSLDigest(String algorithm, int evp_md, int size, int blockSize) { 590+ this.algorithm = algorithm; 591+ this.evp_md = evp_md; 592+ this.size = size; 593+ this.blockSize = blockSize; 594+ } 595+ 596+ public String getAlgorithmName() { 597+ return algorithm; 598+ } 599+ 600+ public int getDigestSize() { 601+ return size; 602+ } 603+ 604+ public int getByteLength() { 605+ return blockSize; 606+ } 607+ 608+ public void reset() { 609+ free(); 610+ } 611+ 612+ public void update(byte in) { 613+ singleByte[0] = in; 614+ update(singleByte, 0, 1); 615+ } 616+ 617+ public void update(byte[] in, int inOff, int len) { 618+ NativeCrypto.EVP_DigestUpdate(getCtx(), in, inOff, len); 619+ } 620+ 621+ public int doFinal(byte[] out, int outOff) { 622+ int i = NativeCrypto.EVP_DigestFinal(getCtx(), out, outOff); 623+ ctx = 0; // EVP_DigestFinal frees the context as a side effect 624+ reset(); 625+ return i; 626+ } 627+ 628+ private int getCtx() { 629+ if (ctx == 0) { 630+ ctx = NativeCrypto.EVP_DigestInit(evp_md); 631+ } 632+ return ctx; 633+ } 634+ 635+ private void free() { 636+ if (ctx != 0) { 637+ NativeCrypto.EVP_MD_CTX_destroy(ctx); 638+ ctx = 0; 639+ } 640+ } 641+ 642+ @Override 643+ protected void finalize() throws Throwable { 644+ try { 645+ free(); 646+ } finally { 647+ super.finalize(); 648+ } 649+ } 650+ 651+ public static class MD5 extends OpenSSLDigest { 652+ private static final int EVP_MD = NativeCrypto.EVP_get_digestbyname("md5"); 653+ private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 654+ private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 655+ public MD5() { super("MD5", EVP_MD, SIZE, BLOCK_SIZE); } 656+ } 657+ 658+ public static class SHA1 extends OpenSSLDigest { 659+ private static final int EVP_MD = NativeCrypto.EVP_get_digestbyname("sha1"); 660+ private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 661+ private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 662+ public SHA1() { super("SHA-1", EVP_MD, SIZE, BLOCK_SIZE); } 663+ } 664+ 665+ public static class SHA256 extends OpenSSLDigest { 666+ private static final int EVP_MD = NativeCrypto.EVP_get_digestbyname("sha256"); 667+ private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 668+ private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 669+ public SHA256() { super("SHA-256", EVP_MD, SIZE, BLOCK_SIZE); } 670+ } 671+ 672+ public static class SHA384 extends OpenSSLDigest { 673+ private static final int EVP_MD = NativeCrypto.EVP_get_digestbyname("sha384"); 674+ private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 675+ private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 676+ public SHA384() { super("SHA-384", EVP_MD, SIZE, BLOCK_SIZE); } 677+ } 678+ 679+ public static class SHA512 extends OpenSSLDigest { 680+ private static final int EVP_MD = NativeCrypto.EVP_get_digestbyname("sha512"); 681+ private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); 682+ private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); 683+ public SHA512() { super("SHA-512", EVP_MD, SIZE, BLOCK_SIZE); } 684+ } 685+} 686diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/engines/RC2Engine.java bcprov-jdk16-146/org/bouncycastle/crypto/engines/RC2Engine.java 687--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/engines/RC2Engine.java 2011-02-23 20:08:56.000000000 +0000 688+++ bcprov-jdk16-146/org/bouncycastle/crypto/engines/RC2Engine.java 2012-05-11 05:31:26.620725599 +0000 689@@ -313,4 +313,4 @@ 690 out[outOff + 6] = (byte)x76; 691 out[outOff + 7] = (byte)(x76 >> 8); 692 } 693-} 694+} 695\ No newline at end of file 696diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java bcprov-jdk16-146/org/bouncycastle/crypto/generators/DHParametersHelper.java 697--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java 2011-02-23 20:08:56.000000000 +0000 698+++ bcprov-jdk16-146/org/bouncycastle/crypto/generators/DHParametersHelper.java 2012-05-11 05:31:26.620725599 +0000 699@@ -3,10 +3,17 @@ 700 import java.math.BigInteger; 701 import java.security.SecureRandom; 702 703+// BEGIN android-added 704+import java.util.logging.Logger; 705+// END android-added 706 import org.bouncycastle.util.BigIntegers; 707 708 class DHParametersHelper 709 { 710+ // BEGIN android-added 711+ private static final Logger logger = Logger.getLogger(DHParametersHelper.class.getName()); 712+ // END android-added 713+ 714 private static final BigInteger ONE = BigInteger.valueOf(1); 715 private static final BigInteger TWO = BigInteger.valueOf(2); 716 717@@ -17,11 +24,19 @@ 718 */ 719 static BigInteger[] generateSafePrimes(int size, int certainty, SecureRandom random) 720 { 721+ // BEGIN android-added 722+ logger.info("Generating safe primes. This may take a long time."); 723+ long start = System.currentTimeMillis(); 724+ int tries = 0; 725+ // END android-added 726 BigInteger p, q; 727 int qLength = size - 1; 728 729 for (;;) 730 { 731+ // BEGIN android-added 732+ tries++; 733+ // END android-added 734 q = new BigInteger(qLength, 2, random); 735 736 // p <- 2q + 1 737@@ -32,6 +47,11 @@ 738 break; 739 } 740 } 741+ // BEGIN android-added 742+ long end = System.currentTimeMillis(); 743+ long duration = end - start; 744+ logger.info("Generated safe primes: " + tries + " tries took " + duration + "ms"); 745+ // END android-added 746 747 return new BigInteger[] { p, q }; 748 } 749diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/macs/HMac.java bcprov-jdk16-146/org/bouncycastle/crypto/macs/HMac.java 750--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/macs/HMac.java 2011-02-23 20:08:56.000000000 +0000 751+++ bcprov-jdk16-146/org/bouncycastle/crypto/macs/HMac.java 2012-05-11 05:31:26.620725599 +0000 752@@ -32,23 +32,23 @@ 753 { 754 blockLengths = new Hashtable(); 755 756- blockLengths.put("GOST3411", new Integer(32)); 757+ blockLengths.put("GOST3411", Integer.valueOf(32)); 758 759- blockLengths.put("MD2", new Integer(16)); 760- blockLengths.put("MD4", new Integer(64)); 761- blockLengths.put("MD5", new Integer(64)); 762- 763- blockLengths.put("RIPEMD128", new Integer(64)); 764- blockLengths.put("RIPEMD160", new Integer(64)); 765- 766- blockLengths.put("SHA-1", new Integer(64)); 767- blockLengths.put("SHA-224", new Integer(64)); 768- blockLengths.put("SHA-256", new Integer(64)); 769- blockLengths.put("SHA-384", new Integer(128)); 770- blockLengths.put("SHA-512", new Integer(128)); 771+ blockLengths.put("MD2", Integer.valueOf(16)); 772+ blockLengths.put("MD4", Integer.valueOf(64)); 773+ blockLengths.put("MD5", Integer.valueOf(64)); 774+ 775+ blockLengths.put("RIPEMD128", Integer.valueOf(64)); 776+ blockLengths.put("RIPEMD160", Integer.valueOf(64)); 777+ 778+ blockLengths.put("SHA-1", Integer.valueOf(64)); 779+ blockLengths.put("SHA-224", Integer.valueOf(64)); 780+ blockLengths.put("SHA-256", Integer.valueOf(64)); 781+ blockLengths.put("SHA-384", Integer.valueOf(128)); 782+ blockLengths.put("SHA-512", Integer.valueOf(128)); 783 784- blockLengths.put("Tiger", new Integer(64)); 785- blockLengths.put("Whirlpool", new Integer(64)); 786+ blockLengths.put("Tiger", Integer.valueOf(64)); 787+ blockLengths.put("Whirlpool", Integer.valueOf(64)); 788 } 789 790 private static int getByteLength( 791diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java bcprov-jdk16-146/org/bouncycastle/crypto/signers/RSADigestSigner.java 792--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java 2011-02-23 20:08:56.000000000 +0000 793+++ bcprov-jdk16-146/org/bouncycastle/crypto/signers/RSADigestSigner.java 2012-05-11 05:31:26.620725599 +0000 794@@ -46,8 +46,10 @@ 795 oidMap.put("SHA-384", NISTObjectIdentifiers.id_sha384); 796 oidMap.put("SHA-512", NISTObjectIdentifiers.id_sha512); 797 798- oidMap.put("MD2", PKCSObjectIdentifiers.md2); 799- oidMap.put("MD4", PKCSObjectIdentifiers.md4); 800+ // BEGIN android-removed 801+ // oidMap.put("MD2", PKCSObjectIdentifiers.md2); 802+ // oidMap.put("MD4", PKCSObjectIdentifiers.md4); 803+ // END android-removed 804 oidMap.put("MD5", PKCSObjectIdentifiers.md5); 805 } 806 807diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java bcprov-jdk16-146/org/bouncycastle/crypto/util/PrivateKeyFactory.java 808--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2011-02-23 20:08:56.000000000 +0000 809+++ bcprov-jdk16-146/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2012-05-11 05:31:26.630725775 +0000 810@@ -12,7 +12,9 @@ 811 import org.bouncycastle.asn1.DERObject; 812 import org.bouncycastle.asn1.DERObjectIdentifier; 813 import org.bouncycastle.asn1.nist.NISTNamedCurves; 814-import org.bouncycastle.asn1.oiw.ElGamalParameter; 815+// BEGIN android-removed 816+// import org.bouncycastle.asn1.oiw.ElGamalParameter; 817+// END android-removed 818 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 819 import org.bouncycastle.asn1.pkcs.DHParameter; 820 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 821@@ -20,7 +22,9 @@ 822 import org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure; 823 import org.bouncycastle.asn1.sec.ECPrivateKeyStructure; 824 import org.bouncycastle.asn1.sec.SECNamedCurves; 825-import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 826+// BEGIN android-removed 827+// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 828+// END android-removed 829 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 830 import org.bouncycastle.asn1.x509.DSAParameter; 831 import org.bouncycastle.asn1.x9.X962NamedCurves; 832@@ -34,8 +38,10 @@ 833 import org.bouncycastle.crypto.params.DSAPrivateKeyParameters; 834 import org.bouncycastle.crypto.params.ECDomainParameters; 835 import org.bouncycastle.crypto.params.ECPrivateKeyParameters; 836-import org.bouncycastle.crypto.params.ElGamalParameters; 837-import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; 838+// BEGIN android-removed 839+// import org.bouncycastle.crypto.params.ElGamalParameters; 840+// import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; 841+// END android-removed 842 import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; 843 844 /** 845@@ -103,15 +109,17 @@ 846 847 return new DHPrivateKeyParameters(derX.getValue(), dhParams); 848 } 849- else if (algId.getObjectId().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 850- { 851- ElGamalParameter params = new ElGamalParameter( 852- (ASN1Sequence)keyInfo.getAlgorithmId().getParameters()); 853- DERInteger derX = (DERInteger)keyInfo.getPrivateKey(); 854- 855- return new ElGamalPrivateKeyParameters(derX.getValue(), new ElGamalParameters( 856- params.getP(), params.getG())); 857- } 858+ // BEGIN android-removed 859+ // else if (algId.getObjectId().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 860+ // { 861+ // ElGamalParameter params = new ElGamalParameter( 862+ // (ASN1Sequence)keyInfo.getAlgorithmId().getParameters()); 863+ // DERInteger derX = (DERInteger)keyInfo.getPrivateKey(); 864+ // 865+ // return new ElGamalPrivateKeyParameters(derX.getValue(), new ElGamalParameters( 866+ // params.getP(), params.getG())); 867+ // } 868+ // END android-removed 869 else if (algId.getObjectId().equals(X9ObjectIdentifiers.id_dsa)) 870 { 871 DERInteger derX = (DERInteger)keyInfo.getPrivateKey(); 872@@ -145,10 +153,12 @@ 873 { 874 ecP = NISTNamedCurves.getByOID(oid); 875 876- if (ecP == null) 877- { 878- ecP = TeleTrusTNamedCurves.getByOID(oid); 879- } 880+ // BEGIN android-removed 881+ // if (ecP == null) 882+ // { 883+ // ecP = TeleTrusTNamedCurves.getByOID(oid); 884+ // } 885+ // END android-removed 886 } 887 } 888 889diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java bcprov-jdk16-146/org/bouncycastle/crypto/util/PublicKeyFactory.java 890--- bcprov-jdk16-146.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java 2011-02-23 20:08:56.000000000 +0000 891+++ bcprov-jdk16-146/org/bouncycastle/crypto/util/PublicKeyFactory.java 2012-05-11 05:31:26.630725775 +0000 892@@ -15,12 +15,16 @@ 893 import org.bouncycastle.asn1.DERObjectIdentifier; 894 import org.bouncycastle.asn1.DEROctetString; 895 import org.bouncycastle.asn1.nist.NISTNamedCurves; 896-import org.bouncycastle.asn1.oiw.ElGamalParameter; 897+// BEGIN android-removed 898+// import org.bouncycastle.asn1.oiw.ElGamalParameter; 899+// END android-removed 900 import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 901 import org.bouncycastle.asn1.pkcs.DHParameter; 902 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 903 import org.bouncycastle.asn1.sec.SECNamedCurves; 904-import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 905+// BEGIN android-removed 906+// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 907+// END android-removed 908 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 909 import org.bouncycastle.asn1.x509.DSAParameter; 910 import org.bouncycastle.asn1.x509.RSAPublicKeyStructure; 911@@ -42,8 +46,10 @@ 912 import org.bouncycastle.crypto.params.DSAPublicKeyParameters; 913 import org.bouncycastle.crypto.params.ECDomainParameters; 914 import org.bouncycastle.crypto.params.ECPublicKeyParameters; 915-import org.bouncycastle.crypto.params.ElGamalParameters; 916-import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; 917+// BEGIN android-removed 918+// import org.bouncycastle.crypto.params.ElGamalParameters; 919+// import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; 920+// END android-removed 921 import org.bouncycastle.crypto.params.RSAKeyParameters; 922 923 /** 924@@ -139,15 +145,17 @@ 925 926 return new DHPublicKeyParameters(derY.getValue(), dhParams); 927 } 928- else if (algId.getObjectId().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 929- { 930- ElGamalParameter params = new ElGamalParameter( 931- (ASN1Sequence)keyInfo.getAlgorithmId().getParameters()); 932- DERInteger derY = (DERInteger)keyInfo.getPublicKey(); 933- 934- return new ElGamalPublicKeyParameters(derY.getValue(), new ElGamalParameters( 935- params.getP(), params.getG())); 936- } 937+ // BEGIN android-removed 938+ // else if (algId.getObjectId().equals(OIWObjectIdentifiers.elGamalAlgorithm)) 939+ // { 940+ // ElGamalParameter params = new ElGamalParameter( 941+ // (ASN1Sequence)keyInfo.getAlgorithmId().getParameters()); 942+ // DERInteger derY = (DERInteger)keyInfo.getPublicKey(); 943+ // 944+ // return new ElGamalPublicKeyParameters(derY.getValue(), new ElGamalParameters( 945+ // params.getP(), params.getG())); 946+ // } 947+ // END android-removed 948 else if (algId.getObjectId().equals(X9ObjectIdentifiers.id_dsa) 949 || algId.getObjectId().equals(OIWObjectIdentifiers.dsaWithSHA1)) 950 { 951@@ -182,10 +190,12 @@ 952 { 953 ecP = NISTNamedCurves.getByOID(oid); 954 955- if (ecP == null) 956- { 957- ecP = TeleTrusTNamedCurves.getByOID(oid); 958- } 959+ // BEGIN android-removed 960+ // if (ecP == null) 961+ // { 962+ // ecP = TeleTrusTNamedCurves.getByOID(oid); 963+ // } 964+ // END android-removed 965 } 966 } 967 968diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/ECNamedCurveTable.java bcprov-jdk16-146/org/bouncycastle/jce/ECNamedCurveTable.java 969--- bcprov-jdk16-146.orig/org/bouncycastle/jce/ECNamedCurveTable.java 2011-02-23 20:08:56.000000000 +0000 970+++ bcprov-jdk16-146/org/bouncycastle/jce/ECNamedCurveTable.java 2012-05-11 05:31:26.630725775 +0000 971@@ -3,7 +3,9 @@ 972 import org.bouncycastle.asn1.DERObjectIdentifier; 973 import org.bouncycastle.asn1.nist.NISTNamedCurves; 974 import org.bouncycastle.asn1.sec.SECNamedCurves; 975-import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 976+// BEGIN android-removed 977+// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 978+// END android-removed 979 import org.bouncycastle.asn1.x9.X962NamedCurves; 980 import org.bouncycastle.asn1.x9.X9ECParameters; 981 import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec; 982@@ -55,21 +57,23 @@ 983 } 984 } 985 986- if (ecP == null) 987- { 988- ecP = TeleTrusTNamedCurves.getByName(name); 989- if (ecP == null) 990- { 991- try 992- { 993- ecP = TeleTrusTNamedCurves.getByOID(new DERObjectIdentifier(name)); 994- } 995- catch (IllegalArgumentException e) 996- { 997- // ignore - not an oid 998- } 999- } 1000- } 1001+ // BEGIN android-removed 1002+ // if (ecP == null) 1003+ // { 1004+ // ecP = TeleTrusTNamedCurves.getByName(name); 1005+ // if (ecP == null) 1006+ // { 1007+ // try 1008+ // { 1009+ // ecP = TeleTrusTNamedCurves.getByOID(new DERObjectIdentifier(name)); 1010+ // } 1011+ // catch (IllegalArgumentException e) 1012+ // { 1013+ // // ignore - not an oid 1014+ // } 1015+ // } 1016+ // } 1017+ // END android-removed 1018 1019 if (ecP == null) 1020 { 1021@@ -102,7 +106,9 @@ 1022 addEnumeration(v, X962NamedCurves.getNames()); 1023 addEnumeration(v, SECNamedCurves.getNames()); 1024 addEnumeration(v, NISTNamedCurves.getNames()); 1025- addEnumeration(v, TeleTrusTNamedCurves.getNames()); 1026+ // BEGIN android-removed 1027+ // addEnumeration(v, TeleTrusTNamedCurves.getNames()); 1028+ // END android-removed 1029 1030 return v.elements(); 1031 } 1032diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/PKCS10CertificationRequest.java bcprov-jdk16-146/org/bouncycastle/jce/PKCS10CertificationRequest.java 1033--- bcprov-jdk16-146.orig/org/bouncycastle/jce/PKCS10CertificationRequest.java 2011-02-23 20:08:56.000000000 +0000 1034+++ bcprov-jdk16-146/org/bouncycastle/jce/PKCS10CertificationRequest.java 2012-05-11 05:31:26.630725775 +0000 1035@@ -80,15 +80,20 @@ 1036 1037 static 1038 { 1039- algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 1040- algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 1041+ // BEGIN android-removed 1042+ // Dropping MD2 1043+ // algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 1044+ // algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2")); 1045+ // END android-removed 1046 algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4")); 1047 algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4")); 1048 algorithms.put("RSAWITHMD5", new DERObjectIdentifier("1.2.840.113549.1.1.4")); 1049 algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5")); 1050 algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5")); 1051- algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 1052- algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 1053+ // BEGIN android-removed 1054+ // algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 1055+ // algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 1056+ // END android-removed 1057 algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption); 1058 algorithms.put("SHA256WITHRSA", PKCSObjectIdentifiers.sha256WithRSAEncryption); 1059 algorithms.put("SHA384WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha384WithRSAEncryption); 1060@@ -96,57 +101,78 @@ 1061 algorithms.put("SHA512WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha512WithRSAEncryption); 1062 algorithms.put("SHA512WITHRSA", PKCSObjectIdentifiers.sha512WithRSAEncryption); 1063 algorithms.put("SHA1WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 1064- algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 1065+ // BEGIN android-removed 1066+ // algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 1067+ // END android-removed 1068 algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 1069 algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 1070 algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 1071 algorithms.put("RSAWITHSHA1", new DERObjectIdentifier("1.2.840.113549.1.1.5")); 1072- algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 1073- algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 1074- algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 1075- algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 1076- algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 1077- algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 1078+ // BEGIN android-removed 1079+ // algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 1080+ // algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 1081+ // algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 1082+ // algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 1083+ // algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 1084+ // algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 1085+ // END android-removed 1086 algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3")); 1087 algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3")); 1088- algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 1089+ // BEGIN android-removed 1090+ // algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 1091+ // END android-removed 1092 algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256); 1093 algorithms.put("SHA384WITHDSA", NISTObjectIdentifiers.dsa_with_sha384); 1094 algorithms.put("SHA512WITHDSA", NISTObjectIdentifiers.dsa_with_sha512); 1095 algorithms.put("SHA1WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1); 1096- algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 1097+ // BEGIN android-removed 1098+ // algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 1099+ // END android-removed 1100 algorithms.put("SHA256WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256); 1101 algorithms.put("SHA384WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); 1102 algorithms.put("SHA512WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); 1103 algorithms.put("ECDSAWITHSHA1", X9ObjectIdentifiers.ecdsa_with_SHA1); 1104- algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 1105- algorithms.put("GOST3410WITHGOST3411", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 1106- algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1107- algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1108- algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1109+ // BEGIN android-removed 1110+ // algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 1111+ // algorithms.put("GOST3410WITHGOST3411", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 1112+ // algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1113+ // algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1114+ // algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1115+ // END android-removed 1116 1117 // 1118 // reverse mappings 1119 // 1120 oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.5"), "SHA1WITHRSA"); 1121- oids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WITHRSA"); 1122+ // BEGIN android-removed 1123+ // oids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WITHRSA"); 1124+ // END android-removed 1125 oids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256WITHRSA"); 1126 oids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384WITHRSA"); 1127 oids.put(PKCSObjectIdentifiers.sha512WithRSAEncryption, "SHA512WITHRSA"); 1128- oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3411WITHGOST3410"); 1129- oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "GOST3411WITHECGOST3410"); 1130+ // BEGIN android-removed 1131+ // oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3411WITHGOST3410"); 1132+ // oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "GOST3411WITHECGOST3410"); 1133+ // END android-removed 1134 1135 oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA"); 1136- oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); 1137+ // BEGIN android-removed 1138+ // Dropping MD2 1139+ // oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); 1140+ // END android-removed 1141 oids.put(new DERObjectIdentifier("1.2.840.10040.4.3"), "SHA1WITHDSA"); 1142 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA1, "SHA1WITHECDSA"); 1143- oids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224WITHECDSA"); 1144+ // BEGIN android-removed 1145+ // oids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224WITHECDSA"); 1146+ // END android-removed 1147 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA256, "SHA256WITHECDSA"); 1148 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA384, "SHA384WITHECDSA"); 1149 oids.put(X9ObjectIdentifiers.ecdsa_with_SHA512, "SHA512WITHECDSA"); 1150 oids.put(OIWObjectIdentifiers.sha1WithRSA, "SHA1WITHRSA"); 1151 oids.put(OIWObjectIdentifiers.dsaWithSHA1, "SHA1WITHDSA"); 1152- oids.put(NISTObjectIdentifiers.dsa_with_sha224, "SHA224WITHDSA"); 1153+ // BEGIN android-removed 1154+ // oids.put(NISTObjectIdentifiers.dsa_with_sha224, "SHA224WITHDSA"); 1155+ // END android-removed 1156 oids.put(NISTObjectIdentifiers.dsa_with_sha256, "SHA256WITHDSA"); 1157 1158 // 1159@@ -160,35 +186,53 @@ 1160 // The parameters field SHALL be NULL for RSA based signature algorithms. 1161 // 1162 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA1); 1163- noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 1164+ // BEGIN android-removed 1165+ // noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 1166+ // END android-removed 1167 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA256); 1168 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA384); 1169 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA512); 1170 noParams.add(X9ObjectIdentifiers.id_dsa_with_sha1); 1171- noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 1172+ // BEGIN android-removed 1173+ // noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 1174+ // END android-removed 1175 noParams.add(NISTObjectIdentifiers.dsa_with_sha256); 1176 1177 // 1178 // RFC 4491 1179 // 1180- noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 1181- noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1182+ // BEGIN android-removed 1183+ // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 1184+ // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 1185+ // END android-removed 1186 // 1187 // explicit params 1188 // 1189- AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, new DERNull()); 1190+ // BEGIN android-changed 1191+ AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE); 1192+ // END android-changed 1193 params.put("SHA1WITHRSAANDMGF1", creatPSSParams(sha1AlgId, 20)); 1194 1195- AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, new DERNull()); 1196- params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 1197- 1198- AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, new DERNull()); 1199+ // BEGIN android-removed 1200+ // // BEGIN android-changed 1201+ // AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, DERNull.INSTANCE); 1202+ // // END android-changed 1203+ // params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 1204+ // END android-removed 1205+ 1206+ // BEGIN android-changed 1207+ AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, DERNull.INSTANCE); 1208+ // END android-changed 1209 params.put("SHA256WITHRSAANDMGF1", creatPSSParams(sha256AlgId, 32)); 1210 1211- AlgorithmIdentifier sha384AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384, new DERNull()); 1212+ // BEGIN android-changed 1213+ AlgorithmIdentifier sha384AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384, DERNull.INSTANCE); 1214+ // END android-changed 1215 params.put("SHA384WITHRSAANDMGF1", creatPSSParams(sha384AlgId, 48)); 1216 1217- AlgorithmIdentifier sha512AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha512, new DERNull()); 1218+ // BEGIN android-changed 1219+ AlgorithmIdentifier sha512AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha512, DERNull.INSTANCE); 1220+ // END android-changed 1221 params.put("SHA512WITHRSAANDMGF1", creatPSSParams(sha512AlgId, 64)); 1222 } 1223 1224@@ -594,10 +638,12 @@ 1225 { 1226 return "SHA1"; 1227 } 1228- else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 1229- { 1230- return "SHA224"; 1231- } 1232+ // BEGIN android-removed 1233+ // else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 1234+ // { 1235+ // return "SHA224"; 1236+ // } 1237+ // END android-removed 1238 else if (NISTObjectIdentifiers.id_sha256.equals(digestAlgOID)) 1239 { 1240 return "SHA256"; 1241@@ -610,22 +656,24 @@ 1242 { 1243 return "SHA512"; 1244 } 1245- else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 1246- { 1247- return "RIPEMD128"; 1248- } 1249- else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 1250- { 1251- return "RIPEMD160"; 1252- } 1253- else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 1254- { 1255- return "RIPEMD256"; 1256- } 1257- else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 1258- { 1259- return "GOST3411"; 1260- } 1261+ // BEGIN android-removed 1262+ // else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 1263+ // { 1264+ // return "RIPEMD128"; 1265+ // } 1266+ // else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 1267+ // { 1268+ // return "RIPEMD160"; 1269+ // } 1270+ // else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 1271+ // { 1272+ // return "RIPEMD256"; 1273+ // } 1274+ // else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 1275+ // { 1276+ // return "GOST3411"; 1277+ // } 1278+ // END android-removed 1279 else 1280 { 1281 return digestAlgOID.getId(); 1282diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/BouncyCastleProvider.java bcprov-jdk16-146/org/bouncycastle/jce/provider/BouncyCastleProvider.java 1283--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/BouncyCastleProvider.java 2011-02-23 20:08:56.000000000 +0000 1284+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/BouncyCastleProvider.java 2012-05-11 05:31:26.630725775 +0000 1285@@ -45,7 +45,10 @@ 1286 { 1287 private static String info = "BouncyCastle Security Provider v1.46"; 1288 1289- public static String PROVIDER_NAME = "BC"; 1290+ // BEGIN android-changed 1291+ // this constant should be final 1292+ public static final String PROVIDER_NAME = "BC"; 1293+ // END android-changed 1294 1295 /* 1296 * Configurable symmetric ciphers 1297@@ -53,8 +56,14 @@ 1298 private static final String SYMMETRIC_CIPHER_PACKAGE = "org.bouncycastle.jce.provider.symmetric."; 1299 private static final String[] SYMMETRIC_CIPHERS = 1300 { 1301- "AES", "ARC4", "Blowfish", "Camellia", "CAST5", "CAST6", "DESede", "Grainv1", "Grain128", "HC128", "HC256", "IDEA", 1302- "Noekeon", "RC5", "RC6", "Rijndael", "Salsa20", "SEED", "Serpent", "Skipjack", "TEA", "Twofish", "VMPC", "VMPCKSA3", "XTEA" 1303+ // BEGIN android-removed 1304+ // "AES", "ARC4", "Blowfish", "Camellia", "CAST5", "CAST6", "DESede", "Grainv1", "Grain128", "HC128", "HC256", "IDEA", 1305+ // "Noekeon", "RC5", "RC6", "Rijndael", "Salsa20", "SEED", "Serpent", "Skipjack", "TEA", "Twofish", "VMPC", "VMPCKSA3", "XTEA" 1306+ // END android-removed 1307+ // BEGIN android-added 1308+ "AES", "ARC4", "Blowfish", "DESede", 1309+ // END android-added 1310+ 1311 }; 1312 1313 /* 1314@@ -90,26 +99,28 @@ 1315 loadAlgorithms(SYMMETRIC_CIPHER_PACKAGE, SYMMETRIC_CIPHERS); 1316 loadAlgorithms(ASYMMETRIC_CIPHER_PACKAGE, ASYMMETRIC_CIPHERS); 1317 1318- // 1319- // X509Store 1320- // 1321- put("X509Store.CERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertCollection"); 1322- put("X509Store.ATTRIBUTECERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreAttrCertCollection"); 1323- put("X509Store.CRL/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCRLCollection"); 1324- put("X509Store.CERTIFICATEPAIR/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertPairCollection"); 1325- 1326- put("X509Store.CERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCerts"); 1327- put("X509Store.CRL/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCRLs"); 1328- put("X509Store.ATTRIBUTECERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPAttrCerts"); 1329- put("X509Store.CERTIFICATEPAIR/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCertPairs"); 1330- 1331- // 1332- // X509StreamParser 1333- // 1334- put("X509StreamParser.CERTIFICATE", "org.bouncycastle.jce.provider.X509CertParser"); 1335- put("X509StreamParser.ATTRIBUTECERTIFICATE", "org.bouncycastle.jce.provider.X509AttrCertParser"); 1336- put("X509StreamParser.CRL", "org.bouncycastle.jce.provider.X509CRLParser"); 1337- put("X509StreamParser.CERTIFICATEPAIR", "org.bouncycastle.jce.provider.X509CertPairParser"); 1338+ // BEGIN android-removed 1339+ // // 1340+ // // X509Store 1341+ // // 1342+ // put("X509Store.CERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertCollection"); 1343+ // put("X509Store.ATTRIBUTECERTIFICATE/COLLECTION", "org.bouncycastle.jce.provider.X509StoreAttrCertCollection"); 1344+ // put("X509Store.CRL/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCRLCollection"); 1345+ // put("X509Store.CERTIFICATEPAIR/COLLECTION", "org.bouncycastle.jce.provider.X509StoreCertPairCollection"); 1346+ // 1347+ // put("X509Store.CERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCerts"); 1348+ // put("X509Store.CRL/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCRLs"); 1349+ // put("X509Store.ATTRIBUTECERTIFICATE/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPAttrCerts"); 1350+ // put("X509Store.CERTIFICATEPAIR/LDAP", "org.bouncycastle.jce.provider.X509StoreLDAPCertPairs"); 1351+ // 1352+ // // 1353+ // // X509StreamParser 1354+ // // 1355+ // put("X509StreamParser.CERTIFICATE", "org.bouncycastle.jce.provider.X509CertParser"); 1356+ // put("X509StreamParser.ATTRIBUTECERTIFICATE", "org.bouncycastle.jce.provider.X509AttrCertParser"); 1357+ // put("X509StreamParser.CRL", "org.bouncycastle.jce.provider.X509CRLParser"); 1358+ // put("X509StreamParser.CERTIFICATEPAIR", "org.bouncycastle.jce.provider.X509CertPairParser"); 1359+ // END android-removed 1360 1361 1362 // 1363@@ -118,14 +129,24 @@ 1364 put("KeyStore.BKS", "org.bouncycastle.jce.provider.JDKKeyStore"); 1365 put("KeyStore.BouncyCastle", "org.bouncycastle.jce.provider.JDKKeyStore$BouncyCastleStore"); 1366 put("KeyStore.PKCS12", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore"); 1367- put("KeyStore.BCPKCS12", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore"); 1368- put("KeyStore.PKCS12-DEF", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore"); 1369- 1370- put("KeyStore.PKCS12-3DES-40RC2", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore"); 1371- put("KeyStore.PKCS12-3DES-3DES", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore3DES"); 1372- 1373- put("KeyStore.PKCS12-DEF-3DES-40RC2", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore"); 1374- put("KeyStore.PKCS12-DEF-3DES-3DES", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore3DES"); 1375+ // BEGIN android-changed 1376+ put("Alg.Alias.KeyStore.BCPKCS12", "PKCS12"); 1377+ // END android-changed 1378+ // BEGIN android-removed 1379+ // put("KeyStore.PKCS12-DEF", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore"); 1380+ // END android-removed 1381+ 1382+ // BEGIN android-changed 1383+ put("Alg.Alias.KeyStore.PKCS12-3DES-40RC2", "PKCS12"); 1384+ // END android-changed 1385+ // BEGIN android-removed 1386+ // put("KeyStore.PKCS12-3DES-3DES", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore3DES"); 1387+ // END android-removed 1388+ 1389+ // BEGIN android-removed 1390+ // put("KeyStore.PKCS12-DEF-3DES-40RC2", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore"); 1391+ // put("KeyStore.PKCS12-DEF-3DES-3DES", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore3DES"); 1392+ // END android-removed 1393 1394 put("Alg.Alias.KeyStore.UBER", "BouncyCastle"); 1395 put("Alg.Alias.KeyStore.BOUNCYCASTLE", "BouncyCastle"); 1396@@ -142,44 +163,63 @@ 1397 // 1398 put("AlgorithmParameterGenerator.DH", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DH"); 1399 put("AlgorithmParameterGenerator.DSA", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA"); 1400- put("AlgorithmParameterGenerator.GOST3410", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$GOST3410"); 1401- put("AlgorithmParameterGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$ElGamal"); 1402- put("AlgorithmParameterGenerator.DES", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1403- put("AlgorithmParameterGenerator.DESEDE", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1404- put("AlgorithmParameterGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1405- put("AlgorithmParameterGenerator." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1406- put("AlgorithmParameterGenerator.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2"); 1407- put("AlgorithmParameterGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2"); 1408+ // BEGIN android-removed 1409+ // put("AlgorithmParameterGenerator.GOST3410", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$GOST3410"); 1410+ // put("AlgorithmParameterGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$ElGamal"); 1411+ // put("AlgorithmParameterGenerator.DES", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1412+ // put("AlgorithmParameterGenerator.DESEDE", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1413+ // put("AlgorithmParameterGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1414+ // put("AlgorithmParameterGenerator." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES"); 1415+ // put("AlgorithmParameterGenerator.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2"); 1416+ // put("AlgorithmParameterGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2"); 1417+ // END android-removed 1418 1419 put("Alg.Alias.AlgorithmParameterGenerator.DIFFIEHELLMAN", "DH"); 1420- put("Alg.Alias.AlgorithmParameterGenerator.GOST-3410", "GOST3410"); 1421+ // BEGIN android-removed 1422+ // put("Alg.Alias.AlgorithmParameterGenerator.GOST-3410", "GOST3410"); 1423+ // END android-removed 1424 // 1425 // algorithm parameters 1426 // 1427 put("AlgorithmParameters.OAEP", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$OAEP"); 1428- put("AlgorithmParameters.PSS", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PSS"); 1429+ // BEGIN android-removed 1430+ // put("AlgorithmParameters.PSS", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PSS"); 1431+ // END android-removed 1432 put("AlgorithmParameters.DH", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$DH"); 1433 put("Alg.Alias.AlgorithmParameters.DIFFIEHELLMAN", "DH"); 1434 put("AlgorithmParameters.DSA", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$DSA"); 1435- put("AlgorithmParameters.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$ElGamal"); 1436- put("AlgorithmParameters.IES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IES"); 1437+ // BEGIN android-removed 1438+ // put("AlgorithmParameters.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$ElGamal"); 1439+ // put("AlgorithmParameters.IES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IES"); 1440+ // END android-removed 1441 put("AlgorithmParameters.PKCS12PBE", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PKCS12PBE"); 1442- put("AlgorithmParameters." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters"); 1443- put("AlgorithmParameters." + PKCSObjectIdentifiers.id_PBKDF2, "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PBKDF2"); 1444- 1445- put("AlgorithmParameters.GOST3410", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$GOST3410"); 1446- put("Alg.Alias.AlgorithmParameters.GOST-3410", "GOST3410"); 1447+ // BEGIN android-changed 1448+ // redundant with below 1449+ // put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.des_EDE3_CBC, "DESede"); 1450+ // END android-changed 1451+ // BEGIN android-removed 1452+ // put("AlgorithmParameters." + PKCSObjectIdentifiers.id_PBKDF2, "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PBKDF2"); 1453+ // 1454+ // put("AlgorithmParameters.GOST3410", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$GOST3410"); 1455+ // put("Alg.Alias.AlgorithmParameters.GOST-3410", "GOST3410"); 1456+ // END android-removed 1457 put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2", "PKCS12PBE"); 1458- put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND3-KEYTRIPLEDES", "PKCS12PBE"); 1459- put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND2-KEYTRIPLEDES", "PKCS12PBE"); 1460- put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC2", "PKCS12PBE"); 1461- put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC4", "PKCS12PBE"); 1462+ // BEGIN android-removed 1463+ // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND3-KEYTRIPLEDES", "PKCS12PBE"); 1464+ // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND2-KEYTRIPLEDES", "PKCS12PBE"); 1465+ // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC2", "PKCS12PBE"); 1466+ // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC4", "PKCS12PBE"); 1467+ // END android-removed 1468 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH", "PKCS12PBE"); 1469- put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2-CBC", "PKCS12PBE"); 1470+ // BEGIN android-removed 1471+ // put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2-CBC", "PKCS12PBE"); 1472+ // END android-removed 1473 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PKCS12PBE"); 1474 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", "PKCS12PBE"); 1475- put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDDES3KEY-CBC", "PKCS12PBE"); 1476- put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDDES2KEY-CBC", "PKCS12PBE"); 1477+ // BEGIN android-removed 1478+ // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDDES3KEY-CBC", "PKCS12PBE"); 1479+ // put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDDES2KEY-CBC", "PKCS12PBE"); 1480+ // END android-removed 1481 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND40BITRC2-CBC", "PKCS12PBE"); 1482 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND40BITRC4", "PKCS12PBE"); 1483 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND128BITRC2-CBC", "PKCS12PBE"); 1484@@ -193,7 +233,7 @@ 1485 put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.5", "PKCS12PBE"); 1486 put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.6", "PKCS12PBE"); 1487 put("Alg.Alias.AlgorithmParameters.PBEWithSHAAnd3KeyTripleDES", "PKCS12PBE"); 1488- 1489+ 1490 put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.getId(), "PKCS12PBE"); 1491 put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.getId(), "PKCS12PBE"); 1492 put("Alg.Alias.AlgorithmParameters." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes256_cbc.getId(), "PKCS12PBE"); 1493@@ -203,22 +243,24 @@ 1494 1495 put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.id_RSAES_OAEP, "OAEP"); 1496 1497- put("Alg.Alias.AlgorithmParameters.RSAPSS", "PSS"); 1498- put("Alg.Alias.AlgorithmParameters.RSASSA-PSS", "PSS"); 1499- put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.id_RSASSA_PSS, "PSS"); 1500- put("Alg.Alias.AlgorithmParameters.SHA1withRSA/PSS", "PSS"); 1501- put("Alg.Alias.AlgorithmParameters.SHA224withRSA/PSS", "PSS"); 1502- put("Alg.Alias.AlgorithmParameters.SHA256withRSA/PSS", "PSS"); 1503- put("Alg.Alias.AlgorithmParameters.SHA384withRSA/PSS", "PSS"); 1504- put("Alg.Alias.AlgorithmParameters.SHA512withRSA/PSS", "PSS"); 1505- put("Alg.Alias.AlgorithmParameters.SHA1WITHRSAANDMGF1", "PSS"); 1506- put("Alg.Alias.AlgorithmParameters.SHA224WITHRSAANDMGF1", "PSS"); 1507- put("Alg.Alias.AlgorithmParameters.SHA256WITHRSAANDMGF1", "PSS"); 1508- put("Alg.Alias.AlgorithmParameters.SHA384WITHRSAANDMGF1", "PSS"); 1509- put("Alg.Alias.AlgorithmParameters.SHA512WITHRSAANDMGF1", "PSS"); 1510- put("Alg.Alias.AlgorithmParameters.RAWRSAPSS", "PSS"); 1511- put("Alg.Alias.AlgorithmParameters.NONEWITHRSAPSS", "PSS"); 1512- put("Alg.Alias.AlgorithmParameters.NONEWITHRSASSA-PSS", "PSS"); 1513+ // BEGIN android-removed 1514+ // put("Alg.Alias.AlgorithmParameters.RSAPSS", "PSS"); 1515+ // put("Alg.Alias.AlgorithmParameters.RSASSA-PSS", "PSS"); 1516+ // put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.id_RSASSA_PSS, "PSS"); 1517+ // put("Alg.Alias.AlgorithmParameters.SHA1withRSA/PSS", "PSS"); 1518+ // put("Alg.Alias.AlgorithmParameters.SHA224withRSA/PSS", "PSS"); 1519+ // put("Alg.Alias.AlgorithmParameters.SHA256withRSA/PSS", "PSS"); 1520+ // put("Alg.Alias.AlgorithmParameters.SHA384withRSA/PSS", "PSS"); 1521+ // put("Alg.Alias.AlgorithmParameters.SHA512withRSA/PSS", "PSS"); 1522+ // put("Alg.Alias.AlgorithmParameters.SHA1WITHRSAANDMGF1", "PSS"); 1523+ // put("Alg.Alias.AlgorithmParameters.SHA224WITHRSAANDMGF1", "PSS"); 1524+ // put("Alg.Alias.AlgorithmParameters.SHA256WITHRSAANDMGF1", "PSS"); 1525+ // put("Alg.Alias.AlgorithmParameters.SHA384WITHRSAANDMGF1", "PSS"); 1526+ // put("Alg.Alias.AlgorithmParameters.SHA512WITHRSAANDMGF1", "PSS"); 1527+ // put("Alg.Alias.AlgorithmParameters.RAWRSAPSS", "PSS"); 1528+ // put("Alg.Alias.AlgorithmParameters.NONEWITHRSAPSS", "PSS"); 1529+ // put("Alg.Alias.AlgorithmParameters.NONEWITHRSASSA-PSS", "PSS"); 1530+ // END android-removed 1531 1532 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND128BITAES-CBC-BC", "PKCS12PBE"); 1533 put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND192BITAES-CBC-BC", "PKCS12PBE"); 1534@@ -235,12 +277,14 @@ 1535 put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND128BITAES-CBC-BC","PKCS12PBE"); 1536 put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND192BITAES-CBC-BC","PKCS12PBE"); 1537 put("Alg.Alias.AlgorithmParameters.PBEWITHSHA-256AND256BITAES-CBC-BC","PKCS12PBE"); 1538- 1539- put("AlgorithmParameters.SHA1WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1540- put("AlgorithmParameters.SHA224WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1541- put("AlgorithmParameters.SHA256WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1542- put("AlgorithmParameters.SHA384WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1543- put("AlgorithmParameters.SHA512WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1544+ 1545+ // BEGIN android-removed 1546+ // put("AlgorithmParameters.SHA1WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1547+ // put("AlgorithmParameters.SHA224WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1548+ // put("AlgorithmParameters.SHA256WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1549+ // put("AlgorithmParameters.SHA384WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1550+ // put("AlgorithmParameters.SHA512WITHECDSA", "org.bouncycastle.jce.provider.JDKECDSAAlgParameters$SigAlgParameters"); 1551+ // END android-removed 1552 1553 // 1554 // key agreement 1555@@ -252,71 +296,91 @@ 1556 // cipher engines 1557 // 1558 put("Cipher.DES", "org.bouncycastle.jce.provider.JCEBlockCipher$DES"); 1559- put("Cipher." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.JCEBlockCipher$DESCBC"); 1560- 1561- put("Cipher.RC2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2"); 1562- put("Cipher.RC2WRAP", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap"); 1563- put("Cipher.1.2.840.113549.1.9.16.3.7", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap"); 1564- 1565- put("Cipher.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2CBC"); 1566+ // BEGIN android-removed 1567+ // put("Cipher." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.JCEBlockCipher$DESCBC"); 1568+ // 1569+ // put("Cipher.RC2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2"); 1570+ // put("Cipher.RC2WRAP", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap"); 1571+ // put("Cipher.1.2.840.113549.1.9.16.3.7", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap"); 1572+ // 1573+ // put("Cipher.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2CBC"); 1574+ // END android-removed 1575 1576 put("Alg.Alias.Cipher.PBEWithSHAAnd3KeyTripleDES", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC"); 1577 1578- put("Cipher.GOST28147", "org.bouncycastle.jce.provider.JCEBlockCipher$GOST28147"); 1579- put("Alg.Alias.Cipher.GOST", "GOST28147"); 1580- put("Alg.Alias.Cipher.GOST-28147", "GOST28147"); 1581- put("Cipher." + CryptoProObjectIdentifiers.gostR28147_cbc, "org.bouncycastle.jce.provider.JCEBlockCipher$GOST28147cbc"); 1582+ // BEGIN android-removed 1583+ // put("Cipher.GOST28147", "org.bouncycastle.jce.provider.JCEBlockCipher$GOST28147"); 1584+ // put("Alg.Alias.Cipher.GOST", "GOST28147"); 1585+ // put("Alg.Alias.Cipher.GOST-28147", "GOST28147"); 1586+ // put("Cipher." + CryptoProObjectIdentifiers.gostR28147_cbc, "org.bouncycastle.jce.provider.JCEBlockCipher$GOST28147cbc"); 1587+ // END android-removed 1588 1589 put("Cipher.RSA", "org.bouncycastle.jce.provider.JCERSACipher$NoPadding"); 1590- put("Cipher.RSA/RAW", "org.bouncycastle.jce.provider.JCERSACipher$NoPadding"); 1591- put("Cipher.RSA/PKCS1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding"); 1592- put("Cipher.1.2.840.113549.1.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding"); 1593- put("Cipher.2.5.8.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding"); 1594- put("Cipher.RSA/1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PrivateOnly"); 1595- put("Cipher.RSA/2", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PublicOnly"); 1596- put("Cipher.RSA/OAEP", "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding"); 1597- put("Cipher." + PKCSObjectIdentifiers.id_RSAES_OAEP, "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding"); 1598- put("Cipher.RSA/ISO9796-1", "org.bouncycastle.jce.provider.JCERSACipher$ISO9796d1Padding"); 1599- 1600- put("Cipher.ECIES", "org.bouncycastle.jce.provider.JCEIESCipher$ECIES"); 1601- put("Cipher.BrokenECIES", "org.bouncycastle.jce.provider.JCEIESCipher$BrokenECIES"); 1602- put("Cipher.IES", "org.bouncycastle.jce.provider.JCEIESCipher$IES"); 1603- put("Cipher.BrokenIES", "org.bouncycastle.jce.provider.JCEIESCipher$BrokenIES"); 1604- put("Cipher.ELGAMAL", "org.bouncycastle.jce.provider.JCEElGamalCipher$NoPadding"); 1605- put("Cipher.ELGAMAL/PKCS1", "org.bouncycastle.jce.provider.JCEElGamalCipher$PKCS1v1_5Padding"); 1606+ // BEGIN android-changed 1607+ put("Alg.Alias.Cipher.RSA/RAW", "RSA"); 1608+ // END android-changed 1609+ // BEGIN android-removed 1610+ // put("Cipher.RSA/PKCS1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding"); 1611+ // put("Cipher.1.2.840.113549.1.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding"); 1612+ // put("Cipher.2.5.8.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding"); 1613+ // put("Cipher.RSA/1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PrivateOnly"); 1614+ // put("Cipher.RSA/2", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PublicOnly"); 1615+ // put("Cipher.RSA/OAEP", "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding"); 1616+ // put("Cipher." + PKCSObjectIdentifiers.id_RSAES_OAEP, "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding"); 1617+ // put("Cipher.RSA/ISO9796-1", "org.bouncycastle.jce.provider.JCERSACipher$ISO9796d1Padding"); 1618+ // 1619+ // put("Cipher.ECIES", "org.bouncycastle.jce.provider.JCEIESCipher$ECIES"); 1620+ // put("Cipher.BrokenECIES", "org.bouncycastle.jce.provider.JCEIESCipher$BrokenECIES"); 1621+ // put("Cipher.IES", "org.bouncycastle.jce.provider.JCEIESCipher$IES"); 1622+ // put("Cipher.BrokenIES", "org.bouncycastle.jce.provider.JCEIESCipher$BrokenIES"); 1623+ // put("Cipher.ELGAMAL", "org.bouncycastle.jce.provider.JCEElGamalCipher$NoPadding"); 1624+ // put("Cipher.ELGAMAL/PKCS1", "org.bouncycastle.jce.provider.JCEElGamalCipher$PKCS1v1_5Padding"); 1625+ // END android-removed 1626 1627 put("Alg.Alias.Cipher.RSA//RAW", "RSA"); 1628 put("Alg.Alias.Cipher.RSA//NOPADDING", "RSA"); 1629- put("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1"); 1630- put("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP"); 1631- put("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1"); 1632- 1633- put("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1"); 1634- put("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1"); 1635- put("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL"); 1636+ // BEGIN android-removed 1637+ // put("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1"); 1638+ // put("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP"); 1639+ // put("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1"); 1640+ // 1641+ // put("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1"); 1642+ // put("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1"); 1643+ // put("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL"); 1644+ // END android-removed 1645 1646 put("Cipher.PBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithMD5AndDES"); 1647- put("Cipher.BROKENPBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithMD5AndDES"); 1648+ // BEGIN android-removed 1649+ // put("Cipher.BROKENPBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithMD5AndDES"); 1650+ // END android-removed 1651 put("Cipher.PBEWITHMD5ANDRC2", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithMD5AndRC2"); 1652 put("Cipher.PBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHA1AndDES"); 1653- put("Cipher.BROKENPBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHA1AndDES"); 1654+ // BEGIN android-removed 1655+ // put("Cipher.BROKENPBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHA1AndDES"); 1656+ // END android-removed 1657 put("Cipher.PBEWITHSHA1ANDRC2", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHA1AndRC2"); 1658 put("Cipher.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndDES3Key"); 1659- put("Cipher.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES3Key"); 1660- put("Cipher.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndDES3Key"); 1661+ // BEGIN android-removed 1662+ // put("Cipher.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES3Key"); 1663+ // put("Cipher.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndDES3Key"); 1664+ // END android-removed 1665 put("Cipher.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndDES2Key"); 1666- put("Cipher.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES2Key"); 1667+ // BEGIN android-removed 1668+ // put("Cipher.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES2Key"); 1669+ // END android-removed 1670 put("Cipher.PBEWITHSHAAND128BITRC2-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAnd128BitRC2"); 1671 put("Cipher.PBEWITHSHAAND40BITRC2-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAnd40BitRC2"); 1672 put("Cipher.PBEWITHSHAAND128BITRC4", "org.bouncycastle.jce.provider.JCEStreamCipher$PBEWithSHAAnd128BitRC4"); 1673 put("Cipher.PBEWITHSHAAND40BITRC4", "org.bouncycastle.jce.provider.JCEStreamCipher$PBEWithSHAAnd40BitRC4"); 1674 1675- put("Alg.Alias.Cipher.PBEWITHSHA1AND3-KEYTRIPLEDES-CBC", "Cipher.PBEWITHSHAAND3-KEYTRIPLEDES-CBC"); 1676- put("Alg.Alias.Cipher.PBEWITHSHA1AND2-KEYTRIPLEDES-CBC", "Cipher.PBEWITHSHAAND2-KEYTRIPLEDES-CBC"); 1677- put("Alg.Alias.Cipher.PBEWITHSHA1AND128BITRC2-CBC", "Cipher.PBEWITHSHAAND128BITRC2-CBC"); 1678- put("Alg.Alias.Cipher.PBEWITHSHA1AND40BITRC2-CBC", "Cipher.PBEWITHSHAAND40BITRC2-CBC"); 1679- put("Alg.Alias.Cipher.PBEWITHSHA1AND128BITRC4", "Cipher.PBEWITHSHAAND128BITRC4"); 1680- put("Alg.Alias.Cipher.PBEWITHSHA1AND40BITRC4", "Cipher.PBEWITHSHAAND40BITRC4"); 1681+ // BEGIN android-changed 1682+ put("Alg.Alias.Cipher.PBEWITHSHA1AND3-KEYTRIPLEDES-CBC", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC"); 1683+ put("Alg.Alias.Cipher.PBEWITHSHA1AND2-KEYTRIPLEDES-CBC", "PBEWITHSHAAND2-KEYTRIPLEDES-CBC"); 1684+ put("Alg.Alias.Cipher.PBEWITHSHA1AND128BITRC2-CBC", "PBEWITHSHAAND128BITRC2-CBC"); 1685+ put("Alg.Alias.Cipher.PBEWITHSHA1AND40BITRC2-CBC", "PBEWITHSHAAND40BITRC2-CBC"); 1686+ put("Alg.Alias.Cipher.PBEWITHSHA1AND128BITRC4", "PBEWITHSHAAND128BITRC4"); 1687+ put("Alg.Alias.Cipher.PBEWITHSHA1AND40BITRC4", "PBEWITHSHAAND40BITRC4"); 1688+ // END android-changed 1689 1690 put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.getId(), "PBEWITHSHAAND128BITAES-CBC-BC"); 1691 put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.getId(), "PBEWITHSHAAND192BITAES-CBC-BC"); 1692@@ -324,7 +388,7 @@ 1693 put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes128_cbc.getId(), "PBEWITHSHA256AND128BITAES-CBC-BC"); 1694 put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.getId(), "PBEWITHSHA256AND192BITAES-CBC-BC"); 1695 put("Alg.Alias.Cipher." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.getId(), "PBEWITHSHA256AND256BITAES-CBC-BC"); 1696- 1697+ 1698 put("Cipher.PBEWITHSHAAND128BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC"); 1699 put("Cipher.PBEWITHSHAAND192BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC"); 1700 put("Cipher.PBEWITHSHAAND256BITAES-CBC-BC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC"); 1701@@ -346,10 +410,12 @@ 1702 put("Cipher.PBEWITHMD5AND256BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithAESCBC"); 1703 1704 put("Cipher.PBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndTwofish"); 1705- put("Cipher.OLDPBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndTwofish"); 1706- 1707- put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 1708- put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 1709+ // BEGIN android-removed 1710+ // put("Cipher.OLDPBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndTwofish"); 1711+ // 1712+ // put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 1713+ // put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 1714+ // END android-removed 1715 put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES"); 1716 put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDDES"); 1717 put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES"); 1718@@ -368,13 +434,15 @@ 1719 put("KeyGenerator.DES", "org.bouncycastle.jce.provider.JCEKeyGenerator$DES"); 1720 put("Alg.Alias.KeyGenerator." + OIWObjectIdentifiers.desCBC, "DES"); 1721 1722- put("KeyGenerator.RC2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2"); 1723- put("KeyGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2"); 1724- 1725- put("KeyGenerator.GOST28147", "org.bouncycastle.jce.provider.JCEKeyGenerator$GOST28147"); 1726- put("Alg.Alias.KeyGenerator.GOST", "GOST28147"); 1727- put("Alg.Alias.KeyGenerator.GOST-28147", "GOST28147"); 1728- put("Alg.Alias.KeyGenerator." + CryptoProObjectIdentifiers.gostR28147_cbc, "GOST28147"); 1729+ // BEGIN android-removed 1730+ // put("KeyGenerator.RC2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2"); 1731+ // put("KeyGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2"); 1732+ // 1733+ // put("KeyGenerator.GOST28147", "org.bouncycastle.jce.provider.JCEKeyGenerator$GOST28147"); 1734+ // put("Alg.Alias.KeyGenerator.GOST", "GOST28147"); 1735+ // put("Alg.Alias.KeyGenerator.GOST-28147", "GOST28147"); 1736+ // put("Alg.Alias.KeyGenerator." + CryptoProObjectIdentifiers.gostR28147_cbc, "GOST28147"); 1737+ // END android-removed 1738 1739 // 1740 // key pair generators. 1741@@ -382,14 +450,18 @@ 1742 put("KeyPairGenerator.RSA", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$RSA"); 1743 put("KeyPairGenerator.DH", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$DH"); 1744 put("KeyPairGenerator.DSA", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$DSA"); 1745- put("KeyPairGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ElGamal"); 1746+ // BEGIN android-removed 1747+ // put("KeyPairGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ElGamal"); 1748+ // END android-removed 1749 1750 put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1.1", "RSA"); 1751 put("Alg.Alias.KeyPairGenerator.DIFFIEHELLMAN", "DH"); 1752 1753- put("KeyPairGenerator.GOST3410", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$GOST3410"); 1754- put("Alg.Alias.KeyPairGenerator.GOST-3410", "GOST3410"); 1755- put("Alg.Alias.KeyPairGenerator.GOST-3410-94", "GOST3410"); 1756+ // BEGIN android-removed 1757+ // put("KeyPairGenerator.GOST3410", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$GOST3410"); 1758+ // put("Alg.Alias.KeyPairGenerator.GOST-3410", "GOST3410"); 1759+ // put("Alg.Alias.KeyPairGenerator.GOST-3410-94", "GOST3410"); 1760+ // END android-removed 1761 1762 // 1763 // key factories 1764@@ -397,20 +469,24 @@ 1765 put("KeyFactory.RSA", "org.bouncycastle.jce.provider.JDKKeyFactory$RSA"); 1766 put("KeyFactory.DH", "org.bouncycastle.jce.provider.JDKKeyFactory$DH"); 1767 put("KeyFactory.DSA", "org.bouncycastle.jce.provider.JDKKeyFactory$DSA"); 1768- put("KeyFactory.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal"); 1769- put("KeyFactory.ElGamal", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal"); 1770- 1771- put("KeyFactory.X.509", "org.bouncycastle.jce.provider.JDKKeyFactory$X509"); 1772+ // BEGIN android-removed 1773+ // put("KeyFactory.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal"); 1774+ // put("KeyFactory.ElGamal", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal"); 1775+ // 1776+ // put("KeyFactory.X.509", "org.bouncycastle.jce.provider.JDKKeyFactory$X509"); 1777+ // END android-removed 1778 1779 put("Alg.Alias.KeyFactory.1.2.840.113549.1.1.1", "RSA"); 1780 put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA"); 1781 1782 put("Alg.Alias.KeyFactory.DIFFIEHELLMAN", "DH"); 1783 1784- put("KeyFactory.GOST3410", "org.bouncycastle.jce.provider.JDKKeyFactory$GOST3410"); 1785- put("Alg.Alias.KeyFactory.GOST-3410", "GOST3410"); 1786- put("Alg.Alias.KeyFactory.GOST-3410-94", "GOST3410"); 1787- put("Alg.Alias.KeyFactory." + CryptoProObjectIdentifiers.gostR3410_94, "GOST3410"); 1788+ // BEGIN android-removed 1789+ // put("KeyFactory.GOST3410", "org.bouncycastle.jce.provider.JDKKeyFactory$GOST3410"); 1790+ // put("Alg.Alias.KeyFactory.GOST-3410", "GOST3410"); 1791+ // put("Alg.Alias.KeyFactory.GOST-3410-94", "GOST3410"); 1792+ // put("Alg.Alias.KeyFactory." + CryptoProObjectIdentifiers.gostR3410_94, "GOST3410"); 1793+ // END android-removed 1794 1795 // 1796 // Algorithm parameters 1797@@ -418,24 +494,34 @@ 1798 put("AlgorithmParameters.DES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters"); 1799 put("Alg.Alias.AlgorithmParameters." + OIWObjectIdentifiers.desCBC, "DES"); 1800 put("AlgorithmParameters.DESEDE", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters"); 1801- put("AlgorithmParameters." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters"); 1802- put("AlgorithmParameters.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters"); 1803- put("AlgorithmParameters.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters"); 1804+ // BEGIN android-changed 1805+ put("Alg.Alias.AlgorithmParameters." + PKCSObjectIdentifiers.des_EDE3_CBC, "DESEDE"); 1806+ // END android-changed 1807+ // BEGIN android-removed 1808+ // put("AlgorithmParameters.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters"); 1809+ // put("AlgorithmParameters.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters"); 1810+ // END android-removed 1811 1812 // 1813 // secret key factories. 1814 // 1815 put("SecretKeyFactory.DES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$DES"); 1816- put("SecretKeyFactory.PBEWITHMD2ANDDES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD2AndDES"); 1817- 1818- put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 1819- put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 1820+ // BEGIN android-removed 1821+ // put("SecretKeyFactory.PBEWITHMD2ANDDES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD2AndDES"); 1822+ // END android-removed 1823+ 1824+ // BEGIN android-removed 1825+ // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 1826+ // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 1827+ // END android-removed 1828 put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES"); 1829 put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDDES"); 1830 put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES"); 1831 put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndRC2_CBC, "PBEWITHSHA1ANDRC2"); 1832 1833- put("SecretKeyFactory.PBEWITHMD2ANDRC2", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD2AndRC2"); 1834+ // BEGIN android-removed 1835+ // put("SecretKeyFactory.PBEWITHMD2ANDRC2", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD2AndRC2"); 1836+ // END android-removed 1837 put("SecretKeyFactory.PBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5AndDES"); 1838 put("SecretKeyFactory.PBEWITHMD5ANDRC2", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5AndRC2"); 1839 put("SecretKeyFactory.PBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA1AndDES"); 1840@@ -447,31 +533,41 @@ 1841 put("SecretKeyFactory.PBEWITHSHAAND128BITRC2-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd128BitRC2"); 1842 put("SecretKeyFactory.PBEWITHSHAAND40BITRC2-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAnd40BitRC2"); 1843 put("SecretKeyFactory.PBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHAAndTwofish"); 1844- put("SecretKeyFactory.PBEWITHHMACRIPEMD160", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithRIPEMD160"); 1845+ // BEGIN android-removed 1846+ // put("SecretKeyFactory.PBEWITHHMACRIPEMD160", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithRIPEMD160"); 1847+ // END android-removed 1848 put("SecretKeyFactory.PBEWITHHMACSHA1", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithSHA"); 1849- put("SecretKeyFactory.PBEWITHHMACTIGER", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithTiger"); 1850+ // BEGIN android-removed 1851+ // put("SecretKeyFactory.PBEWITHHMACTIGER", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithTiger"); 1852+ // END android-removed 1853 1854 put("SecretKeyFactory.PBEWITHMD5AND128BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5And128BitAESCBCOpenSSL"); 1855 put("SecretKeyFactory.PBEWITHMD5AND192BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5And192BitAESCBCOpenSSL"); 1856 put("SecretKeyFactory.PBEWITHMD5AND256BITAES-CBC-OPENSSL", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBEWithMD5And256BitAESCBCOpenSSL"); 1857 1858- put("Alg.Alias.SecretKeyFactory.PBE", "PBE/PKCS5"); 1859- 1860- put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHMD5ANDDES", "PBE/PKCS5"); 1861- put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHA1ANDDES", "PBE/PKCS5"); 1862- put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12"); 1863- put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12"); 1864- put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "PBE/PKCS12"); 1865- put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAANDTWOFISH-CBC", "PBE/PKCS12"); 1866- 1867- put("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDDES-CBC", "PBEWITHMD2ANDDES"); 1868- put("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDRC2-CBC", "PBEWITHMD2ANDRC2"); 1869+ // BEGIN android-removed 1870+ // put("Alg.Alias.SecretKeyFactory.PBE", "PBE/PKCS5"); 1871+ // 1872+ // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHMD5ANDDES", "PBE/PKCS5"); 1873+ // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHA1ANDDES", "PBE/PKCS5"); 1874+ // put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12"); 1875+ // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12"); 1876+ // put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "PBE/PKCS12"); 1877+ // put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAANDTWOFISH-CBC", "PBE/PKCS12"); 1878+ // END android-removed 1879+ 1880+ // BEGIN android-removed 1881+ // put("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDDES-CBC", "PBEWITHMD2ANDDES"); 1882+ // put("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDRC2-CBC", "PBEWITHMD2ANDRC2"); 1883+ // END android-removed 1884 put("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDDES-CBC", "PBEWITHMD5ANDDES"); 1885 put("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDRC2-CBC", "PBEWITHMD5ANDRC2"); 1886 put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDDES-CBC", "PBEWITHSHA1ANDDES"); 1887 put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDRC2-CBC", "PBEWITHSHA1ANDRC2"); 1888- put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 1889- put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 1890+ // BEGIN android-removed 1891+ // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, "PBEWITHMD2ANDDES"); 1892+ // put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2"); 1893+ // END android-removed 1894 put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndDES_CBC, "PBEWITHMD5ANDDES"); 1895 put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDRC2"); 1896 put("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndDES_CBC, "PBEWITHSHA1ANDDES"); 1897@@ -508,6 +604,10 @@ 1898 put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes128_cbc.getId(), "PBEWITHSHA256AND128BITAES-CBC-BC"); 1899 put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.getId(), "PBEWITHSHA256AND192BITAES-CBC-BC"); 1900 put("Alg.Alias.SecretKeyFactory." + BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.getId(), "PBEWITHSHA256AND256BITAES-CBC-BC"); 1901+ // BEGIN android-added 1902+ 1903+ put("SecretKeyFactory.PBKDF2WithHmacSHA1", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBKDF2WithHmacSHA1"); 1904+ // END android-added 1905 1906 addMacAlgorithms(); 1907 1908@@ -516,16 +616,23 @@ 1909 addSignatureAlgorithms(); 1910 1911 // Certification Path API 1912- put("CertPathValidator.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathValidatorSpi"); 1913- put("CertPathBuilder.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathBuilderSpi"); 1914- put("CertPathValidator.RFC3280", "org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi"); 1915- put("CertPathBuilder.RFC3280", "org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi"); 1916+ // BEGIN android-removed 1917+ // put("CertPathValidator.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathValidatorSpi"); 1918+ // put("CertPathBuilder.RFC3281", "org.bouncycastle.jce.provider.PKIXAttrCertPathBuilderSpi"); 1919+ // END android-removed 1920+ // BEGIN android-changed 1921+ // Use Alg.Alias so RFC3280 doesn't show up when iterating provider services, only PKIX 1922+ put("Alg.Alias.CertPathValidator.RFC3280", "PKIX"); 1923+ put("Alg.Alias.CertPathBuilder.RFC3280", "PKIX"); 1924+ // END android-changed 1925 put("CertPathValidator.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi"); 1926 put("CertPathBuilder.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi"); 1927 put("CertStore.Collection", "org.bouncycastle.jce.provider.CertStoreCollectionSpi"); 1928- put("CertStore.LDAP", "org.bouncycastle.jce.provider.X509LDAPCertStoreSpi"); 1929- put("CertStore.Multi", "org.bouncycastle.jce.provider.MultiCertStoreSpi"); 1930- put("Alg.Alias.CertStore.X509LDAP", "LDAP"); 1931+ // BEGIN android-removed 1932+ // put("CertStore.LDAP", "org.bouncycastle.jce.provider.X509LDAPCertStoreSpi"); 1933+ // put("CertStore.Multi", "org.bouncycastle.jce.provider.MultiCertStoreSpi"); 1934+ // put("Alg.Alias.CertStore.X509LDAP", "LDAP"); 1935+ // END android-removed 1936 } 1937 1938 private void loadAlgorithms(String packageName, String[] names) 1939@@ -586,42 +693,46 @@ 1940 // 1941 private void addMacAlgorithms() 1942 { 1943- put("Mac.DESMAC", "org.bouncycastle.jce.provider.JCEMac$DES"); 1944- put("Alg.Alias.Mac.DES", "DESMAC"); 1945- put("Mac.DESMAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$DESCFB8"); 1946- put("Alg.Alias.Mac.DES/CFB8", "DESMAC/CFB8"); 1947- 1948- put("Mac.DESWITHISO9797", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3"); 1949- put("Alg.Alias.Mac.DESISO9797MAC", "DESWITHISO9797"); 1950- 1951- put("Mac.ISO9797ALG3MAC", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3"); 1952- put("Alg.Alias.Mac.ISO9797ALG3", "ISO9797ALG3MAC"); 1953- put("Mac.ISO9797ALG3WITHISO7816-4PADDING", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3with7816d4"); 1954- put("Alg.Alias.Mac.ISO9797ALG3MACWITHISO7816-4PADDING", "ISO9797ALG3WITHISO7816-4PADDING"); 1955- 1956- put("Mac.RC2MAC", "org.bouncycastle.jce.provider.JCEMac$RC2"); 1957- put("Alg.Alias.Mac.RC2", "RC2MAC"); 1958- put("Mac.RC2MAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$RC2CFB8"); 1959- put("Alg.Alias.Mac.RC2/CFB8", "RC2MAC/CFB8"); 1960- 1961- 1962- put("Mac.GOST28147MAC", "org.bouncycastle.jce.provider.JCEMac$GOST28147"); 1963- put("Alg.Alias.Mac.GOST28147", "GOST28147MAC"); 1964- 1965- put("Mac.OLDHMACSHA384", "org.bouncycastle.jce.provider.JCEMac$OldSHA384"); 1966- 1967- put("Mac.OLDHMACSHA512", "org.bouncycastle.jce.provider.JCEMac$OldSHA512"); 1968- 1969- addHMACAlgorithm("MD2", "org.bouncycastle.jce.provider.JCEMac$MD2", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD2HMAC"); 1970- addHMACAlgorithm("MD4", "org.bouncycastle.jce.provider.JCEMac$MD4", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD4HMAC"); 1971+ // BEGIN android-removed 1972+ // put("Mac.DESMAC", "org.bouncycastle.jce.provider.JCEMac$DES"); 1973+ // put("Alg.Alias.Mac.DES", "DESMAC"); 1974+ // put("Mac.DESMAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$DESCFB8"); 1975+ // put("Alg.Alias.Mac.DES/CFB8", "DESMAC/CFB8"); 1976+ // 1977+ // put("Mac.DESWITHISO9797", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3"); 1978+ // put("Alg.Alias.Mac.DESISO9797MAC", "DESWITHISO9797"); 1979+ // 1980+ // put("Mac.ISO9797ALG3MAC", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3"); 1981+ // put("Alg.Alias.Mac.ISO9797ALG3", "ISO9797ALG3MAC"); 1982+ // put("Mac.ISO9797ALG3WITHISO7816-4PADDING", "org.bouncycastle.jce.provider.JCEMac$DES9797Alg3with7816d4"); 1983+ // put("Alg.Alias.Mac.ISO9797ALG3MACWITHISO7816-4PADDING", "ISO9797ALG3WITHISO7816-4PADDING"); 1984+ // 1985+ // put("Mac.RC2MAC", "org.bouncycastle.jce.provider.JCEMac$RC2"); 1986+ // put("Alg.Alias.Mac.RC2", "RC2MAC"); 1987+ // put("Mac.RC2MAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$RC2CFB8"); 1988+ // put("Alg.Alias.Mac.RC2/CFB8", "RC2MAC/CFB8"); 1989+ // 1990+ // 1991+ // put("Mac.GOST28147MAC", "org.bouncycastle.jce.provider.JCEMac$GOST28147"); 1992+ // put("Alg.Alias.Mac.GOST28147", "GOST28147MAC"); 1993+ // 1994+ // put("Mac.OLDHMACSHA384", "org.bouncycastle.jce.provider.JCEMac$OldSHA384"); 1995+ // 1996+ // put("Mac.OLDHMACSHA512", "org.bouncycastle.jce.provider.JCEMac$OldSHA512"); 1997+ // 1998+ // addHMACAlgorithm("MD2", "org.bouncycastle.jce.provider.JCEMac$MD2", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD2HMAC"); 1999+ // addHMACAlgorithm("MD4", "org.bouncycastle.jce.provider.JCEMac$MD4", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD4HMAC"); 2000+ // END android-removed 2001 addHMACAlgorithm("MD5", "org.bouncycastle.jce.provider.JCEMac$MD5", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD5HMAC"); 2002 addHMACAlias("MD5", IANAObjectIdentifiers.hmacMD5); 2003 2004 addHMACAlgorithm("SHA1", "org.bouncycastle.jce.provider.JCEMac$SHA1", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA1"); 2005 addHMACAlias("SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1); 2006 addHMACAlias("SHA1", IANAObjectIdentifiers.hmacSHA1); 2007- addHMACAlgorithm("SHA224", "org.bouncycastle.jce.provider.JCEMac$SHA224", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA224"); 2008- addHMACAlias("SHA224", PKCSObjectIdentifiers.id_hmacWithSHA224); 2009+ // BEGIN android-removed 2010+ // addHMACAlgorithm("SHA224", "org.bouncycastle.jce.provider.JCEMac$SHA224", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA224"); 2011+ // addHMACAlias("SHA224", PKCSObjectIdentifiers.id_hmacWithSHA224); 2012+ // END android-removed 2013 addHMACAlgorithm("SHA256", "org.bouncycastle.jce.provider.JCEMac$SHA256", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA256"); 2014 addHMACAlias("SHA256", PKCSObjectIdentifiers.id_hmacWithSHA256); 2015 addHMACAlgorithm("SHA384", "org.bouncycastle.jce.provider.JCEMac$SHA384", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA384"); 2016@@ -629,16 +740,20 @@ 2017 addHMACAlgorithm("SHA512", "org.bouncycastle.jce.provider.JCEMac$SHA512", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA512"); 2018 addHMACAlias("SHA512", PKCSObjectIdentifiers.id_hmacWithSHA512); 2019 2020- addHMACAlgorithm("RIPEMD128", "org.bouncycastle.jce.provider.JCEMac$RIPEMD128", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD128HMAC"); 2021- addHMACAlgorithm("RIPEMD160", "org.bouncycastle.jce.provider.JCEMac$RIPEMD160", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD160HMAC"); 2022- addHMACAlias("RIPEMD160", IANAObjectIdentifiers.hmacRIPEMD160); 2023- 2024- addHMACAlgorithm("TIGER", "org.bouncycastle.jce.provider.JCEMac$Tiger", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACTIGER"); 2025- addHMACAlias("TIGER", IANAObjectIdentifiers.hmacTIGER); 2026+ // BEGIN android-removed 2027+ // addHMACAlgorithm("RIPEMD128", "org.bouncycastle.jce.provider.JCEMac$RIPEMD128", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD128HMAC"); 2028+ // addHMACAlgorithm("RIPEMD160", "org.bouncycastle.jce.provider.JCEMac$RIPEMD160", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD160HMAC"); 2029+ // addHMACAlias("RIPEMD160", IANAObjectIdentifiers.hmacRIPEMD160); 2030+ // 2031+ // addHMACAlgorithm("TIGER", "org.bouncycastle.jce.provider.JCEMac$Tiger", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACTIGER"); 2032+ // addHMACAlias("TIGER", IANAObjectIdentifiers.hmacTIGER); 2033+ // END android-removed 2034 2035 put("Mac.PBEWITHHMACSHA", "org.bouncycastle.jce.provider.JCEMac$PBEWithSHA"); 2036 put("Mac.PBEWITHHMACSHA1", "org.bouncycastle.jce.provider.JCEMac$PBEWithSHA"); 2037- put("Mac.PBEWITHHMACRIPEMD160", "org.bouncycastle.jce.provider.JCEMac$PBEWithRIPEMD160"); 2038+ // BEGIN android-removed 2039+ // put("Mac.PBEWITHHMACRIPEMD160", "org.bouncycastle.jce.provider.JCEMac$PBEWithRIPEMD160"); 2040+ // END android-removed 2041 put("Alg.Alias.Mac.1.3.14.3.2.26", "PBEWITHHMACSHA"); 2042 } 2043 2044@@ -676,9 +791,11 @@ 2045 put("Alg.Alias.MessageDigest.SHA1", "SHA-1"); 2046 put("Alg.Alias.MessageDigest.SHA", "SHA-1"); 2047 put("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1"); 2048- put("MessageDigest.SHA-224", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA224"); 2049- put("Alg.Alias.MessageDigest.SHA224", "SHA-224"); 2050- put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha224, "SHA-224"); 2051+ // BEGIN android-removed 2052+ // put("MessageDigest.SHA-224", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA224"); 2053+ // put("Alg.Alias.MessageDigest.SHA224", "SHA-224"); 2054+ // put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha224, "SHA-224"); 2055+ // END android-removed 2056 put("MessageDigest.SHA-256", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA256"); 2057 put("Alg.Alias.MessageDigest.SHA256", "SHA-256"); 2058 put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha256, "SHA-256"); 2059@@ -689,27 +806,31 @@ 2060 put("Alg.Alias.MessageDigest.SHA512", "SHA-512"); 2061 put("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512, "SHA-512"); 2062 2063- put("MessageDigest.MD2", "org.bouncycastle.jce.provider.JDKMessageDigest$MD2"); 2064- put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md2, "MD2"); 2065- put("MessageDigest.MD4", "org.bouncycastle.jce.provider.JDKMessageDigest$MD4"); 2066- put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md4, "MD4"); 2067+ // BEGIN android-removed 2068+ // put("MessageDigest.MD2", "org.bouncycastle.jce.provider.JDKMessageDigest$MD2"); 2069+ // put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md2, "MD2"); 2070+ // put("MessageDigest.MD4", "org.bouncycastle.jce.provider.JDKMessageDigest$MD4"); 2071+ // put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md4, "MD4"); 2072+ // END android-removed 2073 put("MessageDigest.MD5", "org.bouncycastle.jce.provider.JDKMessageDigest$MD5"); 2074 put("Alg.Alias.MessageDigest." + PKCSObjectIdentifiers.md5, "MD5"); 2075- put("MessageDigest.RIPEMD128", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD128"); 2076- put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd128, "RIPEMD128"); 2077- put("MessageDigest.RIPEMD160", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD160"); 2078- put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd160, "RIPEMD160"); 2079- put("MessageDigest.RIPEMD256", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD256"); 2080- put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd256, "RIPEMD256"); 2081- put("MessageDigest.RIPEMD320", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD320"); 2082- put("MessageDigest.Tiger", "org.bouncycastle.jce.provider.JDKMessageDigest$Tiger"); 2083- 2084- put("MessageDigest.WHIRLPOOL", "org.bouncycastle.jce.provider.JDKMessageDigest$Whirlpool"); 2085- 2086- put("MessageDigest.GOST3411", "org.bouncycastle.jce.provider.JDKMessageDigest$GOST3411"); 2087- put("Alg.Alias.MessageDigest.GOST", "GOST3411"); 2088- put("Alg.Alias.MessageDigest.GOST-3411", "GOST3411"); 2089- put("Alg.Alias.MessageDigest." + CryptoProObjectIdentifiers.gostR3411, "GOST3411"); 2090+ // BEGIN android-removed 2091+ // put("MessageDigest.RIPEMD128", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD128"); 2092+ // put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd128, "RIPEMD128"); 2093+ // put("MessageDigest.RIPEMD160", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD160"); 2094+ // put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd160, "RIPEMD160"); 2095+ // put("MessageDigest.RIPEMD256", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD256"); 2096+ // put("Alg.Alias.MessageDigest." + TeleTrusTObjectIdentifiers.ripemd256, "RIPEMD256"); 2097+ // put("MessageDigest.RIPEMD320", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD320"); 2098+ // put("MessageDigest.Tiger", "org.bouncycastle.jce.provider.JDKMessageDigest$Tiger"); 2099+ 2100+ // put("MessageDigest.WHIRLPOOL", "org.bouncycastle.jce.provider.JDKMessageDigest$Whirlpool"); 2101+ 2102+ // put("MessageDigest.GOST3411", "org.bouncycastle.jce.provider.JDKMessageDigest$GOST3411"); 2103+ // put("Alg.Alias.MessageDigest.GOST", "GOST3411"); 2104+ // put("Alg.Alias.MessageDigest.GOST-3411", "GOST3411"); 2105+ // put("Alg.Alias.MessageDigest." + CryptoProObjectIdentifiers.gostR3411, "GOST3411"); 2106+ // END android-removed 2107 } 2108 2109 // 2110@@ -717,55 +838,70 @@ 2111 // 2112 private void addSignatureAlgorithms() 2113 { 2114- put("Signature.MD2WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD2WithRSAEncryption"); 2115- put("Signature.MD4WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD4WithRSAEncryption"); 2116+ // BEGIN android-removed 2117+ // Dropping MD2 2118+ // put("Signature.MD2WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD2WithRSAEncryption"); 2119+ // put("Signature.MD4WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD4WithRSAEncryption"); 2120+ // END android-removed 2121 put("Signature.MD5WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD5WithRSAEncryption"); 2122 put("Signature.SHA1WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA1WithRSAEncryption"); 2123- put("Signature.SHA224WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA224WithRSAEncryption"); 2124+ // BEGIN android-removed 2125+ // put("Signature.SHA224WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA224WithRSAEncryption"); 2126+ // END android-removed 2127 put("Signature.SHA256WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA256WithRSAEncryption"); 2128 put("Signature.SHA384WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA384WithRSAEncryption"); 2129 put("Signature.SHA512WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA512WithRSAEncryption"); 2130- put("Signature.RIPEMD160WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD160WithRSAEncryption"); 2131- put("Signature.RIPEMD128WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD128WithRSAEncryption"); 2132- put("Signature.RIPEMD256WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD256WithRSAEncryption"); 2133- put("Signature.DSA", "org.bouncycastle.jce.provider.JDKDSASigner$stdDSA"); 2134+ // BEGIN android-removed 2135+ // put("Signature.RIPEMD160WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD160WithRSAEncryption"); 2136+ // put("Signature.RIPEMD128WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD128WithRSAEncryption"); 2137+ // put("Signature.RIPEMD256WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD256WithRSAEncryption"); 2138+ // END android-removed 2139+ // BEGIN android-changed 2140+ put("Signature.SHA1withDSA", "org.bouncycastle.jce.provider.JDKDSASigner$stdDSA"); 2141+ // END android-changed 2142 put("Signature.NONEWITHDSA", "org.bouncycastle.jce.provider.JDKDSASigner$noneDSA"); 2143- put("Signature.SHA1withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$SHA1WithRSAEncryption"); 2144- put("Signature.MD5withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$MD5WithRSAEncryption"); 2145- put("Signature.RIPEMD160withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$RIPEMD160WithRSAEncryption"); 2146- 2147- put("Signature.RSASSA-PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$PSSwithRSA"); 2148- put("Signature." + PKCSObjectIdentifiers.id_RSASSA_PSS, "org.bouncycastle.jce.provider.JDKPSSSigner$PSSwithRSA"); 2149- put("Signature.SHA1withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA1withRSA"); 2150- put("Signature.SHA224withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA224withRSA"); 2151- put("Signature.SHA256withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA256withRSA"); 2152- put("Signature.SHA384withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA384withRSA"); 2153- put("Signature.SHA512withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA512withRSA"); 2154- 2155- put("Signature.RSA", "org.bouncycastle.jce.provider.JDKDigestSignature$noneRSA"); 2156- put("Signature.RAWRSASSA-PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$nonePSS"); 2157+ // BEGIN android-removed 2158+ // put("Signature.SHA1withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$SHA1WithRSAEncryption"); 2159+ // put("Signature.MD5withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$MD5WithRSAEncryption"); 2160+ // put("Signature.RIPEMD160withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$RIPEMD160WithRSAEncryption"); 2161+ // 2162+ // put("Signature.RSASSA-PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$PSSwithRSA"); 2163+ // put("Signature." + PKCSObjectIdentifiers.id_RSASSA_PSS, "org.bouncycastle.jce.provider.JDKPSSSigner$PSSwithRSA"); 2164+ // put("Signature.SHA1withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA1withRSA"); 2165+ // put("Signature.SHA224withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA224withRSA"); 2166+ // put("Signature.SHA256withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA256withRSA"); 2167+ // put("Signature.SHA384withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA384withRSA"); 2168+ // put("Signature.SHA512withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA512withRSA"); 2169+ // 2170+ // put("Signature.RSA", "org.bouncycastle.jce.provider.JDKDigestSignature$noneRSA"); 2171+ // put("Signature.RAWRSASSA-PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$nonePSS"); 2172+ // END android-removed 2173 2174 put("Alg.Alias.Signature.RAWDSA", "NONEWITHDSA"); 2175 2176- put("Alg.Alias.Signature.RAWRSA", "RSA"); 2177- put("Alg.Alias.Signature.NONEWITHRSA", "RSA"); 2178- put("Alg.Alias.Signature.RAWRSAPSS", "RAWRSASSA-PSS"); 2179- put("Alg.Alias.Signature.NONEWITHRSAPSS", "RAWRSASSA-PSS"); 2180- put("Alg.Alias.Signature.NONEWITHRSASSA-PSS", "RAWRSASSA-PSS"); 2181- 2182- put("Alg.Alias.Signature.RSAPSS", "RSASSA-PSS"); 2183- 2184- put("Alg.Alias.Signature.SHA1withRSAandMGF1", "SHA1withRSA/PSS"); 2185- put("Alg.Alias.Signature.SHA224withRSAandMGF1", "SHA224withRSA/PSS"); 2186- put("Alg.Alias.Signature.SHA256withRSAandMGF1", "SHA256withRSA/PSS"); 2187- put("Alg.Alias.Signature.SHA384withRSAandMGF1", "SHA384withRSA/PSS"); 2188- put("Alg.Alias.Signature.SHA512withRSAandMGF1", "SHA512withRSA/PSS"); 2189- 2190- put("Alg.Alias.Signature.MD2withRSAEncryption", "MD2WithRSAEncryption"); 2191- put("Alg.Alias.Signature.MD4withRSAEncryption", "MD4WithRSAEncryption"); 2192+ // BEGIN android-removed 2193+ // put("Alg.Alias.Signature.RAWRSA", "RSA"); 2194+ // put("Alg.Alias.Signature.NONEWITHRSA", "RSA"); 2195+ // put("Alg.Alias.Signature.RAWRSAPSS", "RAWRSASSA-PSS"); 2196+ // put("Alg.Alias.Signature.NONEWITHRSAPSS", "RAWRSASSA-PSS"); 2197+ // put("Alg.Alias.Signature.NONEWITHRSASSA-PSS", "RAWRSASSA-PSS"); 2198+ // 2199+ // put("Alg.Alias.Signature.RSAPSS", "RSASSA-PSS"); 2200+ // 2201+ // put("Alg.Alias.Signature.SHA1withRSAandMGF1", "SHA1withRSA/PSS"); 2202+ // put("Alg.Alias.Signature.SHA224withRSAandMGF1", "SHA224withRSA/PSS"); 2203+ // put("Alg.Alias.Signature.SHA256withRSAandMGF1", "SHA256withRSA/PSS"); 2204+ // put("Alg.Alias.Signature.SHA384withRSAandMGF1", "SHA384withRSA/PSS"); 2205+ // put("Alg.Alias.Signature.SHA512withRSAandMGF1", "SHA512withRSA/PSS"); 2206+ // 2207+ // put("Alg.Alias.Signature.MD2withRSAEncryption", "MD2WithRSAEncryption"); 2208+ // put("Alg.Alias.Signature.MD4withRSAEncryption", "MD4WithRSAEncryption"); 2209+ // END android-removed 2210 put("Alg.Alias.Signature.MD5withRSAEncryption", "MD5WithRSAEncryption"); 2211 put("Alg.Alias.Signature.SHA1withRSAEncryption", "SHA1WithRSAEncryption"); 2212- put("Alg.Alias.Signature.SHA224withRSAEncryption", "SHA224WithRSAEncryption"); 2213+ // BEGIN android-removed 2214+ // put("Alg.Alias.Signature.SHA224withRSAEncryption", "SHA224WithRSAEncryption"); 2215+ // END android-removed 2216 2217 put("Alg.Alias.Signature.SHA256withRSAEncryption", "SHA256WithRSAEncryption"); 2218 put("Alg.Alias.Signature.SHA384withRSAEncryption", "SHA384WithRSAEncryption"); 2219@@ -779,24 +915,30 @@ 2220 put("Alg.Alias.Signature.SHA384WITHRSAENCRYPTION", "SHA384WithRSAEncryption"); 2221 put("Alg.Alias.Signature.SHA512WITHRSAENCRYPTION", "SHA512WithRSAEncryption"); 2222 2223- put("Alg.Alias.Signature.RIPEMD160withRSAEncryption", "RIPEMD160WithRSAEncryption"); 2224- 2225- put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md2WithRSAEncryption, "MD2WithRSAEncryption"); 2226- put("Alg.Alias.Signature.MD2WithRSA", "MD2WithRSAEncryption"); 2227- put("Alg.Alias.Signature.MD2withRSA", "MD2WithRSAEncryption"); 2228- put("Alg.Alias.Signature.MD2/RSA", "MD2WithRSAEncryption"); 2229+ // BEGIN android-removed 2230+ // Dropping MD2 2231+ // put("Alg.Alias.Signature.RIPEMD160withRSAEncryption", "RIPEMD160WithRSAEncryption"); 2232+ // put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md2WithRSAEncryption, "MD2WithRSAEncryption"); 2233+ // put("Alg.Alias.Signature.MD2WithRSA", "MD2WithRSAEncryption"); 2234+ // put("Alg.Alias.Signature.MD2withRSA", "MD2WithRSAEncryption"); 2235+ // put("Alg.Alias.Signature.MD2/RSA", "MD2WithRSAEncryption"); 2236+ // END android-removed 2237 put("Alg.Alias.Signature.MD5WithRSA", "MD5WithRSAEncryption"); 2238 put("Alg.Alias.Signature.MD5withRSA", "MD5WithRSAEncryption"); 2239 put("Alg.Alias.Signature.MD5/RSA", "MD5WithRSAEncryption"); 2240 put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md5WithRSAEncryption, "MD5WithRSAEncryption"); 2241- put("Alg.Alias.Signature.MD4WithRSA", "MD4WithRSAEncryption"); 2242- put("Alg.Alias.Signature.MD4withRSA", "MD4WithRSAEncryption"); 2243- put("Alg.Alias.Signature.MD4/RSA", "MD4WithRSAEncryption"); 2244- put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md4WithRSAEncryption, "MD4WithRSAEncryption"); 2245+ // BEGIN android-removed 2246+ // put("Alg.Alias.Signature.MD4WithRSA", "MD4WithRSAEncryption"); 2247+ // put("Alg.Alias.Signature.MD4withRSA", "MD4WithRSAEncryption"); 2248+ // put("Alg.Alias.Signature.MD4/RSA", "MD4WithRSAEncryption"); 2249+ // put("Alg.Alias.Signature." + PKCSObjectIdentifiers.md4WithRSAEncryption, "MD4WithRSAEncryption"); 2250+ // END android-removed 2251 put("Alg.Alias.Signature.SHA1WithRSA", "SHA1WithRSAEncryption"); 2252 put("Alg.Alias.Signature.SHA1withRSA", "SHA1WithRSAEncryption"); 2253- put("Alg.Alias.Signature.SHA224WithRSA", "SHA224WithRSAEncryption"); 2254- put("Alg.Alias.Signature.SHA224withRSA", "SHA224WithRSAEncryption"); 2255+ // BEGIN android-removed 2256+ // put("Alg.Alias.Signature.SHA224WithRSA", "SHA224WithRSAEncryption"); 2257+ // put("Alg.Alias.Signature.SHA224withRSA", "SHA224WithRSAEncryption"); 2258+ // END android-removed 2259 put("Alg.Alias.Signature.SHA256WithRSA", "SHA256WithRSAEncryption"); 2260 put("Alg.Alias.Signature.SHA256withRSA", "SHA256WithRSAEncryption"); 2261 put("Alg.Alias.Signature.SHA384WithRSA", "SHA384WithRSAEncryption"); 2262@@ -806,92 +948,110 @@ 2263 put("Alg.Alias.Signature.SHA1/RSA", "SHA1WithRSAEncryption"); 2264 put("Alg.Alias.Signature.SHA-1/RSA", "SHA1WithRSAEncryption"); 2265 put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha1WithRSAEncryption, "SHA1WithRSAEncryption"); 2266- put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WithRSAEncryption"); 2267+ // BEGIN android-removed 2268+ // put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WithRSAEncryption"); 2269+ // END android-removed 2270 put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256WithRSAEncryption"); 2271 put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384WithRSAEncryption"); 2272 put("Alg.Alias.Signature." + PKCSObjectIdentifiers.sha512WithRSAEncryption, "SHA512WithRSAEncryption"); 2273 put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.1", "SHA1WithRSAEncryption"); 2274 put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.5", "SHA1WithRSAEncryption"); 2275 put("Alg.Alias.Signature.1.2.840.113549.2.5with1.2.840.113549.1.1.1", "MD5WithRSAEncryption"); 2276- put("Alg.Alias.Signature.RIPEMD160WithRSA", "RIPEMD160WithRSAEncryption"); 2277- put("Alg.Alias.Signature.RIPEMD160withRSA", "RIPEMD160WithRSAEncryption"); 2278- put("Alg.Alias.Signature.RIPEMD128WithRSA", "RIPEMD128WithRSAEncryption"); 2279- put("Alg.Alias.Signature.RIPEMD128withRSA", "RIPEMD128WithRSAEncryption"); 2280- put("Alg.Alias.Signature.RIPEMD256WithRSA", "RIPEMD256WithRSAEncryption"); 2281- put("Alg.Alias.Signature.RIPEMD256withRSA", "RIPEMD256WithRSAEncryption"); 2282- put("Alg.Alias.Signature.RIPEMD-160/RSA", "RIPEMD160WithRSAEncryption"); 2283- put("Alg.Alias.Signature.RMD160withRSA", "RIPEMD160WithRSAEncryption"); 2284- put("Alg.Alias.Signature.RMD160/RSA", "RIPEMD160WithRSAEncryption"); 2285- put("Alg.Alias.Signature.1.3.36.3.3.1.2", "RIPEMD160WithRSAEncryption"); 2286- put("Alg.Alias.Signature.1.3.36.3.3.1.3", "RIPEMD128WithRSAEncryption"); 2287- put("Alg.Alias.Signature.1.3.36.3.3.1.4", "RIPEMD256WithRSAEncryption"); 2288+ // BEGIN android-removed 2289+ // put("Alg.Alias.Signature.RIPEMD160WithRSA", "RIPEMD160WithRSAEncryption"); 2290+ // put("Alg.Alias.Signature.RIPEMD160withRSA", "RIPEMD160WithRSAEncryption"); 2291+ // put("Alg.Alias.Signature.RIPEMD128WithRSA", "RIPEMD128WithRSAEncryption"); 2292+ // put("Alg.Alias.Signature.RIPEMD128withRSA", "RIPEMD128WithRSAEncryption"); 2293+ // put("Alg.Alias.Signature.RIPEMD256WithRSA", "RIPEMD256WithRSAEncryption"); 2294+ // put("Alg.Alias.Signature.RIPEMD256withRSA", "RIPEMD256WithRSAEncryption"); 2295+ // put("Alg.Alias.Signature.RIPEMD-160/RSA", "RIPEMD160WithRSAEncryption"); 2296+ // put("Alg.Alias.Signature.RMD160withRSA", "RIPEMD160WithRSAEncryption"); 2297+ // put("Alg.Alias.Signature.RMD160/RSA", "RIPEMD160WithRSAEncryption"); 2298+ // put("Alg.Alias.Signature.1.3.36.3.3.1.2", "RIPEMD160WithRSAEncryption"); 2299+ // put("Alg.Alias.Signature.1.3.36.3.3.1.3", "RIPEMD128WithRSAEncryption"); 2300+ // put("Alg.Alias.Signature.1.3.36.3.3.1.4", "RIPEMD256WithRSAEncryption"); 2301+ // END android-removed 2302 put("Alg.Alias.Signature." + OIWObjectIdentifiers.sha1WithRSA, "SHA1WithRSAEncryption"); 2303 2304- put("Alg.Alias.Signature.MD2WITHRSAENCRYPTION", "MD2WithRSAEncryption"); 2305+ // BEGIN android-removed 2306+ // put("Alg.Alias.Signature.MD2WITHRSAENCRYPTION", "MD2WithRSAEncryption"); 2307+ // END android-removed 2308 put("Alg.Alias.Signature.MD5WITHRSAENCRYPTION", "MD5WithRSAEncryption"); 2309 put("Alg.Alias.Signature.SHA1WITHRSAENCRYPTION", "SHA1WithRSAEncryption"); 2310- put("Alg.Alias.Signature.RIPEMD160WITHRSAENCRYPTION", "RIPEMD160WithRSAEncryption"); 2311+ // BEGIN android-removed 2312+ // put("Alg.Alias.Signature.RIPEMD160WITHRSAENCRYPTION", "RIPEMD160WithRSAEncryption"); 2313+ // END android-removed 2314 2315 put("Alg.Alias.Signature.MD5WITHRSA", "MD5WithRSAEncryption"); 2316 put("Alg.Alias.Signature.SHA1WITHRSA", "SHA1WithRSAEncryption"); 2317- put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption"); 2318- put("Alg.Alias.Signature.RMD160WITHRSA", "RIPEMD160WithRSAEncryption"); 2319- put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption"); 2320- 2321- addSignatureAlgorithm("SHA224", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa224", NISTObjectIdentifiers.dsa_with_sha224); 2322- addSignatureAlgorithm("SHA256", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa256", NISTObjectIdentifiers.dsa_with_sha256); 2323- addSignatureAlgorithm("SHA384", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384); 2324- addSignatureAlgorithm("SHA512", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512); 2325- 2326- put("Alg.Alias.Signature.SHA/DSA", "DSA"); 2327- put("Alg.Alias.Signature.SHA1withDSA", "DSA"); 2328- put("Alg.Alias.Signature.SHA1WITHDSA", "DSA"); 2329- put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "DSA"); 2330- put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "DSA"); 2331- put("Alg.Alias.Signature.DSAwithSHA1", "DSA"); 2332- put("Alg.Alias.Signature.DSAWITHSHA1", "DSA"); 2333- put("Alg.Alias.Signature.SHA1WithDSA", "DSA"); 2334- put("Alg.Alias.Signature.DSAWithSHA1", "DSA"); 2335- put("Alg.Alias.Signature.1.2.840.10040.4.3", "DSA"); 2336- put("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2"); 2337- put("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2"); 2338- put("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2"); 2339- 2340- put("Signature.ECGOST3410", "org.bouncycastle.jce.provider.JDKGOST3410Signer$ecgost3410"); 2341- put("Alg.Alias.Signature.ECGOST-3410", "ECGOST3410"); 2342- put("Alg.Alias.Signature.GOST-3410-2001", "ECGOST3410"); 2343- put("Alg.Alias.Signature.GOST3411withECGOST3410", "ECGOST3410"); 2344- put("Alg.Alias.Signature.GOST3411WITHECGOST3410", "ECGOST3410"); 2345- put("Alg.Alias.Signature.GOST3411WithECGOST3410", "ECGOST3410"); 2346- put("Alg.Alias.Signature." + CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "ECGOST3410"); 2347- 2348- put("Signature.GOST3410", "org.bouncycastle.jce.provider.JDKGOST3410Signer$gost3410"); 2349- put("Alg.Alias.Signature.GOST-3410", "GOST3410"); 2350- put("Alg.Alias.Signature.GOST-3410-94", "GOST3410"); 2351- put("Alg.Alias.Signature.GOST3411withGOST3410", "GOST3410"); 2352- put("Alg.Alias.Signature.GOST3411WITHGOST3410", "GOST3410"); 2353- put("Alg.Alias.Signature.GOST3411WithGOST3410", "GOST3410"); 2354- put("Alg.Alias.Signature." + CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3410"); 2355- } 2356- 2357- private void addSignatureAlgorithm( 2358- String digest, 2359- String algorithm, 2360- String className, 2361- DERObjectIdentifier oid) 2362- { 2363- String mainName = digest + "WITH" + algorithm; 2364- String jdk11Variation1 = digest + "with" + algorithm; 2365- String jdk11Variation2 = digest + "With" + algorithm; 2366- String alias = digest + "/" + algorithm; 2367- 2368- put("Signature." + mainName, className); 2369- put("Alg.Alias.Signature." + jdk11Variation1, mainName); 2370- put("Alg.Alias.Signature." + jdk11Variation2, mainName); 2371- put("Alg.Alias.Signature." + alias, mainName); 2372- put("Alg.Alias.Signature." + oid, mainName); 2373- put("Alg.Alias.Signature.OID." + oid, mainName); 2374- } 2375+ // BEGIN android-removed 2376+ // put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption"); 2377+ // put("Alg.Alias.Signature.RMD160WITHRSA", "RIPEMD160WithRSAEncryption"); 2378+ // put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption"); 2379+ // END android-removed 2380+ 2381+ // BEGIN android-removed 2382+ // addSignatureAlgorithm("SHA224", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa224", NISTObjectIdentifiers.dsa_with_sha224); 2383+ // addSignatureAlgorithm("SHA256", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa256", NISTObjectIdentifiers.dsa_with_sha256); 2384+ // addSignatureAlgorithm("SHA384", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384); 2385+ // addSignatureAlgorithm("SHA512", "DSA", "org.bouncycastle.jce.provider.JDKDSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512); 2386+ // END android-removed 2387+ 2388+ // BEGIN android-changed 2389+ put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA"); 2390+ put("Alg.Alias.Signature.DSA", "SHA1withDSA"); 2391+ put("Alg.Alias.Signature.SHA1WITHDSA", "SHA1withDSA"); 2392+ put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "SHA1withDSA"); 2393+ put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "SHA1withDSA"); 2394+ put("Alg.Alias.Signature.DSAwithSHA1", "SHA1withDSA"); 2395+ put("Alg.Alias.Signature.DSAWITHSHA1", "SHA1withDSA"); 2396+ put("Alg.Alias.Signature.SHA1WithDSA", "SHA1withDSA"); 2397+ put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA"); 2398+ put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA"); 2399+ // END android-changed 2400+ // BEGIN android-removed 2401+ // put("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2"); 2402+ // put("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2"); 2403+ // put("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2"); 2404+ // 2405+ // put("Signature.ECGOST3410", "org.bouncycastle.jce.provider.JDKGOST3410Signer$ecgost3410"); 2406+ // put("Alg.Alias.Signature.ECGOST-3410", "ECGOST3410"); 2407+ // put("Alg.Alias.Signature.GOST-3410-2001", "ECGOST3410"); 2408+ // put("Alg.Alias.Signature.GOST3411withECGOST3410", "ECGOST3410"); 2409+ // put("Alg.Alias.Signature.GOST3411WITHECGOST3410", "ECGOST3410"); 2410+ // put("Alg.Alias.Signature.GOST3411WithECGOST3410", "ECGOST3410"); 2411+ // put("Alg.Alias.Signature." + CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "ECGOST3410"); 2412+ // 2413+ // put("Signature.GOST3410", "org.bouncycastle.jce.provider.JDKGOST3410Signer$gost3410"); 2414+ // put("Alg.Alias.Signature.GOST-3410", "GOST3410"); 2415+ // put("Alg.Alias.Signature.GOST-3410-94", "GOST3410"); 2416+ // put("Alg.Alias.Signature.GOST3411withGOST3410", "GOST3410"); 2417+ // put("Alg.Alias.Signature.GOST3411WITHGOST3410", "GOST3410"); 2418+ // put("Alg.Alias.Signature.GOST3411WithGOST3410", "GOST3410"); 2419+ // put("Alg.Alias.Signature." + CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3410"); 2420+ // END android-removed 2421+ } 2422+ 2423+ // BEGIN android-removed 2424+ // private void addSignatureAlgorithm( 2425+ // String digest, 2426+ // String algorithm, 2427+ // String className, 2428+ // DERObjectIdentifier oid) 2429+ // { 2430+ // String mainName = digest + "WITH" + algorithm; 2431+ // String jdk11Variation1 = digest + "with" + algorithm; 2432+ // String jdk11Variation2 = digest + "With" + algorithm; 2433+ // String alias = digest + "/" + algorithm; 2434+ // 2435+ // put("Signature." + mainName, className); 2436+ // put("Alg.Alias.Signature." + jdk11Variation1, mainName); 2437+ // put("Alg.Alias.Signature." + jdk11Variation2, mainName); 2438+ // put("Alg.Alias.Signature." + alias, mainName); 2439+ // put("Alg.Alias.Signature." + oid, mainName); 2440+ // put("Alg.Alias.Signature.OID." + oid, mainName); 2441+ // } 2442+ // END android-removed 2443 2444 public void setParameter(String parameterName, Object parameter) 2445 { 2446diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/CertBlacklist.java bcprov-jdk16-146/org/bouncycastle/jce/provider/CertBlacklist.java 2447--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/CertBlacklist.java 1970-01-01 00:00:00.000000000 +0000 2448+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/CertBlacklist.java 2012-05-11 05:31:26.630725775 +0000 2449@@ -0,0 +1,171 @@ 2450+/* 2451+ * Copyright (C) 2012 The Android Open Source Project 2452+ * 2453+ * Licensed under the Apache License, Version 2.0 (the "License"); 2454+ * you may not use this file except in compliance with the License. 2455+ * You may obtain a copy of the License at 2456+ * 2457+ * http://www.apache.org/licenses/LICENSE-2.0 2458+ * 2459+ * Unless required by applicable law or agreed to in writing, software 2460+ * distributed under the License is distributed on an "AS IS" BASIS, 2461+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2462+ * See the License for the specific language governing permissions and 2463+ * limitations under the License. 2464+ */ 2465+ 2466+package org.bouncycastle.jce.provider; 2467+ 2468+import java.io.FileNotFoundException; 2469+import java.io.IOException; 2470+import java.math.BigInteger; 2471+import java.security.PublicKey; 2472+import java.util.ArrayList; 2473+import java.util.Arrays; 2474+import java.util.Collections; 2475+import java.util.HashSet; 2476+import java.util.List; 2477+import java.util.Set; 2478+ 2479+import libcore.io.IoUtils; 2480+import org.bouncycastle.crypto.Digest; 2481+import org.bouncycastle.crypto.digests.OpenSSLDigest; 2482+import org.bouncycastle.util.encoders.Hex; 2483+ 2484+public class CertBlacklist { 2485+ 2486+ private static final String ANDROID_DATA = System.getenv("ANDROID_DATA"); 2487+ private static final String BLACKLIST_ROOT = ANDROID_DATA + "/misc/keychain/"; 2488+ public static final String DEFAULT_PUBKEY_BLACKLIST_PATH = BLACKLIST_ROOT + "pubkey_blacklist.txt"; 2489+ public static final String DEFAULT_SERIAL_BLACKLIST_PATH = BLACKLIST_ROOT + "serial_blacklist.txt"; 2490+ 2491+ // public for testing 2492+ public final Set<BigInteger> serialBlacklist; 2493+ public final Set<byte[]> pubkeyBlacklist; 2494+ 2495+ public CertBlacklist() { 2496+ this(DEFAULT_PUBKEY_BLACKLIST_PATH, DEFAULT_SERIAL_BLACKLIST_PATH); 2497+ } 2498+ 2499+ /** Test only interface, not for public use */ 2500+ public CertBlacklist(String pubkeyBlacklistPath, String serialBlacklistPath) { 2501+ serialBlacklist = readSerialBlackList(serialBlacklistPath); 2502+ pubkeyBlacklist = readPublicKeyBlackList(pubkeyBlacklistPath); 2503+ } 2504+ 2505+ private static boolean isHex(String value) { 2506+ try { 2507+ new BigInteger(value, 16); 2508+ return true; 2509+ } catch (NumberFormatException e) { 2510+ System.logW("Could not parse hex value " + value, e); 2511+ return false; 2512+ } 2513+ } 2514+ 2515+ private static boolean isPubkeyHash(String value) { 2516+ if (value.length() != 40) { 2517+ System.logW("Invalid pubkey hash length: " + value.length()); 2518+ return false; 2519+ } 2520+ return isHex(value); 2521+ } 2522+ 2523+ private static String readBlacklist(String path) { 2524+ try { 2525+ return IoUtils.readFileAsString(path); 2526+ } catch (FileNotFoundException ignored) { 2527+ } catch (IOException e) { 2528+ System.logW("Could not read blacklist", e); 2529+ } 2530+ return ""; 2531+ } 2532+ 2533+ private static final Set<BigInteger> readSerialBlackList(String path) { 2534+ 2535+ // start out with a base set of known bad values 2536+ Set<BigInteger> bl = new HashSet<BigInteger>(Arrays.asList( 2537+ // From http://src.chromium.org/viewvc/chrome/trunk/src/net/base/x509_certificate.cc?revision=78748&view=markup 2538+ // Not a real certificate. For testing only. 2539+ new BigInteger("077a59bcd53459601ca6907267a6dd1c", 16), 2540+ new BigInteger("047ecbe9fca55f7bd09eae36e10cae1e", 16), 2541+ new BigInteger("d8f35f4eb7872b2dab0692e315382fb0", 16), 2542+ new BigInteger("b0b7133ed096f9b56fae91c874bd3ac0", 16), 2543+ new BigInteger("9239d5348f40d1695a745470e1f23f43", 16), 2544+ new BigInteger("e9028b9578e415dc1a710a2b88154447", 16), 2545+ new BigInteger("d7558fdaf5f1105bb213282b707729a3", 16), 2546+ new BigInteger("f5c86af36162f13a64f54f6dc9587c06", 16), 2547+ new BigInteger("392a434f0e07df1f8aa305de34e0c229", 16), 2548+ new BigInteger("3e75ced46b693021218830ae86a82a71", 16) 2549+ )); 2550+ 2551+ // attempt to augment it with values taken from gservices 2552+ String serialBlacklist = readBlacklist(path); 2553+ if (!serialBlacklist.equals("")) { 2554+ for(String value : serialBlacklist.split(",")) { 2555+ try { 2556+ bl.add(new BigInteger(value, 16)); 2557+ } catch (NumberFormatException e) { 2558+ System.logW("Tried to blacklist invalid serial number " + value, e); 2559+ } 2560+ } 2561+ } 2562+ 2563+ // whether that succeeds or fails, send it on its merry way 2564+ return Collections.unmodifiableSet(bl); 2565+ } 2566+ 2567+ private static final Set<byte[]> readPublicKeyBlackList(String path) { 2568+ 2569+ // start out with a base set of known bad values 2570+ Set<byte[]> bl = new HashSet<byte[]>(Arrays.asList( 2571+ // From http://src.chromium.org/viewvc/chrome/branches/782/src/net/base/x509_certificate.cc?r1=98750&r2=98749&pathrev=98750 2572+ // C=NL, O=DigiNotar, CN=DigiNotar Root CA/emailAddress=info@diginotar.nl 2573+ "410f36363258f30b347d12ce4863e433437806a8".getBytes(), 2574+ // Subject: CN=DigiNotar Cyber CA 2575+ // Issuer: CN=GTE CyberTrust Global Root 2576+ "ba3e7bd38cd7e1e6b9cd4c219962e59d7a2f4e37".getBytes(), 2577+ // Subject: CN=DigiNotar Services 1024 CA 2578+ // Issuer: CN=Entrust.net 2579+ "e23b8d105f87710a68d9248050ebefc627be4ca6".getBytes(), 2580+ // Subject: CN=DigiNotar PKIoverheid CA Organisatie - G2 2581+ // Issuer: CN=Staat der Nederlanden Organisatie CA - G2 2582+ "7b2e16bc39bcd72b456e9f055d1de615b74945db".getBytes(), 2583+ // Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven 2584+ // Issuer: CN=Staat der Nederlanden Overheid CA 2585+ "e8f91200c65cee16e039b9f883841661635f81c5".getBytes(), 2586+ // From http://src.chromium.org/viewvc/chrome?view=rev&revision=108479 2587+ // Subject: O=Digicert Sdn. Bhd. 2588+ // Issuer: CN=GTE CyberTrust Global Root 2589+ "0129bcd5b448ae8d2496d1c3e19723919088e152".getBytes() 2590+ )); 2591+ 2592+ // attempt to augment it with values taken from gservices 2593+ String pubkeyBlacklist = readBlacklist(path); 2594+ if (!pubkeyBlacklist.equals("")) { 2595+ for (String value : pubkeyBlacklist.split(",")) { 2596+ if (isPubkeyHash(value)) { 2597+ bl.add(Hex.decode(value)); 2598+ } else { 2599+ System.logW("Tried to blacklist invalid pubkey " + value); 2600+ } 2601+ } 2602+ } 2603+ 2604+ return bl; 2605+ } 2606+ 2607+ public boolean isPublicKeyBlackListed(PublicKey publicKey) { 2608+ byte[] encoded = publicKey.getEncoded(); 2609+ Digest digest = new OpenSSLDigest.SHA1(); 2610+ digest.update(encoded, 0, encoded.length); 2611+ byte[] out = new byte[digest.getDigestSize()]; 2612+ digest.doFinal(out, 0); 2613+ return pubkeyBlacklist.contains(out); 2614+ } 2615+ 2616+ public boolean isSerialNumberBlackListed(BigInteger serial) { 2617+ return serialBlacklist.contains(serial); 2618+ } 2619+ 2620+} 2621diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java bcprov-jdk16-146/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java 2622--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java 2011-02-23 20:08:56.000000000 +0000 2623+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java 2012-05-11 05:31:26.630725775 +0000 2624@@ -24,6 +24,7 @@ 2625 import java.security.spec.DSAPublicKeySpec; 2626 import java.text.ParseException; 2627 import java.util.ArrayList; 2628+import java.util.Arrays; 2629 import java.util.Collection; 2630 import java.util.Date; 2631 import java.util.Enumeration; 2632@@ -59,13 +60,17 @@ 2633 import org.bouncycastle.asn1.x509.PolicyInformation; 2634 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 2635 import org.bouncycastle.asn1.x509.X509Extensions; 2636-import org.bouncycastle.jce.X509LDAPCertStoreParameters; 2637+// BEGIN android-removed 2638+// import org.bouncycastle.jce.X509LDAPCertStoreParameters; 2639+// END android-removed 2640 import org.bouncycastle.jce.exception.ExtCertPathValidatorException; 2641 import org.bouncycastle.util.Selector; 2642 import org.bouncycastle.util.StoreException; 2643 import org.bouncycastle.x509.ExtendedPKIXBuilderParameters; 2644 import org.bouncycastle.x509.ExtendedPKIXParameters; 2645-import org.bouncycastle.x509.X509AttributeCertStoreSelector; 2646+// BEGIN android-removed 2647+// import org.bouncycastle.x509.X509AttributeCertStoreSelector; 2648+// END android-removed 2649 import org.bouncycastle.x509.X509AttributeCertificate; 2650 import org.bouncycastle.x509.X509CRLStoreSelector; 2651 import org.bouncycastle.x509.X509CertStoreSelector; 2652@@ -250,7 +255,9 @@ 2653 { 2654 // look for URI 2655 List list = (List) it.next(); 2656- if (list.get(0).equals(new Integer(GeneralName.uniformResourceIdentifier))) 2657+ // BEGIN android-changed 2658+ if (list.get(0).equals(Integer.valueOf(GeneralName.uniformResourceIdentifier))) 2659+ // END android-changed 2660 { 2661 // found 2662 String temp = (String) list.get(1); 2663@@ -660,38 +667,40 @@ 2664 { 2665 try 2666 { 2667- if (location.startsWith("ldap://")) 2668- { 2669- // ldap://directory.d-trust.net/CN=D-TRUST 2670- // Qualified CA 2003 1:PN,O=D-Trust GmbH,C=DE 2671- // skip "ldap://" 2672- location = location.substring(7); 2673- // after first / baseDN starts 2674- String base = null; 2675- String url = null; 2676- if (location.indexOf("/") != -1) 2677- { 2678- base = location.substring(location.indexOf("/")); 2679- // URL 2680- url = "ldap://" 2681- + location.substring(0, location.indexOf("/")); 2682- } 2683- else 2684- { 2685- url = "ldap://" + location; 2686- } 2687- // use all purpose parameters 2688- X509LDAPCertStoreParameters params = new X509LDAPCertStoreParameters.Builder( 2689- url, base).build(); 2690- pkixParams.addAdditionalStore(X509Store.getInstance( 2691- "CERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2692- pkixParams.addAdditionalStore(X509Store.getInstance( 2693- "CRL/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2694- pkixParams.addAdditionalStore(X509Store.getInstance( 2695- "ATTRIBUTECERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2696- pkixParams.addAdditionalStore(X509Store.getInstance( 2697- "CERTIFICATEPAIR/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2698- } 2699+ // BEGIN android-removed 2700+ // if (location.startsWith("ldap://")) 2701+ // { 2702+ // // ldap://directory.d-trust.net/CN=D-TRUST 2703+ // // Qualified CA 2003 1:PN,O=D-Trust GmbH,C=DE 2704+ // // skip "ldap://" 2705+ // location = location.substring(7); 2706+ // // after first / baseDN starts 2707+ // String base = null; 2708+ // String url = null; 2709+ // if (location.indexOf("/") != -1) 2710+ // { 2711+ // base = location.substring(location.indexOf("/")); 2712+ // // URL 2713+ // url = "ldap://" 2714+ // + location.substring(0, location.indexOf("/")); 2715+ // } 2716+ // else 2717+ // { 2718+ // url = "ldap://" + location; 2719+ // } 2720+ // // use all purpose parameters 2721+ // X509LDAPCertStoreParameters params = new X509LDAPCertStoreParameters.Builder( 2722+ // url, base).build(); 2723+ // pkixParams.addAdditionalStore(X509Store.getInstance( 2724+ // "CERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2725+ // pkixParams.addAdditionalStore(X509Store.getInstance( 2726+ // "CRL/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2727+ // pkixParams.addAdditionalStore(X509Store.getInstance( 2728+ // "ATTRIBUTECERTIFICATE/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2729+ // pkixParams.addAdditionalStore(X509Store.getInstance( 2730+ // "CERTIFICATEPAIR/LDAP", params, BouncyCastleProvider.PROVIDER_NAME)); 2731+ // } 2732+ // END android-removed 2733 } 2734 catch (Exception e) 2735 { 2736@@ -758,35 +767,37 @@ 2737 return certs; 2738 } 2739 2740- protected static Collection findCertificates(X509AttributeCertStoreSelector certSelect, 2741- List certStores) 2742- throws AnnotatedException 2743- { 2744- Set certs = new HashSet(); 2745- Iterator iter = certStores.iterator(); 2746- 2747- while (iter.hasNext()) 2748- { 2749- Object obj = iter.next(); 2750- 2751- if (obj instanceof X509Store) 2752- { 2753- X509Store certStore = (X509Store)obj; 2754- try 2755- { 2756- certs.addAll(certStore.getMatches(certSelect)); 2757- } 2758- catch (StoreException e) 2759- { 2760- throw 2761- 2762- new AnnotatedException( 2763- "Problem while picking certificates from X.509 store.", e); 2764- } 2765- } 2766- } 2767- return certs; 2768- } 2769+ // BEGIN android-removed 2770+ // protected static Collection findCertificates(X509AttributeCertStoreSelector certSelect, 2771+ // List certStores) 2772+ // throws AnnotatedException 2773+ // { 2774+ // Set certs = new HashSet(); 2775+ // Iterator iter = certStores.iterator(); 2776+ // 2777+ // while (iter.hasNext()) 2778+ // { 2779+ // Object obj = iter.next(); 2780+ // 2781+ // if (obj instanceof X509Store) 2782+ // { 2783+ // X509Store certStore = (X509Store)obj; 2784+ // try 2785+ // { 2786+ // certs.addAll(certStore.getMatches(certSelect)); 2787+ // } 2788+ // catch (StoreException e) 2789+ // { 2790+ // throw 2791+ // 2792+ // new AnnotatedException( 2793+ // "Problem while picking certificates from X.509 store.", e); 2794+ // } 2795+ // } 2796+ // } 2797+ // return certs; 2798+ // } 2799+ // END android-removed 2800 2801 protected static void addAdditionalStoresFromCRLDistributionPoint( 2802 CRLDistPoint crldp, ExtendedPKIXParameters pkixParams) 2803diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEBlockCipher.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEBlockCipher.java 2804--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEBlockCipher.java 2011-02-23 20:08:56.000000000 +0000 2805+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEBlockCipher.java 2012-05-11 05:31:26.630725775 +0000 2806@@ -17,8 +17,10 @@ 2807 import javax.crypto.ShortBufferException; 2808 import javax.crypto.spec.IvParameterSpec; 2809 import javax.crypto.spec.PBEParameterSpec; 2810-import javax.crypto.spec.RC2ParameterSpec; 2811-import javax.crypto.spec.RC5ParameterSpec; 2812+// BEGIN android-removed 2813+// import javax.crypto.spec.RC2ParameterSpec; 2814+// import javax.crypto.spec.RC5ParameterSpec; 2815+// END android-removed 2816 2817 import org.bouncycastle.crypto.BlockCipher; 2818 import org.bouncycastle.crypto.BufferedBlockCipher; 2819@@ -28,7 +30,9 @@ 2820 import org.bouncycastle.crypto.engines.AESFastEngine; 2821 import org.bouncycastle.crypto.engines.DESEngine; 2822 import org.bouncycastle.crypto.engines.DESedeEngine; 2823-import org.bouncycastle.crypto.engines.GOST28147Engine; 2824+// BEGIN android-removed 2825+// import org.bouncycastle.crypto.engines.GOST28147Engine; 2826+// END android-removed 2827 import org.bouncycastle.crypto.engines.RC2Engine; 2828 import org.bouncycastle.crypto.engines.TwofishEngine; 2829 import org.bouncycastle.crypto.modes.AEADBlockCipher; 2830@@ -36,12 +40,16 @@ 2831 import org.bouncycastle.crypto.modes.CCMBlockCipher; 2832 import org.bouncycastle.crypto.modes.CFBBlockCipher; 2833 import org.bouncycastle.crypto.modes.CTSBlockCipher; 2834-import org.bouncycastle.crypto.modes.EAXBlockCipher; 2835+// BEGIN android-removed 2836+// import org.bouncycastle.crypto.modes.EAXBlockCipher; 2837+// END android-removed 2838 import org.bouncycastle.crypto.modes.GCMBlockCipher; 2839 import org.bouncycastle.crypto.modes.GOFBBlockCipher; 2840 import org.bouncycastle.crypto.modes.OFBBlockCipher; 2841-import org.bouncycastle.crypto.modes.OpenPGPCFBBlockCipher; 2842-import org.bouncycastle.crypto.modes.PGPCFBBlockCipher; 2843+// BEGIN android-removed 2844+// import org.bouncycastle.crypto.modes.OpenPGPCFBBlockCipher; 2845+// import org.bouncycastle.crypto.modes.PGPCFBBlockCipher; 2846+// END android-removed 2847 import org.bouncycastle.crypto.modes.SICBlockCipher; 2848 import org.bouncycastle.crypto.paddings.BlockCipherPadding; 2849 import org.bouncycastle.crypto.paddings.ISO10126d2Padding; 2850@@ -53,10 +61,12 @@ 2851 import org.bouncycastle.crypto.params.KeyParameter; 2852 import org.bouncycastle.crypto.params.ParametersWithIV; 2853 import org.bouncycastle.crypto.params.ParametersWithRandom; 2854-import org.bouncycastle.crypto.params.ParametersWithSBox; 2855-import org.bouncycastle.crypto.params.RC2Parameters; 2856-import org.bouncycastle.crypto.params.RC5Parameters; 2857-import org.bouncycastle.jce.spec.GOST28147ParameterSpec; 2858+// BEGIN android-removed 2859+// import org.bouncycastle.crypto.params.ParametersWithSBox; 2860+// import org.bouncycastle.crypto.params.RC2Parameters; 2861+// import org.bouncycastle.crypto.params.RC5Parameters; 2862+// import org.bouncycastle.jce.spec.GOST28147ParameterSpec; 2863+// END android-removed 2864 import org.bouncycastle.util.Strings; 2865 2866 public class JCEBlockCipher extends WrapCipherSpi 2867@@ -67,11 +77,15 @@ 2868 // 2869 private Class[] availableSpecs = 2870 { 2871- RC2ParameterSpec.class, 2872- RC5ParameterSpec.class, 2873+ // BEGIN android-removed 2874+ // RC2ParameterSpec.class, 2875+ // RC5ParameterSpec.class, 2876+ // END android-removed 2877 IvParameterSpec.class, 2878 PBEParameterSpec.class, 2879- GOST28147ParameterSpec.class 2880+ // BEGIN android-removed 2881+ // GOST28147ParameterSpec.class 2882+ // END android-removed 2883 }; 2884 2885 private BlockCipher baseEngine; 2886@@ -226,20 +240,22 @@ 2887 new CFBBlockCipher(baseEngine, 8 * baseEngine.getBlockSize())); 2888 } 2889 } 2890- else if (modeName.startsWith("PGP")) 2891- { 2892- boolean inlineIV = modeName.equalsIgnoreCase("PGPCFBwithIV"); 2893- 2894- ivLength = baseEngine.getBlockSize(); 2895- cipher = new BufferedGenericBlockCipher( 2896- new PGPCFBBlockCipher(baseEngine, inlineIV)); 2897- } 2898- else if (modeName.equalsIgnoreCase("OpenPGPCFB")) 2899- { 2900- ivLength = 0; 2901- cipher = new BufferedGenericBlockCipher( 2902- new OpenPGPCFBBlockCipher(baseEngine)); 2903- } 2904+ // BEGIN android-removed 2905+ // else if (modeName.startsWith("PGP")) 2906+ // { 2907+ // boolean inlineIV = modeName.equalsIgnoreCase("PGPCFBwithIV"); 2908+ // 2909+ // ivLength = baseEngine.getBlockSize(); 2910+ // cipher = new BufferedGenericBlockCipher( 2911+ // new PGPCFBBlockCipher(baseEngine, inlineIV)); 2912+ // } 2913+ // else if (modeName.equalsIgnoreCase("OpenPGPCFB")) 2914+ // { 2915+ // ivLength = 0; 2916+ // cipher = new BufferedGenericBlockCipher( 2917+ // new OpenPGPCFBBlockCipher(baseEngine)); 2918+ // } 2919+ // END android-removed 2920 else if (modeName.startsWith("SIC")) 2921 { 2922 ivLength = baseEngine.getBlockSize(); 2923@@ -272,11 +288,13 @@ 2924 ivLength = baseEngine.getBlockSize(); 2925 cipher = new AEADGenericBlockCipher(new CCMBlockCipher(baseEngine)); 2926 } 2927- else if (modeName.startsWith("EAX")) 2928- { 2929- ivLength = baseEngine.getBlockSize(); 2930- cipher = new AEADGenericBlockCipher(new EAXBlockCipher(baseEngine)); 2931- } 2932+ // BEGIN android-removed 2933+ // else if (modeName.startsWith("EAX")) 2934+ // { 2935+ // ivLength = baseEngine.getBlockSize(); 2936+ // cipher = new AEADGenericBlockCipher(new EAXBlockCipher(baseEngine)); 2937+ // } 2938+ // END android-removed 2939 else if (modeName.startsWith("GCM")) 2940 { 2941 ivLength = baseEngine.getBlockSize(); 2942@@ -365,13 +383,15 @@ 2943 throw new InvalidKeyException("Key for algorithm " + key.getAlgorithm() + " not suitable for symmetric enryption."); 2944 } 2945 2946- // 2947- // for RC5-64 we must have some default parameters 2948- // 2949- if (params == null && baseEngine.getAlgorithmName().startsWith("RC5-64")) 2950- { 2951- throw new InvalidAlgorithmParameterException("RC5 requires an RC5ParametersSpec to be passed in."); 2952- } 2953+ // BEGIN android-removed 2954+ // // 2955+ // // for RC5-64 we must have some default parameters 2956+ // // 2957+ // if (params == null && baseEngine.getAlgorithmName().startsWith("RC5-64")) 2958+ // { 2959+ // throw new InvalidAlgorithmParameterException("RC5 requires an RC5ParametersSpec to be passed in."); 2960+ // } 2961+ // END android-removed 2962 2963 // 2964 // a note on iv's - if ivLength is zero the IV gets ignored (we don't use it). 2965@@ -437,63 +457,65 @@ 2966 param = new KeyParameter(key.getEncoded()); 2967 } 2968 } 2969- else if (params instanceof GOST28147ParameterSpec) 2970- { 2971- GOST28147ParameterSpec gost28147Param = (GOST28147ParameterSpec)params; 2972- 2973- param = new ParametersWithSBox( 2974- new KeyParameter(key.getEncoded()), ((GOST28147ParameterSpec)params).getSbox()); 2975- 2976- if (gost28147Param.getIV() != null && ivLength != 0) 2977- { 2978- param = new ParametersWithIV(param, gost28147Param.getIV()); 2979- ivParam = (ParametersWithIV)param; 2980- } 2981- } 2982- else if (params instanceof RC2ParameterSpec) 2983- { 2984- RC2ParameterSpec rc2Param = (RC2ParameterSpec)params; 2985- 2986- param = new RC2Parameters(key.getEncoded(), ((RC2ParameterSpec)params).getEffectiveKeyBits()); 2987- 2988- if (rc2Param.getIV() != null && ivLength != 0) 2989- { 2990- param = new ParametersWithIV(param, rc2Param.getIV()); 2991- ivParam = (ParametersWithIV)param; 2992- } 2993- } 2994- else if (params instanceof RC5ParameterSpec) 2995- { 2996- RC5ParameterSpec rc5Param = (RC5ParameterSpec)params; 2997- 2998- param = new RC5Parameters(key.getEncoded(), ((RC5ParameterSpec)params).getRounds()); 2999- if (baseEngine.getAlgorithmName().startsWith("RC5")) 3000- { 3001- if (baseEngine.getAlgorithmName().equals("RC5-32")) 3002- { 3003- if (rc5Param.getWordSize() != 32) 3004- { 3005- throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 32 not " + rc5Param.getWordSize() + "."); 3006- } 3007- } 3008- else if (baseEngine.getAlgorithmName().equals("RC5-64")) 3009- { 3010- if (rc5Param.getWordSize() != 64) 3011- { 3012- throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 64 not " + rc5Param.getWordSize() + "."); 3013- } 3014- } 3015- } 3016- else 3017- { 3018- throw new InvalidAlgorithmParameterException("RC5 parameters passed to a cipher that is not RC5."); 3019- } 3020- if ((rc5Param.getIV() != null) && (ivLength != 0)) 3021- { 3022- param = new ParametersWithIV(param, rc5Param.getIV()); 3023- ivParam = (ParametersWithIV)param; 3024- } 3025- } 3026+ // BEGIN android-removed 3027+ // else if (params instanceof GOST28147ParameterSpec) 3028+ // { 3029+ // GOST28147ParameterSpec gost28147Param = (GOST28147ParameterSpec)params; 3030+ // 3031+ // param = new ParametersWithSBox( 3032+ // new KeyParameter(key.getEncoded()), ((GOST28147ParameterSpec)params).getSbox()); 3033+ // 3034+ // if (gost28147Param.getIV() != null && ivLength != 0) 3035+ // { 3036+ // param = new ParametersWithIV(param, gost28147Param.getIV()); 3037+ // ivParam = (ParametersWithIV)param; 3038+ // } 3039+ // } 3040+ // else if (params instanceof RC2ParameterSpec) 3041+ // { 3042+ // RC2ParameterSpec rc2Param = (RC2ParameterSpec)params; 3043+ // 3044+ // param = new RC2Parameters(key.getEncoded(), ((RC2ParameterSpec)params).getEffectiveKeyBits()); 3045+ // 3046+ // if (rc2Param.getIV() != null && ivLength != 0) 3047+ // { 3048+ // param = new ParametersWithIV(param, rc2Param.getIV()); 3049+ // ivParam = (ParametersWithIV)param; 3050+ // } 3051+ // } 3052+ // else if (params instanceof RC5ParameterSpec) 3053+ // { 3054+ // RC5ParameterSpec rc5Param = (RC5ParameterSpec)params; 3055+ // 3056+ // param = new RC5Parameters(key.getEncoded(), ((RC5ParameterSpec)params).getRounds()); 3057+ // if (baseEngine.getAlgorithmName().startsWith("RC5")) 3058+ // { 3059+ // if (baseEngine.getAlgorithmName().equals("RC5-32")) 3060+ // { 3061+ // if (rc5Param.getWordSize() != 32) 3062+ // { 3063+ // throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 32 not " + rc5Param.getWordSize() + "."); 3064+ // } 3065+ // } 3066+ // else if (baseEngine.getAlgorithmName().equals("RC5-64")) 3067+ // { 3068+ // if (rc5Param.getWordSize() != 64) 3069+ // { 3070+ // throw new InvalidAlgorithmParameterException("RC5 already set up for a word size of 64 not " + rc5Param.getWordSize() + "."); 3071+ // } 3072+ // } 3073+ // } 3074+ // else 3075+ // { 3076+ // throw new InvalidAlgorithmParameterException("RC5 parameters passed to a cipher that is not RC5."); 3077+ // } 3078+ // if ((rc5Param.getIV() != null) && (ivLength != 0)) 3079+ // { 3080+ // param = new ParametersWithIV(param, rc5Param.getIV()); 3081+ // ivParam = (ParametersWithIV)param; 3082+ // } 3083+ // } 3084+ // END android-removed 3085 else 3086 { 3087 throw new InvalidAlgorithmParameterException("unknown parameter type."); 3088@@ -697,10 +719,21 @@ 3089 int inputLen, 3090 byte[] output, 3091 int outputOffset) 3092- throws IllegalBlockSizeException, BadPaddingException 3093+ throws IllegalBlockSizeException, BadPaddingException, ShortBufferException 3094 { 3095+ // BEGIN android-note 3096+ // added ShortBufferException to the throws statement 3097+ // END android-note 3098 int len = 0; 3099 3100+ // BEGIN android-added 3101+ int outputLen = cipher.getOutputSize(inputLen); 3102+ 3103+ if (outputLen + outputOffset > output.length) { 3104+ throw new ShortBufferException("need at least " + outputLen + " bytes"); 3105+ } 3106+ // BEGIN android-added 3107+ 3108 if (inputLen != 0) 3109 { 3110 len = cipher.processBytes(input, inputOffset, inputLen, output, outputOffset); 3111@@ -742,62 +775,64 @@ 3112 } 3113 } 3114 3115- /** 3116- * DESCBC 3117- */ 3118- static public class DESCBC 3119- extends JCEBlockCipher 3120- { 3121- public DESCBC() 3122- { 3123- super(new CBCBlockCipher(new DESEngine()), 64); 3124- } 3125- } 3126- 3127- /** 3128- * GOST28147 3129- */ 3130- static public class GOST28147 3131- extends JCEBlockCipher 3132- { 3133- public GOST28147() 3134- { 3135- super(new GOST28147Engine()); 3136- } 3137- } 3138- 3139- static public class GOST28147cbc 3140- extends JCEBlockCipher 3141- { 3142- public GOST28147cbc() 3143- { 3144- super(new CBCBlockCipher(new GOST28147Engine()), 64); 3145- } 3146- } 3147- 3148- /** 3149- * RC2 3150- */ 3151- static public class RC2 3152- extends JCEBlockCipher 3153- { 3154- public RC2() 3155- { 3156- super(new RC2Engine()); 3157- } 3158- } 3159- 3160- /** 3161- * RC2CBC 3162- */ 3163- static public class RC2CBC 3164- extends JCEBlockCipher 3165- { 3166- public RC2CBC() 3167- { 3168- super(new CBCBlockCipher(new RC2Engine()), 64); 3169- } 3170- } 3171+ // BEGIN android-removed 3172+ // /** 3173+ // * DESCBC 3174+ // */ 3175+ // static public class DESCBC 3176+ // extends JCEBlockCipher 3177+ // { 3178+ // public DESCBC() 3179+ // { 3180+ // super(new CBCBlockCipher(new DESEngine()), 64); 3181+ // } 3182+ // } 3183+ // 3184+ // /** 3185+ // * GOST28147 3186+ // */ 3187+ // static public class GOST28147 3188+ // extends JCEBlockCipher 3189+ // { 3190+ // public GOST28147() 3191+ // { 3192+ // super(new GOST28147Engine()); 3193+ // } 3194+ // } 3195+ // 3196+ // static public class GOST28147cbc 3197+ // extends JCEBlockCipher 3198+ // { 3199+ // public GOST28147cbc() 3200+ // { 3201+ // super(new CBCBlockCipher(new GOST28147Engine()), 64); 3202+ // } 3203+ // } 3204+ // 3205+ // /** 3206+ // * RC2 3207+ // */ 3208+ // static public class RC2 3209+ // extends JCEBlockCipher 3210+ // { 3211+ // public RC2() 3212+ // { 3213+ // super(new RC2Engine()); 3214+ // } 3215+ // } 3216+ // 3217+ // /** 3218+ // * RC2CBC 3219+ // */ 3220+ // static public class RC2CBC 3221+ // extends JCEBlockCipher 3222+ // { 3223+ // public RC2CBC() 3224+ // { 3225+ // super(new CBCBlockCipher(new RC2Engine()), 64); 3226+ // } 3227+ // } 3228+ // END android-removed 3229 3230 /** 3231 * PBEWithMD5AndDES 3232@@ -822,7 +857,7 @@ 3233 super(new CBCBlockCipher(new RC2Engine())); 3234 } 3235 } 3236- 3237+ 3238 /** 3239 * PBEWithSHA1AndDES 3240 */ 3241@@ -870,7 +905,7 @@ 3242 super(new CBCBlockCipher(new DESedeEngine())); 3243 } 3244 } 3245- 3246+ 3247 /** 3248 * PBEWithSHAAnd128BitRC2-CBC 3249 */ 3250@@ -894,7 +929,7 @@ 3251 super(new CBCBlockCipher(new RC2Engine())); 3252 } 3253 } 3254- 3255+ 3256 /** 3257 * PBEWithSHAAndTwofish-CBC 3258 */ 3259@@ -906,7 +941,7 @@ 3260 super(new CBCBlockCipher(new TwofishEngine())); 3261 } 3262 } 3263- 3264+ 3265 /** 3266 * PBEWithAES-CBC 3267 */ 3268diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEDHKeyAgreement.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEDHKeyAgreement.java 3269--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEDHKeyAgreement.java 2011-02-23 20:08:56.000000000 +0000 3270+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEDHKeyAgreement.java 2012-05-11 05:31:26.630725775 +0000 3271@@ -36,10 +36,12 @@ 3272 3273 static 3274 { 3275- Integer i64 = new Integer(64); 3276- Integer i192 = new Integer(192); 3277- Integer i128 = new Integer(128); 3278- Integer i256 = new Integer(256); 3279+ // BEGIN android-changed 3280+ Integer i64 = Integer.valueOf(64); 3281+ Integer i192 = Integer.valueOf(192); 3282+ Integer i128 = Integer.valueOf(128); 3283+ Integer i256 = Integer.valueOf(256); 3284+ // END android-changed 3285 3286 algorithms.put("DES", i64); 3287 algorithms.put("DESEDE", i192); 3288diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEDigestUtil.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEDigestUtil.java 3289--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEDigestUtil.java 2011-02-23 20:08:56.000000000 +0000 3290+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEDigestUtil.java 2012-05-11 05:31:26.630725775 +0000 3291@@ -12,7 +12,9 @@ 3292 import org.bouncycastle.crypto.Digest; 3293 import org.bouncycastle.crypto.digests.MD5Digest; 3294 import org.bouncycastle.crypto.digests.SHA1Digest; 3295-import org.bouncycastle.crypto.digests.SHA224Digest; 3296+// BEGIN android-removed 3297+// import org.bouncycastle.crypto.digests.SHA224Digest; 3298+// END android-removed 3299 import org.bouncycastle.crypto.digests.SHA256Digest; 3300 import org.bouncycastle.crypto.digests.SHA384Digest; 3301 import org.bouncycastle.crypto.digests.SHA512Digest; 3302@@ -22,7 +24,9 @@ 3303 { 3304 private static Set md5 = new HashSet(); 3305 private static Set sha1 = new HashSet(); 3306- private static Set sha224 = new HashSet(); 3307+ // BEGIN android-removed 3308+ // private static Set sha224 = new HashSet(); 3309+ // END android-removed 3310 private static Set sha256 = new HashSet(); 3311 private static Set sha384 = new HashSet(); 3312 private static Set sha512 = new HashSet(); 3313@@ -38,9 +42,11 @@ 3314 sha1.add("SHA-1"); 3315 sha1.add(OIWObjectIdentifiers.idSHA1.getId()); 3316 3317- sha224.add("SHA224"); 3318- sha224.add("SHA-224"); 3319- sha224.add(NISTObjectIdentifiers.id_sha224.getId()); 3320+ // BEGIN android-removed 3321+ // sha224.add("SHA224"); 3322+ // sha224.add("SHA-224"); 3323+ // sha224.add(NISTObjectIdentifiers.id_sha224.getId()); 3324+ // END android-removed 3325 3326 sha256.add("SHA256"); 3327 sha256.add("SHA-256"); 3328@@ -61,9 +67,11 @@ 3329 oids.put("SHA-1", OIWObjectIdentifiers.idSHA1); 3330 oids.put(OIWObjectIdentifiers.idSHA1.getId(), OIWObjectIdentifiers.idSHA1); 3331 3332- oids.put("SHA224", NISTObjectIdentifiers.id_sha224); 3333- oids.put("SHA-224", NISTObjectIdentifiers.id_sha224); 3334- oids.put(NISTObjectIdentifiers.id_sha224.getId(), NISTObjectIdentifiers.id_sha224); 3335+ // BEGIN android-removed 3336+ // oids.put("SHA224", NISTObjectIdentifiers.id_sha224); 3337+ // oids.put("SHA-224", NISTObjectIdentifiers.id_sha224); 3338+ // oids.put(NISTObjectIdentifiers.id_sha224.getId(), NISTObjectIdentifiers.id_sha224); 3339+ // END android-removed 3340 3341 oids.put("SHA256", NISTObjectIdentifiers.id_sha256); 3342 oids.put("SHA-256", NISTObjectIdentifiers.id_sha256); 3343@@ -91,10 +99,12 @@ 3344 { 3345 return new MD5Digest(); 3346 } 3347- if (sha224.contains(digestName)) 3348- { 3349- return new SHA224Digest(); 3350- } 3351+ // BEGIN android-removed 3352+ // if (sha224.contains(digestName)) 3353+ // { 3354+ // return new SHA224Digest(); 3355+ // } 3356+ // END android-removed 3357 if (sha256.contains(digestName)) 3358 { 3359 return new SHA256Digest(); 3360@@ -116,7 +126,9 @@ 3361 String digest2) 3362 { 3363 return (sha1.contains(digest1) && sha1.contains(digest2)) 3364- || (sha224.contains(digest1) && sha224.contains(digest2)) 3365+ // BEGIN android-removed 3366+ // || (sha224.contains(digest1) && sha224.contains(digest2)) 3367+ // END android-removed 3368 || (sha256.contains(digest1) && sha256.contains(digest2)) 3369 || (sha384.contains(digest1) && sha384.contains(digest2)) 3370 || (sha512.contains(digest1) && sha512.contains(digest2)) 3371diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEECPrivateKey.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEECPrivateKey.java 3372--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEECPrivateKey.java 2011-02-23 20:08:56.000000000 +0000 3373+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEECPrivateKey.java 2012-05-11 05:31:26.630725775 +0000 3374@@ -20,7 +20,9 @@ 3375 import org.bouncycastle.asn1.DERObject; 3376 import org.bouncycastle.asn1.DERObjectIdentifier; 3377 import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 3378-import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 3379+// BEGIN android-removed 3380+// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 3381+// END android-removed 3382 import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 3383 import org.bouncycastle.asn1.sec.ECPrivateKeyStructure; 3384 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 3385@@ -199,21 +201,23 @@ 3386 DERObjectIdentifier oid = (DERObjectIdentifier)params.getParameters(); 3387 X9ECParameters ecP = ECUtil.getNamedCurveByOid(oid); 3388 3389- if (ecP == null) // GOST Curve 3390- { 3391- ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); 3392- EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); 3393- 3394- ecSpec = new ECNamedCurveSpec( 3395- ECGOST3410NamedCurves.getName(oid), 3396- ellipticCurve, 3397- new ECPoint( 3398- gParam.getG().getX().toBigInteger(), 3399- gParam.getG().getY().toBigInteger()), 3400- gParam.getN(), 3401- gParam.getH()); 3402- } 3403- else 3404+ // BEGIN android-removed 3405+ // if (ecP == null) // GOST Curve 3406+ // { 3407+ // ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); 3408+ // EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); 3409+ // 3410+ // ecSpec = new ECNamedCurveSpec( 3411+ // ECGOST3410NamedCurves.getName(oid), 3412+ // ellipticCurve, 3413+ // new ECPoint( 3414+ // gParam.getG().getX().toBigInteger(), 3415+ // gParam.getG().getY().toBigInteger()), 3416+ // gParam.getN(), 3417+ // gParam.getH()); 3418+ // } 3419+ // else 3420+ // END android-removed 3421 { 3422 EllipticCurve ellipticCurve = EC5Util.convertCurve(ecP.getCurve(), ecP.getSeed()); 3423 3424@@ -324,11 +328,13 @@ 3425 keyStructure = new ECPrivateKeyStructure(this.getS(), params); 3426 } 3427 3428- if (algorithm.equals("ECGOST3410")) 3429- { 3430- info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.getDERObject()), keyStructure.getDERObject()); 3431- } 3432- else 3433+ // BEGIN android-removed 3434+ // if (algorithm.equals("ECGOST3410")) 3435+ // { 3436+ // info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.getDERObject()), keyStructure.getDERObject()); 3437+ // } 3438+ // else 3439+ // END android-removed 3440 { 3441 3442 info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.getDERObject()), keyStructure.getDERObject()); 3443diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEECPublicKey.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEECPublicKey.java 3444--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEECPublicKey.java 2011-02-23 20:08:56.000000000 +0000 3445+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEECPublicKey.java 2012-05-11 05:31:26.630725775 +0000 3446@@ -20,8 +20,10 @@ 3447 import org.bouncycastle.asn1.DERObjectIdentifier; 3448 import org.bouncycastle.asn1.DEROctetString; 3449 import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 3450-import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 3451-import org.bouncycastle.asn1.cryptopro.GOST3410PublicKeyAlgParameters; 3452+// BEGIN android-removed 3453+// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 3454+// import org.bouncycastle.asn1.cryptopro.GOST3410PublicKeyAlgParameters; 3455+// END android-removed 3456 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 3457 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 3458 import org.bouncycastle.asn1.x9.X962Parameters; 3459@@ -31,11 +33,15 @@ 3460 import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 3461 import org.bouncycastle.crypto.params.ECDomainParameters; 3462 import org.bouncycastle.crypto.params.ECPublicKeyParameters; 3463-import org.bouncycastle.jce.ECGOST3410NamedCurveTable; 3464+// BEGIN android-removed 3465+// import org.bouncycastle.jce.ECGOST3410NamedCurveTable; 3466+// END android-removed 3467 import org.bouncycastle.jce.interfaces.ECPointEncoder; 3468 import org.bouncycastle.jce.provider.asymmetric.ec.EC5Util; 3469 import org.bouncycastle.jce.provider.asymmetric.ec.ECUtil; 3470-import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec; 3471+// BEGIN android-removed 3472+// import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec; 3473+// END android-removed 3474 import org.bouncycastle.jce.spec.ECNamedCurveSpec; 3475 import org.bouncycastle.math.ec.ECCurve; 3476 3477@@ -46,7 +52,9 @@ 3478 private org.bouncycastle.math.ec.ECPoint q; 3479 private ECParameterSpec ecSpec; 3480 private boolean withCompression; 3481- private GOST3410PublicKeyAlgParameters gostParams; 3482+ // BEGIN android-removed 3483+ // private GOST3410PublicKeyAlgParameters gostParams; 3484+ // END android-removed 3485 3486 public JCEECPublicKey( 3487 String algorithm, 3488@@ -56,7 +64,9 @@ 3489 this.q = key.q; 3490 this.ecSpec = key.ecSpec; 3491 this.withCompression = key.withCompression; 3492- this.gostParams = key.gostParams; 3493+ // BEGIN android-removed 3494+ // this.gostParams = key.gostParams; 3495+ // END android-removed 3496 } 3497 3498 public JCEECPublicKey( 3499@@ -179,54 +189,56 @@ 3500 3501 private void populateFromPubKeyInfo(SubjectPublicKeyInfo info) 3502 { 3503- if (info.getAlgorithmId().getObjectId().equals(CryptoProObjectIdentifiers.gostR3410_2001)) 3504- { 3505- DERBitString bits = info.getPublicKeyData(); 3506- ASN1OctetString key; 3507- this.algorithm = "ECGOST3410"; 3508- 3509- try 3510- { 3511- key = (ASN1OctetString) ASN1Object.fromByteArray(bits.getBytes()); 3512- } 3513- catch (IOException ex) 3514- { 3515- throw new IllegalArgumentException("error recovering public key"); 3516- } 3517- 3518- byte[] keyEnc = key.getOctets(); 3519- byte[] x = new byte[32]; 3520- byte[] y = new byte[32]; 3521- 3522- for (int i = 0; i != x.length; i++) 3523- { 3524- x[i] = keyEnc[32 - 1 - i]; 3525- } 3526- 3527- for (int i = 0; i != y.length; i++) 3528- { 3529- y[i] = keyEnc[64 - 1 - i]; 3530- } 3531- 3532- gostParams = new GOST3410PublicKeyAlgParameters((ASN1Sequence)info.getAlgorithmId().getParameters()); 3533- 3534- ECNamedCurveParameterSpec spec = ECGOST3410NamedCurveTable.getParameterSpec(ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet())); 3535- 3536- ECCurve curve = spec.getCurve(); 3537- EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getSeed()); 3538- 3539- this.q = curve.createPoint(new BigInteger(1, x), new BigInteger(1, y), false); 3540- 3541- ecSpec = new ECNamedCurveSpec( 3542- ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet()), 3543- ellipticCurve, 3544- new ECPoint( 3545- spec.getG().getX().toBigInteger(), 3546- spec.getG().getY().toBigInteger()), 3547- spec.getN(), spec.getH()); 3548- 3549- } 3550- else 3551+ // BEGIN android-removed 3552+ // if (info.getAlgorithmId().getObjectId().equals(CryptoProObjectIdentifiers.gostR3410_2001)) 3553+ // { 3554+ // DERBitString bits = info.getPublicKeyData(); 3555+ // ASN1OctetString key; 3556+ // this.algorithm = "ECGOST3410"; 3557+ // 3558+ // try 3559+ // { 3560+ // key = (ASN1OctetString) ASN1Object.fromByteArray(bits.getBytes()); 3561+ // } 3562+ // catch (IOException ex) 3563+ // { 3564+ // throw new IllegalArgumentException("error recovering public key"); 3565+ // } 3566+ // 3567+ // byte[] keyEnc = key.getOctets(); 3568+ // byte[] x = new byte[32]; 3569+ // byte[] y = new byte[32]; 3570+ // 3571+ // for (int i = 0; i != x.length; i++) 3572+ // { 3573+ // x[i] = keyEnc[32 - 1 - i]; 3574+ // } 3575+ // 3576+ // for (int i = 0; i != y.length; i++) 3577+ // { 3578+ // y[i] = keyEnc[64 - 1 - i]; 3579+ // } 3580+ // 3581+ // gostParams = new GOST3410PublicKeyAlgParameters((ASN1Sequence)info.getAlgorithmId().getParameters()); 3582+ // 3583+ // ECNamedCurveParameterSpec spec = ECGOST3410NamedCurveTable.getParameterSpec(ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet())); 3584+ // 3585+ // ECCurve curve = spec.getCurve(); 3586+ // EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getSeed()); 3587+ // 3588+ // this.q = curve.createPoint(new BigInteger(1, x), new BigInteger(1, y), false); 3589+ // 3590+ // ecSpec = new ECNamedCurveSpec( 3591+ // ECGOST3410NamedCurves.getName(gostParams.getPublicKeyParamSet()), 3592+ // ellipticCurve, 3593+ // new ECPoint( 3594+ // spec.getG().getX().toBigInteger(), 3595+ // spec.getG().getY().toBigInteger()), 3596+ // spec.getN(), spec.getH()); 3597+ // 3598+ // } 3599+ // else 3600+ // END android-removed 3601 { 3602 X962Parameters params = new X962Parameters((DERObject)info.getAlgorithmId().getParameters()); 3603 ECCurve curve; 3604@@ -315,45 +327,47 @@ 3605 ASN1Encodable params; 3606 SubjectPublicKeyInfo info; 3607 3608- if (algorithm.equals("ECGOST3410")) 3609- { 3610- if (gostParams != null) 3611- { 3612- params = gostParams; 3613- } 3614- else 3615- { 3616- if (ecSpec instanceof ECNamedCurveSpec) 3617- { 3618- params = new GOST3410PublicKeyAlgParameters( 3619- ECGOST3410NamedCurves.getOID(((ECNamedCurveSpec)ecSpec).getName()), 3620- CryptoProObjectIdentifiers.gostR3411_94_CryptoProParamSet); 3621- } 3622- else 3623- { // strictly speaking this may not be applicable... 3624- ECCurve curve = EC5Util.convertCurve(ecSpec.getCurve()); 3625- 3626- X9ECParameters ecP = new X9ECParameters( 3627- curve, 3628- EC5Util.convertPoint(curve, ecSpec.getGenerator(), withCompression), 3629- ecSpec.getOrder(), 3630- BigInteger.valueOf(ecSpec.getCofactor()), 3631- ecSpec.getCurve().getSeed()); 3632- 3633- params = new X962Parameters(ecP); 3634- } 3635- } 3636- 3637- BigInteger bX = this.q.getX().toBigInteger(); 3638- BigInteger bY = this.q.getY().toBigInteger(); 3639- byte[] encKey = new byte[64]; 3640- 3641- extractBytes(encKey, 0, bX); 3642- extractBytes(encKey, 32, bY); 3643- 3644- info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.getDERObject()), new DEROctetString(encKey)); 3645- } 3646- else 3647+ // BEGIN android-removed 3648+ // if (algorithm.equals("ECGOST3410")) 3649+ // { 3650+ // if (gostParams != null) 3651+ // { 3652+ // params = gostParams; 3653+ // } 3654+ // else 3655+ // { 3656+ // if (ecSpec instanceof ECNamedCurveSpec) 3657+ // { 3658+ // params = new GOST3410PublicKeyAlgParameters( 3659+ // ECGOST3410NamedCurves.getOID(((ECNamedCurveSpec)ecSpec).getName()), 3660+ // CryptoProObjectIdentifiers.gostR3411_94_CryptoProParamSet); 3661+ // } 3662+ // else 3663+ // { // strictly speaking this may not be applicable... 3664+ // ECCurve curve = EC5Util.convertCurve(ecSpec.getCurve()); 3665+ // 3666+ // X9ECParameters ecP = new X9ECParameters( 3667+ // curve, 3668+ // EC5Util.convertPoint(curve, ecSpec.getGenerator(), withCompression), 3669+ // ecSpec.getOrder(), 3670+ // BigInteger.valueOf(ecSpec.getCofactor()), 3671+ // ecSpec.getCurve().getSeed()); 3672+ // 3673+ // params = new X962Parameters(ecP); 3674+ // } 3675+ // } 3676+ // 3677+ // BigInteger bX = this.q.getX().toBigInteger(); 3678+ // BigInteger bY = this.q.getY().toBigInteger(); 3679+ // byte[] encKey = new byte[64]; 3680+ // 3681+ // extractBytes(encKey, 0, bX); 3682+ // extractBytes(encKey, 32, bY); 3683+ // 3684+ // info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.getDERObject()), new DEROctetString(encKey)); 3685+ // } 3686+ // else 3687+ // END android-removed 3688 { 3689 if (ecSpec instanceof ECNamedCurveSpec) 3690 { 3691diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEKeyGenerator.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEKeyGenerator.java 3692--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEKeyGenerator.java 2011-02-23 20:08:56.000000000 +0000 3693+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEKeyGenerator.java 2012-05-11 05:31:26.630725775 +0000 3694@@ -57,6 +57,11 @@ 3695 { 3696 try 3697 { 3698+ // BEGIN android-added 3699+ if (random == null) { 3700+ random = new SecureRandom(); 3701+ } 3702+ // END android-added 3703 engine.init(new KeyGenerationParameters(random, keySize)); 3704 uninitialised = false; 3705 } 3706@@ -93,56 +98,60 @@ 3707 } 3708 } 3709 3710- /** 3711- * RC2 3712- */ 3713- public static class RC2 3714- extends JCEKeyGenerator 3715- { 3716- public RC2() 3717- { 3718- super("RC2", 128, new CipherKeyGenerator()); 3719- } 3720- } 3721- 3722- /** 3723- * GOST28147 3724- */ 3725- public static class GOST28147 3726- extends JCEKeyGenerator 3727- { 3728- public GOST28147() 3729- { 3730- super("GOST28147", 256, new CipherKeyGenerator()); 3731- } 3732- } 3733+ // BEGIN android-removed 3734+ // /** 3735+ // * RC2 3736+ // */ 3737+ // public static class RC2 3738+ // extends JCEKeyGenerator 3739+ // { 3740+ // public RC2() 3741+ // { 3742+ // super("RC2", 128, new CipherKeyGenerator()); 3743+ // } 3744+ // } 3745+ // 3746+ // /** 3747+ // * GOST28147 3748+ // */ 3749+ // public static class GOST28147 3750+ // extends JCEKeyGenerator 3751+ // { 3752+ // public GOST28147() 3753+ // { 3754+ // super("GOST28147", 256, new CipherKeyGenerator()); 3755+ // } 3756+ // } 3757+ // END android-removed 3758 3759 // HMAC Related secret keys.. 3760 3761- /** 3762- * MD2HMAC 3763- */ 3764- public static class MD2HMAC 3765- extends JCEKeyGenerator 3766- { 3767- public MD2HMAC() 3768- { 3769- super("HMACMD2", 128, new CipherKeyGenerator()); 3770- } 3771- } 3772- 3773- 3774- /** 3775- * MD4HMAC 3776- */ 3777- public static class MD4HMAC 3778- extends JCEKeyGenerator 3779- { 3780- public MD4HMAC() 3781- { 3782- super("HMACMD4", 128, new CipherKeyGenerator()); 3783- } 3784- } 3785+ // BEGIN android-removed 3786+ // /** 3787+ // * MD2HMAC 3788+ // */ 3789+ // public static class MD2HMAC 3790+ // extends JCEKeyGenerator 3791+ // { 3792+ // public MD2HMAC() 3793+ // { 3794+ // super("HMACMD2", 128, new CipherKeyGenerator()); 3795+ // } 3796+ // } 3797+ // 3798+ // 3799+ // /** 3800+ // * MD4HMAC 3801+ // */ 3802+ // public static class MD4HMAC 3803+ // extends JCEKeyGenerator 3804+ // { 3805+ // public MD4HMAC() 3806+ // { 3807+ // super("HMACMD4", 128, new CipherKeyGenerator()); 3808+ // } 3809+ // } 3810+ // END android-removed 3811 3812 /** 3813 * MD5HMAC 3814@@ -157,29 +166,29 @@ 3815 } 3816 3817 3818- /** 3819- * RIPE128HMAC 3820- */ 3821- public static class RIPEMD128HMAC 3822- extends JCEKeyGenerator 3823- { 3824- public RIPEMD128HMAC() 3825- { 3826- super("HMACRIPEMD128", 128, new CipherKeyGenerator()); 3827- } 3828- } 3829- 3830- /** 3831- * RIPE160HMAC 3832- */ 3833- public static class RIPEMD160HMAC 3834- extends JCEKeyGenerator 3835- { 3836- public RIPEMD160HMAC() 3837- { 3838- super("HMACRIPEMD160", 160, new CipherKeyGenerator()); 3839- } 3840- } 3841+ // /** 3842+ // * RIPE128HMAC 3843+ // */ 3844+ // public static class RIPEMD128HMAC 3845+ // extends JCEKeyGenerator 3846+ // { 3847+ // public RIPEMD128HMAC() 3848+ // { 3849+ // super("HMACRIPEMD128", 128, new CipherKeyGenerator()); 3850+ // } 3851+ // } 3852+ 3853+ // /** 3854+ // * RIPE160HMAC 3855+ // */ 3856+ // public static class RIPEMD160HMAC 3857+ // extends JCEKeyGenerator 3858+ // { 3859+ // public RIPEMD160HMAC() 3860+ // { 3861+ // super("HMACRIPEMD160", 160, new CipherKeyGenerator()); 3862+ // } 3863+ // } 3864 3865 3866 /** 3867@@ -194,17 +203,19 @@ 3868 } 3869 } 3870 3871- /** 3872- * HMACSHA224 3873- */ 3874- public static class HMACSHA224 3875- extends JCEKeyGenerator 3876- { 3877- public HMACSHA224() 3878- { 3879- super("HMACSHA224", 224, new CipherKeyGenerator()); 3880- } 3881- } 3882+ // BEGIN android-removed 3883+ // /** 3884+ // * HMACSHA224 3885+ // */ 3886+ // public static class HMACSHA224 3887+ // extends JCEKeyGenerator 3888+ // { 3889+ // public HMACSHA224() 3890+ // { 3891+ // super("HMACSHA224", 224, new CipherKeyGenerator()); 3892+ // } 3893+ // } 3894+ // END android-removed 3895 3896 /** 3897 * HMACSHA256 3898@@ -242,15 +253,17 @@ 3899 } 3900 } 3901 3902- /** 3903- * HMACTIGER 3904- */ 3905- public static class HMACTIGER 3906- extends JCEKeyGenerator 3907- { 3908- public HMACTIGER() 3909- { 3910- super("HMACTIGER", 192, new CipherKeyGenerator()); 3911- } 3912- } 3913+ // BEGIN android-removed 3914+ // /** 3915+ // * HMACTIGER 3916+ // */ 3917+ // public static class HMACTIGER 3918+ // extends JCEKeyGenerator 3919+ // { 3920+ // public HMACTIGER() 3921+ // { 3922+ // super("HMACTIGER", 192, new CipherKeyGenerator()); 3923+ // } 3924+ // } 3925+ // END android-removed 3926 } 3927diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEMac.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEMac.java 3928--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEMac.java 2011-02-23 20:08:56.000000000 +0000 3929+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEMac.java 2012-05-11 05:31:26.630725775 +0000 3930@@ -11,25 +11,39 @@ 3931 3932 import org.bouncycastle.crypto.CipherParameters; 3933 import org.bouncycastle.crypto.Mac; 3934-import org.bouncycastle.crypto.digests.MD2Digest; 3935-import org.bouncycastle.crypto.digests.MD4Digest; 3936+// BEGIN android-removed 3937+// import org.bouncycastle.crypto.digests.MD2Digest; 3938+// import org.bouncycastle.crypto.digests.MD4Digest; 3939+// END android-removed 3940 import org.bouncycastle.crypto.digests.MD5Digest; 3941-import org.bouncycastle.crypto.digests.RIPEMD128Digest; 3942-import org.bouncycastle.crypto.digests.RIPEMD160Digest; 3943+// BEGIN android-removed 3944+// import org.bouncycastle.crypto.digests.RIPEMD128Digest; 3945+// import org.bouncycastle.crypto.digests.RIPEMD160Digest; 3946+// END android-removed 3947 import org.bouncycastle.crypto.digests.SHA1Digest; 3948-import org.bouncycastle.crypto.digests.SHA224Digest; 3949+// BEGIN android-removed 3950+// import org.bouncycastle.crypto.digests.SHA224Digest; 3951+// END android-removed 3952 import org.bouncycastle.crypto.digests.SHA256Digest; 3953 import org.bouncycastle.crypto.digests.SHA384Digest; 3954 import org.bouncycastle.crypto.digests.SHA512Digest; 3955-import org.bouncycastle.crypto.digests.TigerDigest; 3956+// BEGIN android-removed 3957+// import org.bouncycastle.crypto.digests.TigerDigest; 3958+// END android-removed 3959 import org.bouncycastle.crypto.engines.DESEngine; 3960-import org.bouncycastle.crypto.engines.RC2Engine; 3961+// BEGIN android-removed 3962+// import org.bouncycastle.crypto.engines.RC2Engine; 3963+// END android-removed 3964 import org.bouncycastle.crypto.macs.CBCBlockCipherMac; 3965-import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 3966-import org.bouncycastle.crypto.macs.GOST28147Mac; 3967+// BEGIN android-removed 3968+// import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 3969+// import org.bouncycastle.crypto.macs.GOST28147Mac; 3970+// END android-removed 3971 import org.bouncycastle.crypto.macs.HMac; 3972-import org.bouncycastle.crypto.macs.ISO9797Alg3Mac; 3973-import org.bouncycastle.crypto.macs.OldHMac; 3974+// BEGIN android-removed 3975+// import org.bouncycastle.crypto.macs.ISO9797Alg3Mac; 3976+// import org.bouncycastle.crypto.macs.OldHMac; 3977+// END android-removed 3978 import org.bouncycastle.crypto.paddings.ISO7816d4Padding; 3979 import org.bouncycastle.crypto.params.KeyParameter; 3980 import org.bouncycastle.crypto.params.ParametersWithIV; 3981@@ -143,115 +157,117 @@ 3982 * the classes that extend directly off us. 3983 */ 3984 3985- /** 3986- * DES 3987- */ 3988- public static class DES 3989- extends JCEMac 3990- { 3991- public DES() 3992- { 3993- super(new CBCBlockCipherMac(new DESEngine())); 3994- } 3995- } 3996- 3997- /** 3998- * RC2 3999- */ 4000- public static class RC2 4001- extends JCEMac 4002- { 4003- public RC2() 4004- { 4005- super(new CBCBlockCipherMac(new RC2Engine())); 4006- } 4007- } 4008- 4009- /** 4010- * GOST28147 4011- */ 4012- public static class GOST28147 4013- extends JCEMac 4014- { 4015- public GOST28147() 4016- { 4017- super(new GOST28147Mac()); 4018- } 4019- } 4020- 4021- 4022- 4023- /** 4024- * DES 4025- */ 4026- public static class DESCFB8 4027- extends JCEMac 4028- { 4029- public DESCFB8() 4030- { 4031- super(new CFBBlockCipherMac(new DESEngine())); 4032- } 4033- } 4034- 4035- /** 4036- * RC2CFB8 4037- */ 4038- public static class RC2CFB8 4039- extends JCEMac 4040- { 4041- public RC2CFB8() 4042- { 4043- super(new CFBBlockCipherMac(new RC2Engine())); 4044- } 4045- } 4046- 4047- /** 4048- * DES9797Alg3with7816-4Padding 4049- */ 4050- public static class DES9797Alg3with7816d4 4051- extends JCEMac 4052- { 4053- public DES9797Alg3with7816d4() 4054- { 4055- super(new ISO9797Alg3Mac(new DESEngine(), new ISO7816d4Padding())); 4056- } 4057- } 4058- 4059- /** 4060- * DES9797Alg3 4061- */ 4062- public static class DES9797Alg3 4063- extends JCEMac 4064- { 4065- public DES9797Alg3() 4066- { 4067- super(new ISO9797Alg3Mac(new DESEngine())); 4068- } 4069- } 4070- 4071- /** 4072- * MD2 HMac 4073- */ 4074- public static class MD2 4075- extends JCEMac 4076- { 4077- public MD2() 4078- { 4079- super(new HMac(new MD2Digest())); 4080- } 4081- } 4082- 4083- /** 4084- * MD4 HMac 4085- */ 4086- public static class MD4 4087- extends JCEMac 4088- { 4089- public MD4() 4090- { 4091- super(new HMac(new MD4Digest())); 4092- } 4093- } 4094+ // BEGIN android-removed 4095+ // /** 4096+ // * DES 4097+ // */ 4098+ // public static class DES 4099+ // extends JCEMac 4100+ // { 4101+ // public DES() 4102+ // { 4103+ // super(new CBCBlockCipherMac(new DESEngine())); 4104+ // } 4105+ // } 4106+ // 4107+ // /** 4108+ // * RC2 4109+ // */ 4110+ // public static class RC2 4111+ // extends JCEMac 4112+ // { 4113+ // public RC2() 4114+ // { 4115+ // super(new CBCBlockCipherMac(new RC2Engine())); 4116+ // } 4117+ // } 4118+ // 4119+ // /** 4120+ // * GOST28147 4121+ // */ 4122+ // public static class GOST28147 4123+ // extends JCEMac 4124+ // { 4125+ // public GOST28147() 4126+ // { 4127+ // super(new GOST28147Mac()); 4128+ // } 4129+ // } 4130+ // 4131+ // 4132+ // 4133+ // /** 4134+ // * DES 4135+ // */ 4136+ // public static class DESCFB8 4137+ // extends JCEMac 4138+ // { 4139+ // public DESCFB8() 4140+ // { 4141+ // super(new CFBBlockCipherMac(new DESEngine())); 4142+ // } 4143+ // } 4144+ // 4145+ // /** 4146+ // * RC2CFB8 4147+ // */ 4148+ // public static class RC2CFB8 4149+ // extends JCEMac 4150+ // { 4151+ // public RC2CFB8() 4152+ // { 4153+ // super(new CFBBlockCipherMac(new RC2Engine())); 4154+ // } 4155+ // } 4156+ // 4157+ // /** 4158+ // * DES9797Alg3with7816-4Padding 4159+ // */ 4160+ // public static class DES9797Alg3with7816d4 4161+ // extends JCEMac 4162+ // { 4163+ // public DES9797Alg3with7816d4() 4164+ // { 4165+ // super(new ISO9797Alg3Mac(new DESEngine(), new ISO7816d4Padding())); 4166+ // } 4167+ // } 4168+ // 4169+ // /** 4170+ // * DES9797Alg3 4171+ // */ 4172+ // public static class DES9797Alg3 4173+ // extends JCEMac 4174+ // { 4175+ // public DES9797Alg3() 4176+ // { 4177+ // super(new ISO9797Alg3Mac(new DESEngine())); 4178+ // } 4179+ // } 4180+ // 4181+ // /** 4182+ // * MD2 HMac 4183+ // */ 4184+ // public static class MD2 4185+ // extends JCEMac 4186+ // { 4187+ // public MD2() 4188+ // { 4189+ // super(new HMac(new MD2Digest())); 4190+ // } 4191+ // } 4192+ // 4193+ // /** 4194+ // * MD4 HMac 4195+ // */ 4196+ // public static class MD4 4197+ // extends JCEMac 4198+ // { 4199+ // public MD4() 4200+ // { 4201+ // super(new HMac(new MD4Digest())); 4202+ // } 4203+ // } 4204+ // END android-removed 4205 4206 /** 4207 * MD5 HMac 4208@@ -264,7 +280,7 @@ 4209 super(new HMac(new MD5Digest())); 4210 } 4211 } 4212- 4213+ 4214 /** 4215 * SHA1 HMac 4216 */ 4217@@ -276,18 +292,20 @@ 4218 super(new HMac(new SHA1Digest())); 4219 } 4220 } 4221- 4222- /** 4223- * SHA-224 HMac 4224- */ 4225- public static class SHA224 4226- extends JCEMac 4227- { 4228- public SHA224() 4229- { 4230- super(new HMac(new SHA224Digest())); 4231- } 4232- } 4233+ 4234+ // BEGIN android-removed 4235+ // /** 4236+ // * SHA-224 HMac 4237+ // */ 4238+ // public static class SHA224 4239+ // extends JCEMac 4240+ // { 4241+ // public SHA224() 4242+ // { 4243+ // super(new HMac(new SHA224Digest())); 4244+ // } 4245+ // } 4246+ // END android-removed 4247 4248 /** 4249 * SHA-256 HMac 4250@@ -300,7 +318,7 @@ 4251 super(new HMac(new SHA256Digest())); 4252 } 4253 } 4254- 4255+ 4256 /** 4257 * SHA-384 HMac 4258 */ 4259@@ -312,15 +330,17 @@ 4260 super(new HMac(new SHA384Digest())); 4261 } 4262 } 4263- 4264- public static class OldSHA384 4265- extends JCEMac 4266- { 4267- public OldSHA384() 4268- { 4269- super(new OldHMac(new SHA384Digest())); 4270- } 4271- } 4272+ 4273+ // BEGIN android-removed 4274+ // public static class OldSHA384 4275+ // extends JCEMac 4276+ // { 4277+ // public OldSHA384() 4278+ // { 4279+ // super(new OldHMac(new SHA384Digest())); 4280+ // } 4281+ // } 4282+ // END android-removed 4283 4284 /** 4285 * SHA-512 HMac 4286@@ -333,73 +353,75 @@ 4287 super(new HMac(new SHA512Digest())); 4288 } 4289 } 4290- 4291- /** 4292- * SHA-512 HMac 4293- */ 4294- public static class OldSHA512 4295- extends JCEMac 4296- { 4297- public OldSHA512() 4298- { 4299- super(new OldHMac(new SHA512Digest())); 4300- } 4301- } 4302 4303- /** 4304- * RIPEMD128 HMac 4305- */ 4306- public static class RIPEMD128 4307- extends JCEMac 4308- { 4309- public RIPEMD128() 4310- { 4311- super(new HMac(new RIPEMD128Digest())); 4312- } 4313- } 4314- 4315- /** 4316- * RIPEMD160 HMac 4317- */ 4318- public static class RIPEMD160 4319- extends JCEMac 4320- { 4321- public RIPEMD160() 4322- { 4323- super(new HMac(new RIPEMD160Digest())); 4324- } 4325- } 4326- 4327- /** 4328- * Tiger HMac 4329- */ 4330- public static class Tiger 4331- extends JCEMac 4332- { 4333- public Tiger() 4334- { 4335- super(new HMac(new TigerDigest())); 4336- } 4337- } 4338- 4339+ // BEGIN android-removed 4340+ // /** 4341+ // * SHA-512 HMac 4342+ // */ 4343+ // public static class OldSHA512 4344+ // extends JCEMac 4345+ // { 4346+ // public OldSHA512() 4347+ // { 4348+ // super(new OldHMac(new SHA512Digest())); 4349+ // } 4350+ // } 4351 // 4352- // PKCS12 states that the same algorithm should be used 4353- // for the key generation as is used in the HMAC, so that 4354- // is what we do here. 4355+ // /** 4356+ // * RIPEMD128 HMac 4357+ // */ 4358+ // public static class RIPEMD128 4359+ // extends JCEMac 4360+ // { 4361+ // public RIPEMD128() 4362+ // { 4363+ // super(new HMac(new RIPEMD128Digest())); 4364+ // } 4365+ // } 4366 // 4367- 4368- /** 4369- * PBEWithHmacRIPEMD160 4370- */ 4371- public static class PBEWithRIPEMD160 4372- extends JCEMac 4373- { 4374- public PBEWithRIPEMD160() 4375- { 4376- super(new HMac(new RIPEMD160Digest()), PKCS12, RIPEMD160, 160); 4377- } 4378- } 4379- 4380+ // /** 4381+ // * RIPEMD160 HMac 4382+ // */ 4383+ // public static class RIPEMD160 4384+ // extends JCEMac 4385+ // { 4386+ // public RIPEMD160() 4387+ // { 4388+ // super(new HMac(new RIPEMD160Digest())); 4389+ // } 4390+ // } 4391+ // 4392+ // /** 4393+ // * Tiger HMac 4394+ // */ 4395+ // public static class Tiger 4396+ // extends JCEMac 4397+ // { 4398+ // public Tiger() 4399+ // { 4400+ // super(new HMac(new TigerDigest())); 4401+ // } 4402+ // } 4403+ // 4404+ // // 4405+ // // PKCS12 states that the same algorithm should be used 4406+ // // for the key generation as is used in the HMAC, so that 4407+ // // is what we do here. 4408+ // // 4409+ // 4410+ // /** 4411+ // * PBEWithHmacRIPEMD160 4412+ // */ 4413+ // public static class PBEWithRIPEMD160 4414+ // extends JCEMac 4415+ // { 4416+ // public PBEWithRIPEMD160() 4417+ // { 4418+ // super(new HMac(new RIPEMD160Digest()), PKCS12, RIPEMD160, 160); 4419+ // } 4420+ // } 4421+ // END android-removed 4422+ 4423 /** 4424 * PBEWithHmacSHA 4425 */ 4426@@ -411,16 +433,18 @@ 4427 super(new HMac(new SHA1Digest()), PKCS12, SHA1, 160); 4428 } 4429 } 4430- 4431- /** 4432- * PBEWithHmacTiger 4433- */ 4434- public static class PBEWithTiger 4435- extends JCEMac 4436- { 4437- public PBEWithTiger() 4438- { 4439- super(new HMac(new TigerDigest()), PKCS12, TIGER, 192); 4440- } 4441- } 4442+ 4443+ // BEGIN android-removed 4444+ // /** 4445+ // * PBEWithHmacTiger 4446+ // */ 4447+ // public static class PBEWithTiger 4448+ // extends JCEMac 4449+ // { 4450+ // public PBEWithTiger() 4451+ // { 4452+ // super(new HMac(new TigerDigest()), PKCS12, TIGER, 192); 4453+ // } 4454+ // } 4455+ // END android-removed 4456 } 4457diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSACipher.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSACipher.java 4458--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSACipher.java 2011-02-23 20:08:56.000000000 +0000 4459+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSACipher.java 2012-05-11 05:31:26.630725775 +0000 4460@@ -535,48 +535,50 @@ 4461 } 4462 } 4463 4464- static public class PKCS1v1_5Padding 4465- extends JCERSACipher 4466- { 4467- public PKCS1v1_5Padding() 4468- { 4469- super(new PKCS1Encoding(new RSABlindedEngine())); 4470- } 4471- } 4472- 4473- static public class PKCS1v1_5Padding_PrivateOnly 4474- extends JCERSACipher 4475- { 4476- public PKCS1v1_5Padding_PrivateOnly() 4477- { 4478- super(false, true, new PKCS1Encoding(new RSABlindedEngine())); 4479- } 4480- } 4481- 4482- static public class PKCS1v1_5Padding_PublicOnly 4483- extends JCERSACipher 4484- { 4485- public PKCS1v1_5Padding_PublicOnly() 4486- { 4487- super(true, false, new PKCS1Encoding(new RSABlindedEngine())); 4488- } 4489- } 4490- 4491- static public class OAEPPadding 4492- extends JCERSACipher 4493- { 4494- public OAEPPadding() 4495- { 4496- super(OAEPParameterSpec.DEFAULT); 4497- } 4498- } 4499- 4500- static public class ISO9796d1Padding 4501- extends JCERSACipher 4502- { 4503- public ISO9796d1Padding() 4504- { 4505- super(new ISO9796d1Encoding(new RSABlindedEngine())); 4506- } 4507- } 4508+ // BEGIN android-removed 4509+ // static public class PKCS1v1_5Padding 4510+ // extends JCERSACipher 4511+ // { 4512+ // public PKCS1v1_5Padding() 4513+ // { 4514+ // super(new PKCS1Encoding(new RSABlindedEngine())); 4515+ // } 4516+ // } 4517+ // 4518+ // static public class PKCS1v1_5Padding_PrivateOnly 4519+ // extends JCERSACipher 4520+ // { 4521+ // public PKCS1v1_5Padding_PrivateOnly() 4522+ // { 4523+ // super(false, true, new PKCS1Encoding(new RSABlindedEngine())); 4524+ // } 4525+ // } 4526+ // 4527+ // static public class PKCS1v1_5Padding_PublicOnly 4528+ // extends JCERSACipher 4529+ // { 4530+ // public PKCS1v1_5Padding_PublicOnly() 4531+ // { 4532+ // super(true, false, new PKCS1Encoding(new RSABlindedEngine())); 4533+ // } 4534+ // } 4535+ // 4536+ // static public class OAEPPadding 4537+ // extends JCERSACipher 4538+ // { 4539+ // public OAEPPadding() 4540+ // { 4541+ // super(OAEPParameterSpec.DEFAULT); 4542+ // } 4543+ // } 4544+ // 4545+ // static public class ISO9796d1Padding 4546+ // extends JCERSACipher 4547+ // { 4548+ // public ISO9796d1Padding() 4549+ // { 4550+ // super(new ISO9796d1Encoding(new RSABlindedEngine())); 4551+ // } 4552+ // } 4553+ // END android-removed 4554 } 4555diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java 4556--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java 2011-02-23 20:08:56.000000000 +0000 4557+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSAPrivateCrtKey.java 2012-05-11 05:31:26.630725775 +0000 4558@@ -125,7 +125,9 @@ 4559 */ 4560 public byte[] getEncoded() 4561 { 4562- PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPrivateKeyStructure(getModulus(), getPublicExponent(), getPrivateExponent(), getPrimeP(), getPrimeQ(), getPrimeExponentP(), getPrimeExponentQ(), getCrtCoefficient()).getDERObject()); 4563+ // BEGIN android-changed 4564+ PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new RSAPrivateKeyStructure(getModulus(), getPublicExponent(), getPrivateExponent(), getPrimeP(), getPrimeQ(), getPrimeExponentP(), getPrimeExponentQ(), getCrtCoefficient()).getDERObject()); 4565+ // END android-changed 4566 4567 return info.getDEREncoded(); 4568 } 4569diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSAPrivateKey.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSAPrivateKey.java 4570--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSAPrivateKey.java 2011-02-23 20:08:56.000000000 +0000 4571+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSAPrivateKey.java 2012-05-11 05:31:26.630725775 +0000 4572@@ -77,7 +77,9 @@ 4573 4574 public byte[] getEncoded() 4575 { 4576- PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPrivateKeyStructure(getModulus(), ZERO, getPrivateExponent(), ZERO, ZERO, ZERO, ZERO, ZERO).getDERObject()); 4577+ // BEGIN android-changed 4578+ PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new RSAPrivateKeyStructure(getModulus(), ZERO, getPrivateExponent(), ZERO, ZERO, ZERO, ZERO, ZERO).getDERObject()); 4579+ // END android-changed 4580 4581 return info.getDEREncoded(); 4582 } 4583diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSAPublicKey.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSAPublicKey.java 4584--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCERSAPublicKey.java 2011-02-23 20:08:56.000000000 +0000 4585+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCERSAPublicKey.java 2012-05-11 05:31:26.630725775 +0000 4586@@ -90,7 +90,9 @@ 4587 4588 public byte[] getEncoded() 4589 { 4590- SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPublicKeyStructure(getModulus(), getPublicExponent()).getDERObject()); 4591+ // BEGIN android-changed 4592+ SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new RSAPublicKeyStructure(getModulus(), getPublicExponent()).getDERObject()); 4593+ // END android-changed 4594 4595 return info.getDEREncoded(); 4596 } 4597diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCESecretKeyFactory.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCESecretKeyFactory.java 4598--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCESecretKeyFactory.java 2011-02-23 20:08:56.000000000 +0000 4599+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCESecretKeyFactory.java 2012-05-11 05:31:26.630725775 +0000 4600@@ -250,29 +250,31 @@ 4601 } 4602 } 4603 4604- /** 4605- * PBEWithMD2AndDES 4606- */ 4607- static public class PBEWithMD2AndDES 4608- extends DESPBEKeyFactory 4609- { 4610- public PBEWithMD2AndDES() 4611- { 4612- super("PBEwithMD2andDES", PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, true, PKCS5S1, MD2, 64, 64); 4613- } 4614- } 4615- 4616- /** 4617- * PBEWithMD2AndRC2 4618- */ 4619- static public class PBEWithMD2AndRC2 4620- extends PBEKeyFactory 4621- { 4622- public PBEWithMD2AndRC2() 4623- { 4624- super("PBEwithMD2andRC2", PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, true, PKCS5S1, MD2, 64, 64); 4625- } 4626- } 4627+ // BEGIN android-removed 4628+ // /** 4629+ // * PBEWithMD2AndDES 4630+ // */ 4631+ // static public class PBEWithMD2AndDES 4632+ // extends DESPBEKeyFactory 4633+ // { 4634+ // public PBEWithMD2AndDES() 4635+ // { 4636+ // super("PBEwithMD2andDES", PKCSObjectIdentifiers.pbeWithMD2AndDES_CBC, true, PKCS5S1, MD2, 64, 64); 4637+ // } 4638+ // } 4639+ // 4640+ // /** 4641+ // * PBEWithMD2AndRC2 4642+ // */ 4643+ // static public class PBEWithMD2AndRC2 4644+ // extends PBEKeyFactory 4645+ // { 4646+ // public PBEWithMD2AndRC2() 4647+ // { 4648+ // super("PBEwithMD2andRC2", PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, true, PKCS5S1, MD2, 64, 64); 4649+ // } 4650+ // } 4651+ // END android-removed 4652 4653 /** 4654 * PBEWithMD5AndDES 4655@@ -406,17 +408,19 @@ 4656 } 4657 } 4658 4659- /** 4660- * PBEWithHmacRIPEMD160 4661- */ 4662- public static class PBEWithRIPEMD160 4663- extends PBEKeyFactory 4664- { 4665- public PBEWithRIPEMD160() 4666- { 4667- super("PBEwithHmacRIPEMD160", null, false, PKCS12, RIPEMD160, 160, 0); 4668- } 4669- } 4670+ // BEGIN android-removed 4671+ // /** 4672+ // * PBEWithHmacRIPEMD160 4673+ // */ 4674+ // public static class PBEWithRIPEMD160 4675+ // extends PBEKeyFactory 4676+ // { 4677+ // public PBEWithRIPEMD160() 4678+ // { 4679+ // super("PBEwithHmacRIPEMD160", null, false, PKCS12, RIPEMD160, 160, 0); 4680+ // } 4681+ // } 4682+ // END android-removed 4683 4684 /** 4685 * PBEWithHmacSHA 4686@@ -430,17 +434,19 @@ 4687 } 4688 } 4689 4690- /** 4691- * PBEWithHmacTiger 4692- */ 4693- public static class PBEWithTiger 4694- extends PBEKeyFactory 4695- { 4696- public PBEWithTiger() 4697- { 4698- super("PBEwithHmacTiger", null, false, PKCS12, TIGER, 192, 0); 4699- } 4700- } 4701+ // BEGIN android-removed 4702+ // /** 4703+ // * PBEWithHmacTiger 4704+ // */ 4705+ // public static class PBEWithTiger 4706+ // extends PBEKeyFactory 4707+ // { 4708+ // public PBEWithTiger() 4709+ // { 4710+ // super("PBEwithHmacTiger", null, false, PKCS12, TIGER, 192, 0); 4711+ // } 4712+ // } 4713+ // END android-removed 4714 4715 /** 4716 * PBEWithSHA1And128BitAES-BC 4717@@ -549,4 +555,56 @@ 4718 super("PBEWithMD5And256BitAES-CBC-OpenSSL", null, true, OPENSSL, MD5, 256, 128); 4719 } 4720 } 4721+ // BEGIN android-added 4722+ static public class PBKDF2WithHmacSHA1 4723+ extends JCESecretKeyFactory 4724+ { 4725+ public PBKDF2WithHmacSHA1() 4726+ { 4727+ super("PBKDF2WithHmacSHA1", PKCSObjectIdentifiers.id_PBKDF2); 4728+ } 4729+ 4730+ protected SecretKey engineGenerateSecret( 4731+ KeySpec keySpec) 4732+ throws InvalidKeySpecException 4733+ { 4734+ if (keySpec instanceof PBEKeySpec) 4735+ { 4736+ PBEKeySpec pbeSpec = (PBEKeySpec)keySpec; 4737+ 4738+ if (pbeSpec.getSalt() == null) 4739+ { 4740+ throw new InvalidKeySpecException("missing required salt"); 4741+ } 4742+ 4743+ if (pbeSpec.getIterationCount() <= 0) 4744+ { 4745+ throw new InvalidKeySpecException("positive iteration count required: " 4746+ + pbeSpec.getIterationCount()); 4747+ } 4748+ 4749+ if (pbeSpec.getKeyLength() <= 0) 4750+ { 4751+ throw new InvalidKeySpecException("positive key length required: " 4752+ + pbeSpec.getKeyLength()); 4753+ } 4754+ 4755+ if (pbeSpec.getPassword().length == 0) 4756+ { 4757+ throw new IllegalArgumentException("password empty"); 4758+ } 4759+ 4760+ int scheme = PKCS5S2; 4761+ int digest = SHA1; 4762+ int keySize = pbeSpec.getKeyLength(); 4763+ int ivSize = -1; 4764+ CipherParameters param = Util.makePBEMacParameters(pbeSpec, scheme, digest, keySize); 4765+ 4766+ return new JCEPBEKey(this.algName, this.algOid, scheme, digest, keySize, ivSize, pbeSpec, param); 4767+ } 4768+ 4769+ throw new InvalidKeySpecException("Invalid KeySpec"); 4770+ } 4771+ } 4772+ // END android-added 4773 } 4774diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEStreamCipher.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEStreamCipher.java 4775--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JCEStreamCipher.java 2011-02-23 20:08:56.000000000 +0000 4776+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JCEStreamCipher.java 2012-05-11 05:31:26.630725775 +0000 4777@@ -13,20 +13,26 @@ 4778 import javax.crypto.ShortBufferException; 4779 import javax.crypto.spec.IvParameterSpec; 4780 import javax.crypto.spec.PBEParameterSpec; 4781-import javax.crypto.spec.RC2ParameterSpec; 4782-import javax.crypto.spec.RC5ParameterSpec; 4783+// BEGIN android-removed 4784+// import javax.crypto.spec.RC2ParameterSpec; 4785+// import javax.crypto.spec.RC5ParameterSpec; 4786+// END android-removed 4787 4788 import org.bouncycastle.crypto.BlockCipher; 4789 import org.bouncycastle.crypto.CipherParameters; 4790 import org.bouncycastle.crypto.DataLengthException; 4791 import org.bouncycastle.crypto.StreamBlockCipher; 4792 import org.bouncycastle.crypto.StreamCipher; 4793-import org.bouncycastle.crypto.engines.BlowfishEngine; 4794-import org.bouncycastle.crypto.engines.DESEngine; 4795-import org.bouncycastle.crypto.engines.DESedeEngine; 4796+// BEGIN android-removed 4797+// import org.bouncycastle.crypto.engines.BlowfishEngine; 4798+// import org.bouncycastle.crypto.engines.DESEngine; 4799+// import org.bouncycastle.crypto.engines.DESedeEngine; 4800+// END android-removed 4801 import org.bouncycastle.crypto.engines.RC4Engine; 4802-import org.bouncycastle.crypto.engines.SkipjackEngine; 4803-import org.bouncycastle.crypto.engines.TwofishEngine; 4804+// BEGIN android-removed 4805+// import org.bouncycastle.crypto.engines.SkipjackEngine; 4806+// import org.bouncycastle.crypto.engines.TwofishEngine; 4807+// END android-removed 4808 import org.bouncycastle.crypto.modes.CFBBlockCipher; 4809 import org.bouncycastle.crypto.modes.OFBBlockCipher; 4810 import org.bouncycastle.crypto.params.KeyParameter; 4811@@ -40,8 +46,10 @@ 4812 // 4813 private Class[] availableSpecs = 4814 { 4815- RC2ParameterSpec.class, 4816- RC5ParameterSpec.class, 4817+ // BEGIN android-removed 4818+ // RC2ParameterSpec.class, 4819+ // RC5ParameterSpec.class, 4820+ // END android-removed 4821 IvParameterSpec.class, 4822 PBEParameterSpec.class 4823 }; 4824@@ -370,125 +378,127 @@ 4825 * The ciphers that inherit from us. 4826 */ 4827 4828- /** 4829- * DES 4830- */ 4831- static public class DES_CFB8 4832- extends JCEStreamCipher 4833- { 4834- public DES_CFB8() 4835- { 4836- super(new CFBBlockCipher(new DESEngine(), 8), 64); 4837- } 4838- } 4839- 4840- /** 4841- * DESede 4842- */ 4843- static public class DESede_CFB8 4844- extends JCEStreamCipher 4845- { 4846- public DESede_CFB8() 4847- { 4848- super(new CFBBlockCipher(new DESedeEngine(), 8), 64); 4849- } 4850- } 4851- 4852- /** 4853- * SKIPJACK 4854- */ 4855- static public class Skipjack_CFB8 4856- extends JCEStreamCipher 4857- { 4858- public Skipjack_CFB8() 4859- { 4860- super(new CFBBlockCipher(new SkipjackEngine(), 8), 64); 4861- } 4862- } 4863- 4864- /** 4865- * Blowfish 4866- */ 4867- static public class Blowfish_CFB8 4868- extends JCEStreamCipher 4869- { 4870- public Blowfish_CFB8() 4871- { 4872- super(new CFBBlockCipher(new BlowfishEngine(), 8), 64); 4873- } 4874- } 4875- 4876- /** 4877- * Twofish 4878- */ 4879- static public class Twofish_CFB8 4880- extends JCEStreamCipher 4881- { 4882- public Twofish_CFB8() 4883- { 4884- super(new CFBBlockCipher(new TwofishEngine(), 8), 128); 4885- } 4886- } 4887- 4888- /** 4889- * DES 4890- */ 4891- static public class DES_OFB8 4892- extends JCEStreamCipher 4893- { 4894- public DES_OFB8() 4895- { 4896- super(new OFBBlockCipher(new DESEngine(), 8), 64); 4897- } 4898- } 4899- 4900- /** 4901- * DESede 4902- */ 4903- static public class DESede_OFB8 4904- extends JCEStreamCipher 4905- { 4906- public DESede_OFB8() 4907- { 4908- super(new OFBBlockCipher(new DESedeEngine(), 8), 64); 4909- } 4910- } 4911- 4912- /** 4913- * SKIPJACK 4914- */ 4915- static public class Skipjack_OFB8 4916- extends JCEStreamCipher 4917- { 4918- public Skipjack_OFB8() 4919- { 4920- super(new OFBBlockCipher(new SkipjackEngine(), 8), 64); 4921- } 4922- } 4923- 4924- /** 4925- * Blowfish 4926- */ 4927- static public class Blowfish_OFB8 4928- extends JCEStreamCipher 4929- { 4930- public Blowfish_OFB8() 4931- { 4932- super(new OFBBlockCipher(new BlowfishEngine(), 8), 64); 4933- } 4934- } 4935- 4936- /** 4937- * Twofish 4938- */ 4939- static public class Twofish_OFB8 4940- extends JCEStreamCipher 4941- { 4942- public Twofish_OFB8() 4943- { 4944- super(new OFBBlockCipher(new TwofishEngine(), 8), 128); 4945- } 4946- } 4947+ // BEGIN android-removed 4948+ // /** 4949+ // * DES 4950+ // */ 4951+ // static public class DES_CFB8 4952+ // extends JCEStreamCipher 4953+ // { 4954+ // public DES_CFB8() 4955+ // { 4956+ // super(new CFBBlockCipher(new DESEngine(), 8), 64); 4957+ // } 4958+ // } 4959+ // 4960+ // /** 4961+ // * DESede 4962+ // */ 4963+ // static public class DESede_CFB8 4964+ // extends JCEStreamCipher 4965+ // { 4966+ // public DESede_CFB8() 4967+ // { 4968+ // super(new CFBBlockCipher(new DESedeEngine(), 8), 64); 4969+ // } 4970+ // } 4971+ // 4972+ // /** 4973+ // * SKIPJACK 4974+ // */ 4975+ // static public class Skipjack_CFB8 4976+ // extends JCEStreamCipher 4977+ // { 4978+ // public Skipjack_CFB8() 4979+ // { 4980+ // super(new CFBBlockCipher(new SkipjackEngine(), 8), 64); 4981+ // } 4982+ // } 4983+ // 4984+ // /** 4985+ // * Blowfish 4986+ // */ 4987+ // static public class Blowfish_CFB8 4988+ // extends JCEStreamCipher 4989+ // { 4990+ // public Blowfish_CFB8() 4991+ // { 4992+ // super(new CFBBlockCipher(new BlowfishEngine(), 8), 64); 4993+ // } 4994+ // } 4995+ // 4996+ // /** 4997+ // * Twofish 4998+ // */ 4999+ // static public class Twofish_CFB8 5000+ // extends JCEStreamCipher 5001+ // { 5002+ // public Twofish_CFB8() 5003+ // { 5004+ // super(new CFBBlockCipher(new TwofishEngine(), 8), 128); 5005+ // } 5006+ // } 5007+ // 5008+ // /** 5009+ // * DES 5010+ // */ 5011+ // static public class DES_OFB8 5012+ // extends JCEStreamCipher 5013+ // { 5014+ // public DES_OFB8() 5015+ // { 5016+ // super(new OFBBlockCipher(new DESEngine(), 8), 64); 5017+ // } 5018+ // } 5019+ // 5020+ // /** 5021+ // * DESede 5022+ // */ 5023+ // static public class DESede_OFB8 5024+ // extends JCEStreamCipher 5025+ // { 5026+ // public DESede_OFB8() 5027+ // { 5028+ // super(new OFBBlockCipher(new DESedeEngine(), 8), 64); 5029+ // } 5030+ // } 5031+ // 5032+ // /** 5033+ // * SKIPJACK 5034+ // */ 5035+ // static public class Skipjack_OFB8 5036+ // extends JCEStreamCipher 5037+ // { 5038+ // public Skipjack_OFB8() 5039+ // { 5040+ // super(new OFBBlockCipher(new SkipjackEngine(), 8), 64); 5041+ // } 5042+ // } 5043+ // 5044+ // /** 5045+ // * Blowfish 5046+ // */ 5047+ // static public class Blowfish_OFB8 5048+ // extends JCEStreamCipher 5049+ // { 5050+ // public Blowfish_OFB8() 5051+ // { 5052+ // super(new OFBBlockCipher(new BlowfishEngine(), 8), 64); 5053+ // } 5054+ // } 5055+ // 5056+ // /** 5057+ // * Twofish 5058+ // */ 5059+ // static public class Twofish_OFB8 5060+ // extends JCEStreamCipher 5061+ // { 5062+ // public Twofish_OFB8() 5063+ // { 5064+ // super(new OFBBlockCipher(new TwofishEngine(), 8), 128); 5065+ // } 5066+ // } 5067+ // END android-removed 5068 5069 /** 5070 * PBEWithSHAAnd128BitRC4 5071@@ -501,7 +511,7 @@ 5072 super(new RC4Engine(), 0); 5073 } 5074 } 5075- 5076+ 5077 /** 5078 * PBEWithSHAAnd40BitRC4 5079 */ 5080diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKAlgorithmParameterGenerator.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKAlgorithmParameterGenerator.java 5081--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKAlgorithmParameterGenerator.java 2011-02-23 20:08:56.000000000 +0000 5082+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKAlgorithmParameterGenerator.java 2012-05-11 05:31:26.630725775 +0000 5083@@ -11,18 +11,24 @@ 5084 import javax.crypto.spec.DHGenParameterSpec; 5085 import javax.crypto.spec.DHParameterSpec; 5086 import javax.crypto.spec.IvParameterSpec; 5087-import javax.crypto.spec.RC2ParameterSpec; 5088+// BEGIN android-removed 5089+// import javax.crypto.spec.RC2ParameterSpec; 5090+// END android-removed 5091 5092 import org.bouncycastle.crypto.generators.DHParametersGenerator; 5093 import org.bouncycastle.crypto.generators.DSAParametersGenerator; 5094-import org.bouncycastle.crypto.generators.ElGamalParametersGenerator; 5095-import org.bouncycastle.crypto.generators.GOST3410ParametersGenerator; 5096+// BEGIN android-removed 5097+// import org.bouncycastle.crypto.generators.ElGamalParametersGenerator; 5098+// import org.bouncycastle.crypto.generators.GOST3410ParametersGenerator; 5099+// END android-removed 5100 import org.bouncycastle.crypto.params.DHParameters; 5101 import org.bouncycastle.crypto.params.DSAParameters; 5102-import org.bouncycastle.crypto.params.ElGamalParameters; 5103-import org.bouncycastle.crypto.params.GOST3410Parameters; 5104-import org.bouncycastle.jce.spec.GOST3410ParameterSpec; 5105-import org.bouncycastle.jce.spec.GOST3410PublicKeyParameterSetSpec; 5106+// BEGIN android-removed 5107+// import org.bouncycastle.crypto.params.ElGamalParameters; 5108+// import org.bouncycastle.crypto.params.GOST3410Parameters; 5109+// import org.bouncycastle.jce.spec.GOST3410ParameterSpec; 5110+// import org.bouncycastle.jce.spec.GOST3410PublicKeyParameterSetSpec; 5111+// END android-removed 5112 5113 public abstract class JDKAlgorithmParameterGenerator 5114 extends AlgorithmParameterGeneratorSpi 5115@@ -145,196 +151,198 @@ 5116 } 5117 } 5118 5119- public static class GOST3410 5120- extends JDKAlgorithmParameterGenerator 5121- { 5122- protected void engineInit( 5123- AlgorithmParameterSpec genParamSpec, 5124- SecureRandom random) 5125- throws InvalidAlgorithmParameterException 5126- { 5127- throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for GOST3410 parameter generation."); 5128- } 5129- 5130- protected AlgorithmParameters engineGenerateParameters() 5131- { 5132- GOST3410ParametersGenerator pGen = new GOST3410ParametersGenerator(); 5133- 5134- if (random != null) 5135- { 5136- pGen.init(strength, 2, random); 5137- } 5138- else 5139- { 5140- pGen.init(strength, 2, new SecureRandom()); 5141- } 5142- 5143- GOST3410Parameters p = pGen.generateParameters(); 5144- 5145- AlgorithmParameters params; 5146- 5147- try 5148- { 5149- params = AlgorithmParameters.getInstance("GOST3410", BouncyCastleProvider.PROVIDER_NAME); 5150- params.init(new GOST3410ParameterSpec(new GOST3410PublicKeyParameterSetSpec(p.getP(), p.getQ(), p.getA()))); 5151- } 5152- catch (Exception e) 5153- { 5154- throw new RuntimeException(e.getMessage()); 5155- } 5156- 5157- return params; 5158- } 5159- } 5160- 5161- public static class ElGamal 5162- extends JDKAlgorithmParameterGenerator 5163- { 5164- private int l = 0; 5165- 5166- protected void engineInit( 5167- AlgorithmParameterSpec genParamSpec, 5168- SecureRandom random) 5169- throws InvalidAlgorithmParameterException 5170- { 5171- if (!(genParamSpec instanceof DHGenParameterSpec)) 5172- { 5173- throw new InvalidAlgorithmParameterException("DH parameter generator requires a DHGenParameterSpec for initialisation"); 5174- } 5175- DHGenParameterSpec spec = (DHGenParameterSpec)genParamSpec; 5176- 5177- this.strength = spec.getPrimeSize(); 5178- this.l = spec.getExponentSize(); 5179- this.random = random; 5180- } 5181- 5182- protected AlgorithmParameters engineGenerateParameters() 5183- { 5184- ElGamalParametersGenerator pGen = new ElGamalParametersGenerator(); 5185- 5186- if (random != null) 5187- { 5188- pGen.init(strength, 20, random); 5189- } 5190- else 5191- { 5192- pGen.init(strength, 20, new SecureRandom()); 5193- } 5194- 5195- ElGamalParameters p = pGen.generateParameters(); 5196- 5197- AlgorithmParameters params; 5198- 5199- try 5200- { 5201- params = AlgorithmParameters.getInstance("ElGamal", BouncyCastleProvider.PROVIDER_NAME); 5202- params.init(new DHParameterSpec(p.getP(), p.getG(), l)); 5203- } 5204- catch (Exception e) 5205- { 5206- throw new RuntimeException(e.getMessage()); 5207- } 5208- 5209- return params; 5210- } 5211- } 5212- 5213- public static class DES 5214- extends JDKAlgorithmParameterGenerator 5215- { 5216- protected void engineInit( 5217- AlgorithmParameterSpec genParamSpec, 5218- SecureRandom random) 5219- throws InvalidAlgorithmParameterException 5220- { 5221- throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for DES parameter generation."); 5222- } 5223- 5224- protected AlgorithmParameters engineGenerateParameters() 5225- { 5226- byte[] iv = new byte[8]; 5227- 5228- if (random == null) 5229- { 5230- random = new SecureRandom(); 5231- } 5232- 5233- random.nextBytes(iv); 5234- 5235- AlgorithmParameters params; 5236- 5237- try 5238- { 5239- params = AlgorithmParameters.getInstance("DES", BouncyCastleProvider.PROVIDER_NAME); 5240- params.init(new IvParameterSpec(iv)); 5241- } 5242- catch (Exception e) 5243- { 5244- throw new RuntimeException(e.getMessage()); 5245- } 5246- 5247- return params; 5248- } 5249- } 5250- 5251- public static class RC2 5252- extends JDKAlgorithmParameterGenerator 5253- { 5254- RC2ParameterSpec spec = null; 5255- 5256- protected void engineInit( 5257- AlgorithmParameterSpec genParamSpec, 5258- SecureRandom random) 5259- throws InvalidAlgorithmParameterException 5260- { 5261- if (genParamSpec instanceof RC2ParameterSpec) 5262- { 5263- spec = (RC2ParameterSpec)genParamSpec; 5264- return; 5265- } 5266- 5267- throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for RC2 parameter generation."); 5268- } 5269- 5270- protected AlgorithmParameters engineGenerateParameters() 5271- { 5272- AlgorithmParameters params; 5273- 5274- if (spec == null) 5275- { 5276- byte[] iv = new byte[8]; 5277- 5278- if (random == null) 5279- { 5280- random = new SecureRandom(); 5281- } 5282- 5283- random.nextBytes(iv); 5284- 5285- try 5286- { 5287- params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 5288- params.init(new IvParameterSpec(iv)); 5289- } 5290- catch (Exception e) 5291- { 5292- throw new RuntimeException(e.getMessage()); 5293- } 5294- } 5295- else 5296- { 5297- try 5298- { 5299- params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 5300- params.init(spec); 5301- } 5302- catch (Exception e) 5303- { 5304- throw new RuntimeException(e.getMessage()); 5305- } 5306- } 5307- 5308- return params; 5309- } 5310- } 5311+ // BEGIN android-removed 5312+ // public static class GOST3410 5313+ // extends JDKAlgorithmParameterGenerator 5314+ // { 5315+ // protected void engineInit( 5316+ // AlgorithmParameterSpec genParamSpec, 5317+ // SecureRandom random) 5318+ // throws InvalidAlgorithmParameterException 5319+ // { 5320+ // throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for GOST3410 parameter generation."); 5321+ // } 5322+ // 5323+ // protected AlgorithmParameters engineGenerateParameters() 5324+ // { 5325+ // GOST3410ParametersGenerator pGen = new GOST3410ParametersGenerator(); 5326+ // 5327+ // if (random != null) 5328+ // { 5329+ // pGen.init(strength, 2, random); 5330+ // } 5331+ // else 5332+ // { 5333+ // pGen.init(strength, 2, new SecureRandom()); 5334+ // } 5335+ // 5336+ // GOST3410Parameters p = pGen.generateParameters(); 5337+ // 5338+ // AlgorithmParameters params; 5339+ // 5340+ // try 5341+ // { 5342+ // params = AlgorithmParameters.getInstance("GOST3410", BouncyCastleProvider.PROVIDER_NAME); 5343+ // params.init(new GOST3410ParameterSpec(new GOST3410PublicKeyParameterSetSpec(p.getP(), p.getQ(), p.getA()))); 5344+ // } 5345+ // catch (Exception e) 5346+ // { 5347+ // throw new RuntimeException(e.getMessage()); 5348+ // } 5349+ // 5350+ // return params; 5351+ // } 5352+ // } 5353+ // 5354+ // public static class ElGamal 5355+ // extends JDKAlgorithmParameterGenerator 5356+ // { 5357+ // private int l = 0; 5358+ // 5359+ // protected void engineInit( 5360+ // AlgorithmParameterSpec genParamSpec, 5361+ // SecureRandom random) 5362+ // throws InvalidAlgorithmParameterException 5363+ // { 5364+ // if (!(genParamSpec instanceof DHGenParameterSpec)) 5365+ // { 5366+ // throw new InvalidAlgorithmParameterException("DH parameter generator requires a DHGenParameterSpec for initialisation"); 5367+ // } 5368+ // DHGenParameterSpec spec = (DHGenParameterSpec)genParamSpec; 5369+ // 5370+ // this.strength = spec.getPrimeSize(); 5371+ // this.l = spec.getExponentSize(); 5372+ // this.random = random; 5373+ // } 5374+ // 5375+ // protected AlgorithmParameters engineGenerateParameters() 5376+ // { 5377+ // ElGamalParametersGenerator pGen = new ElGamalParametersGenerator(); 5378+ // 5379+ // if (random != null) 5380+ // { 5381+ // pGen.init(strength, 20, random); 5382+ // } 5383+ // else 5384+ // { 5385+ // pGen.init(strength, 20, new SecureRandom()); 5386+ // } 5387+ // 5388+ // ElGamalParameters p = pGen.generateParameters(); 5389+ // 5390+ // AlgorithmParameters params; 5391+ // 5392+ // try 5393+ // { 5394+ // params = AlgorithmParameters.getInstance("ElGamal", BouncyCastleProvider.PROVIDER_NAME); 5395+ // params.init(new DHParameterSpec(p.getP(), p.getG(), l)); 5396+ // } 5397+ // catch (Exception e) 5398+ // { 5399+ // throw new RuntimeException(e.getMessage()); 5400+ // } 5401+ // 5402+ // return params; 5403+ // } 5404+ // } 5405+ // 5406+ // public static class DES 5407+ // extends JDKAlgorithmParameterGenerator 5408+ // { 5409+ // protected void engineInit( 5410+ // AlgorithmParameterSpec genParamSpec, 5411+ // SecureRandom random) 5412+ // throws InvalidAlgorithmParameterException 5413+ // { 5414+ // throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for DES parameter generation."); 5415+ // } 5416+ // 5417+ // protected AlgorithmParameters engineGenerateParameters() 5418+ // { 5419+ // byte[] iv = new byte[8]; 5420+ // 5421+ // if (random == null) 5422+ // { 5423+ // random = new SecureRandom(); 5424+ // } 5425+ // 5426+ // random.nextBytes(iv); 5427+ // 5428+ // AlgorithmParameters params; 5429+ // 5430+ // try 5431+ // { 5432+ // params = AlgorithmParameters.getInstance("DES", BouncyCastleProvider.PROVIDER_NAME); 5433+ // params.init(new IvParameterSpec(iv)); 5434+ // } 5435+ // catch (Exception e) 5436+ // { 5437+ // throw new RuntimeException(e.getMessage()); 5438+ // } 5439+ // 5440+ // return params; 5441+ // } 5442+ // } 5443+ // 5444+ // public static class RC2 5445+ // extends JDKAlgorithmParameterGenerator 5446+ // { 5447+ // RC2ParameterSpec spec = null; 5448+ // 5449+ // protected void engineInit( 5450+ // AlgorithmParameterSpec genParamSpec, 5451+ // SecureRandom random) 5452+ // throws InvalidAlgorithmParameterException 5453+ // { 5454+ // if (genParamSpec instanceof RC2ParameterSpec) 5455+ // { 5456+ // spec = (RC2ParameterSpec)genParamSpec; 5457+ // return; 5458+ // } 5459+ // 5460+ // throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for RC2 parameter generation."); 5461+ // } 5462+ // 5463+ // protected AlgorithmParameters engineGenerateParameters() 5464+ // { 5465+ // AlgorithmParameters params; 5466+ // 5467+ // if (spec == null) 5468+ // { 5469+ // byte[] iv = new byte[8]; 5470+ // 5471+ // if (random == null) 5472+ // { 5473+ // random = new SecureRandom(); 5474+ // } 5475+ // 5476+ // random.nextBytes(iv); 5477+ // 5478+ // try 5479+ // { 5480+ // params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 5481+ // params.init(new IvParameterSpec(iv)); 5482+ // } 5483+ // catch (Exception e) 5484+ // { 5485+ // throw new RuntimeException(e.getMessage()); 5486+ // } 5487+ // } 5488+ // else 5489+ // { 5490+ // try 5491+ // { 5492+ // params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME); 5493+ // params.init(spec); 5494+ // } 5495+ // catch (Exception e) 5496+ // { 5497+ // throw new RuntimeException(e.getMessage()); 5498+ // } 5499+ // } 5500+ // 5501+ // return params; 5502+ // } 5503+ // } 5504+ // END android-removed 5505 } 5506diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java 5507--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java 2011-02-23 20:08:56.000000000 +0000 5508+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java 2012-05-11 05:31:26.630725775 +0000 5509@@ -10,21 +10,27 @@ 5510 import org.bouncycastle.asn1.DERObjectIdentifier; 5511 import org.bouncycastle.asn1.DEROctetString; 5512 import org.bouncycastle.asn1.DERSequence; 5513-import org.bouncycastle.asn1.cryptopro.GOST3410PublicKeyAlgParameters; 5514-import org.bouncycastle.asn1.oiw.ElGamalParameter; 5515+// BEGIN android-removed 5516+// import org.bouncycastle.asn1.cryptopro.GOST3410PublicKeyAlgParameters; 5517+// import org.bouncycastle.asn1.oiw.ElGamalParameter; 5518+// END android-removed 5519 import org.bouncycastle.asn1.pkcs.DHParameter; 5520 import org.bouncycastle.asn1.pkcs.PKCS12PBEParams; 5521 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 5522-import org.bouncycastle.asn1.pkcs.RC2CBCParameter; 5523+// BEGIN android-removed 5524+// import org.bouncycastle.asn1.pkcs.RC2CBCParameter; 5525+// END android-removed 5526 import org.bouncycastle.asn1.pkcs.RSAESOAEPparams; 5527 import org.bouncycastle.asn1.pkcs.RSASSAPSSparams; 5528 import org.bouncycastle.asn1.pkcs.PBKDF2Params; 5529 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 5530 import org.bouncycastle.asn1.x509.DSAParameter; 5531-import org.bouncycastle.jce.spec.ElGamalParameterSpec; 5532-import org.bouncycastle.jce.spec.GOST3410ParameterSpec; 5533-import org.bouncycastle.jce.spec.GOST3410PublicKeyParameterSetSpec; 5534-import org.bouncycastle.jce.spec.IESParameterSpec; 5535+// BEGIN android-removed 5536+// import org.bouncycastle.jce.spec.ElGamalParameterSpec; 5537+// import org.bouncycastle.jce.spec.GOST3410ParameterSpec; 5538+// import org.bouncycastle.jce.spec.GOST3410PublicKeyParameterSetSpec; 5539+// import org.bouncycastle.jce.spec.IESParameterSpec; 5540+// END android-removed 5541 import org.bouncycastle.util.Arrays; 5542 5543 import javax.crypto.spec.DHParameterSpec; 5544@@ -32,7 +38,9 @@ 5545 import javax.crypto.spec.OAEPParameterSpec; 5546 import javax.crypto.spec.PBEParameterSpec; 5547 import javax.crypto.spec.PSource; 5548-import javax.crypto.spec.RC2ParameterSpec; 5549+// BEGIN android-removed 5550+// import javax.crypto.spec.RC2ParameterSpec; 5551+// END android-removed 5552 import java.io.IOException; 5553 import java.security.AlgorithmParametersSpi; 5554 import java.security.spec.AlgorithmParameterSpec; 5555@@ -68,13 +76,13 @@ 5556 extends JDKAlgorithmParameters 5557 { 5558 private byte[] iv; 5559- 5560+ 5561 protected byte[] engineGetEncoded() 5562 throws IOException 5563 { 5564 return engineGetEncoded("ASN.1"); 5565 } 5566- 5567+ 5568 protected byte[] engineGetEncoded( 5569 String format) 5570 throws IOException 5571@@ -83,15 +91,15 @@ 5572 { 5573 return new DEROctetString(engineGetEncoded("RAW")).getEncoded(); 5574 } 5575- 5576+ 5577 if (format.equals("RAW")) 5578 { 5579 return Arrays.clone(iv); 5580 } 5581- 5582+ 5583 return null; 5584 } 5585- 5586+ 5587 protected AlgorithmParameterSpec localEngineGetParameterSpec( 5588 Class paramSpec) 5589 throws InvalidParameterSpecException 5590@@ -100,10 +108,10 @@ 5591 { 5592 return new IvParameterSpec(iv); 5593 } 5594- 5595+ 5596 throw new InvalidParameterSpecException("unknown parameter spec passed to IV parameters object."); 5597 } 5598- 5599+ 5600 protected void engineInit( 5601 AlgorithmParameterSpec paramSpec) 5602 throws InvalidParameterSpecException 5603@@ -112,10 +120,10 @@ 5604 { 5605 throw new InvalidParameterSpecException("IvParameterSpec required to initialise a IV parameters algorithm parameters object"); 5606 } 5607- 5608+ 5609 this.iv = ((IvParameterSpec)paramSpec).getIV(); 5610 } 5611- 5612+ 5613 protected void engineInit( 5614 byte[] params) 5615 throws IOException 5616@@ -127,13 +135,13 @@ 5617 && params[0] == 0x04 && params[1] == params.length - 2) 5618 { 5619 ASN1OctetString oct = (ASN1OctetString)ASN1Object.fromByteArray(params); 5620- 5621+ 5622 params = oct.getOctets(); 5623 } 5624- 5625+ 5626 this.iv = Arrays.clone(params); 5627 } 5628- 5629+ 5630 protected void engineInit( 5631 byte[] params, 5632 String format) 5633@@ -144,204 +152,206 @@ 5634 try 5635 { 5636 ASN1OctetString oct = (ASN1OctetString)ASN1Object.fromByteArray(params); 5637- 5638+ 5639 engineInit(oct.getOctets()); 5640 } 5641 catch (Exception e) 5642 { 5643 throw new IOException("Exception decoding: " + e); 5644 } 5645- 5646+ 5647 return; 5648 } 5649- 5650+ 5651 if (format.equals("RAW")) 5652 { 5653 engineInit(params); 5654 return; 5655 } 5656- 5657+ 5658 throw new IOException("Unknown parameters format in IV parameters object"); 5659 } 5660- 5661+ 5662 protected String engineToString() 5663 { 5664 return "IV Parameters"; 5665 } 5666 } 5667- 5668- public static class RC2AlgorithmParameters 5669- extends JDKAlgorithmParameters 5670- { 5671- private static final short[] table = { 5672- 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, 5673- 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 5674- 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, 5675- 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c, 5676- 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 5677- 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, 5678- 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e, 5679- 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 5680- 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, 5681- 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3, 5682- 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 5683- 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, 5684- 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5, 5685- 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 5686- 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, 5687- 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab 5688- }; 5689- 5690- private static final short[] ekb = { 5691- 0x5d, 0xbe, 0x9b, 0x8b, 0x11, 0x99, 0x6e, 0x4d, 0x59, 0xf3, 0x85, 0xa6, 0x3f, 0xb7, 0x83, 0xc5, 5692- 0xe4, 0x73, 0x6b, 0x3a, 0x68, 0x5a, 0xc0, 0x47, 0xa0, 0x64, 0x34, 0x0c, 0xf1, 0xd0, 0x52, 0xa5, 5693- 0xb9, 0x1e, 0x96, 0x43, 0x41, 0xd8, 0xd4, 0x2c, 0xdb, 0xf8, 0x07, 0x77, 0x2a, 0xca, 0xeb, 0xef, 5694- 0x10, 0x1c, 0x16, 0x0d, 0x38, 0x72, 0x2f, 0x89, 0xc1, 0xf9, 0x80, 0xc4, 0x6d, 0xae, 0x30, 0x3d, 5695- 0xce, 0x20, 0x63, 0xfe, 0xe6, 0x1a, 0xc7, 0xb8, 0x50, 0xe8, 0x24, 0x17, 0xfc, 0x25, 0x6f, 0xbb, 5696- 0x6a, 0xa3, 0x44, 0x53, 0xd9, 0xa2, 0x01, 0xab, 0xbc, 0xb6, 0x1f, 0x98, 0xee, 0x9a, 0xa7, 0x2d, 5697- 0x4f, 0x9e, 0x8e, 0xac, 0xe0, 0xc6, 0x49, 0x46, 0x29, 0xf4, 0x94, 0x8a, 0xaf, 0xe1, 0x5b, 0xc3, 5698- 0xb3, 0x7b, 0x57, 0xd1, 0x7c, 0x9c, 0xed, 0x87, 0x40, 0x8c, 0xe2, 0xcb, 0x93, 0x14, 0xc9, 0x61, 5699- 0x2e, 0xe5, 0xcc, 0xf6, 0x5e, 0xa8, 0x5c, 0xd6, 0x75, 0x8d, 0x62, 0x95, 0x58, 0x69, 0x76, 0xa1, 5700- 0x4a, 0xb5, 0x55, 0x09, 0x78, 0x33, 0x82, 0xd7, 0xdd, 0x79, 0xf5, 0x1b, 0x0b, 0xde, 0x26, 0x21, 5701- 0x28, 0x74, 0x04, 0x97, 0x56, 0xdf, 0x3c, 0xf0, 0x37, 0x39, 0xdc, 0xff, 0x06, 0xa4, 0xea, 0x42, 5702- 0x08, 0xda, 0xb4, 0x71, 0xb0, 0xcf, 0x12, 0x7a, 0x4e, 0xfa, 0x6c, 0x1d, 0x84, 0x00, 0xc8, 0x7f, 5703- 0x91, 0x45, 0xaa, 0x2b, 0xc2, 0xb1, 0x8f, 0xd5, 0xba, 0xf2, 0xad, 0x19, 0xb2, 0x67, 0x36, 0xf7, 5704- 0x0f, 0x0a, 0x92, 0x7d, 0xe3, 0x9d, 0xe9, 0x90, 0x3e, 0x23, 0x27, 0x66, 0x13, 0xec, 0x81, 0x15, 5705- 0xbd, 0x22, 0xbf, 0x9f, 0x7e, 0xa9, 0x51, 0x4b, 0x4c, 0xfb, 0x02, 0xd3, 0x70, 0x86, 0x31, 0xe7, 5706- 0x3b, 0x05, 0x03, 0x54, 0x60, 0x48, 0x65, 0x18, 0xd2, 0xcd, 0x5f, 0x32, 0x88, 0x0e, 0x35, 0xfd 5707- }; 5708- 5709- private byte[] iv; 5710- private int parameterVersion = 58; 5711- 5712- protected byte[] engineGetEncoded() 5713- { 5714- return Arrays.clone(iv); 5715- } 5716- 5717- protected byte[] engineGetEncoded( 5718- String format) 5719- throws IOException 5720- { 5721- if (isASN1FormatString(format)) 5722- { 5723- if (parameterVersion == -1) 5724- { 5725- return new RC2CBCParameter(engineGetEncoded()).getEncoded(); 5726- } 5727- else 5728- { 5729- return new RC2CBCParameter(parameterVersion, engineGetEncoded()).getEncoded(); 5730- } 5731- } 5732- 5733- if (format.equals("RAW")) 5734- { 5735- return engineGetEncoded(); 5736- } 5737- 5738- return null; 5739- } 5740- 5741- protected AlgorithmParameterSpec localEngineGetParameterSpec( 5742- Class paramSpec) 5743- throws InvalidParameterSpecException 5744- { 5745- if (paramSpec == RC2ParameterSpec.class) 5746- { 5747- if (parameterVersion != -1) 5748- { 5749- if (parameterVersion < 256) 5750- { 5751- return new RC2ParameterSpec(ekb[parameterVersion], iv); 5752- } 5753- else 5754- { 5755- return new RC2ParameterSpec(parameterVersion, iv); 5756- } 5757- } 5758- } 5759- 5760- if (paramSpec == IvParameterSpec.class) 5761- { 5762- return new IvParameterSpec(iv); 5763- } 5764- 5765- throw new InvalidParameterSpecException("unknown parameter spec passed to RC2 parameters object."); 5766- } 5767- 5768- protected void engineInit( 5769- AlgorithmParameterSpec paramSpec) 5770- throws InvalidParameterSpecException 5771- { 5772- if (paramSpec instanceof IvParameterSpec) 5773- { 5774- this.iv = ((IvParameterSpec)paramSpec).getIV(); 5775- } 5776- else if (paramSpec instanceof RC2ParameterSpec) 5777- { 5778- int effKeyBits = ((RC2ParameterSpec)paramSpec).getEffectiveKeyBits(); 5779- if (effKeyBits != -1) 5780- { 5781- if (effKeyBits < 256) 5782- { 5783- parameterVersion = table[effKeyBits]; 5784- } 5785- else 5786- { 5787- parameterVersion = effKeyBits; 5788- } 5789- } 5790- 5791- this.iv = ((RC2ParameterSpec)paramSpec).getIV(); 5792- } 5793- else 5794- { 5795- throw new InvalidParameterSpecException("IvParameterSpec or RC2ParameterSpec required to initialise a RC2 parameters algorithm parameters object"); 5796- } 5797- } 5798- 5799- protected void engineInit( 5800- byte[] params) 5801- throws IOException 5802- { 5803- this.iv = Arrays.clone(params); 5804- } 5805- 5806- protected void engineInit( 5807- byte[] params, 5808- String format) 5809- throws IOException 5810- { 5811- if (isASN1FormatString(format)) 5812- { 5813- RC2CBCParameter p = RC2CBCParameter.getInstance(ASN1Object.fromByteArray(params)); 5814- 5815- if (p.getRC2ParameterVersion() != null) 5816- { 5817- parameterVersion = p.getRC2ParameterVersion().intValue(); 5818- } 5819- 5820- iv = p.getIV(); 5821- 5822- return; 5823- } 5824- 5825- if (format.equals("RAW")) 5826- { 5827- engineInit(params); 5828- return; 5829- } 5830- 5831- throw new IOException("Unknown parameters format in IV parameters object"); 5832- } 5833- 5834- protected String engineToString() 5835- { 5836- return "RC2 Parameters"; 5837- } 5838- } 5839- 5840+ 5841+ // BEGIN android-removed 5842+ // public static class RC2AlgorithmParameters 5843+ // extends JDKAlgorithmParameters 5844+ // { 5845+ // private static final short[] table = { 5846+ // 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, 5847+ // 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 5848+ // 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, 5849+ // 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c, 5850+ // 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 5851+ // 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, 5852+ // 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e, 5853+ // 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 5854+ // 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, 5855+ // 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3, 5856+ // 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 5857+ // 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, 5858+ // 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5, 5859+ // 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 5860+ // 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, 5861+ // 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab 5862+ // }; 5863+ // 5864+ // private static final short[] ekb = { 5865+ // 0x5d, 0xbe, 0x9b, 0x8b, 0x11, 0x99, 0x6e, 0x4d, 0x59, 0xf3, 0x85, 0xa6, 0x3f, 0xb7, 0x83, 0xc5, 5866+ // 0xe4, 0x73, 0x6b, 0x3a, 0x68, 0x5a, 0xc0, 0x47, 0xa0, 0x64, 0x34, 0x0c, 0xf1, 0xd0, 0x52, 0xa5, 5867+ // 0xb9, 0x1e, 0x96, 0x43, 0x41, 0xd8, 0xd4, 0x2c, 0xdb, 0xf8, 0x07, 0x77, 0x2a, 0xca, 0xeb, 0xef, 5868+ // 0x10, 0x1c, 0x16, 0x0d, 0x38, 0x72, 0x2f, 0x89, 0xc1, 0xf9, 0x80, 0xc4, 0x6d, 0xae, 0x30, 0x3d, 5869+ // 0xce, 0x20, 0x63, 0xfe, 0xe6, 0x1a, 0xc7, 0xb8, 0x50, 0xe8, 0x24, 0x17, 0xfc, 0x25, 0x6f, 0xbb, 5870+ // 0x6a, 0xa3, 0x44, 0x53, 0xd9, 0xa2, 0x01, 0xab, 0xbc, 0xb6, 0x1f, 0x98, 0xee, 0x9a, 0xa7, 0x2d, 5871+ // 0x4f, 0x9e, 0x8e, 0xac, 0xe0, 0xc6, 0x49, 0x46, 0x29, 0xf4, 0x94, 0x8a, 0xaf, 0xe1, 0x5b, 0xc3, 5872+ // 0xb3, 0x7b, 0x57, 0xd1, 0x7c, 0x9c, 0xed, 0x87, 0x40, 0x8c, 0xe2, 0xcb, 0x93, 0x14, 0xc9, 0x61, 5873+ // 0x2e, 0xe5, 0xcc, 0xf6, 0x5e, 0xa8, 0x5c, 0xd6, 0x75, 0x8d, 0x62, 0x95, 0x58, 0x69, 0x76, 0xa1, 5874+ // 0x4a, 0xb5, 0x55, 0x09, 0x78, 0x33, 0x82, 0xd7, 0xdd, 0x79, 0xf5, 0x1b, 0x0b, 0xde, 0x26, 0x21, 5875+ // 0x28, 0x74, 0x04, 0x97, 0x56, 0xdf, 0x3c, 0xf0, 0x37, 0x39, 0xdc, 0xff, 0x06, 0xa4, 0xea, 0x42, 5876+ // 0x08, 0xda, 0xb4, 0x71, 0xb0, 0xcf, 0x12, 0x7a, 0x4e, 0xfa, 0x6c, 0x1d, 0x84, 0x00, 0xc8, 0x7f, 5877+ // 0x91, 0x45, 0xaa, 0x2b, 0xc2, 0xb1, 0x8f, 0xd5, 0xba, 0xf2, 0xad, 0x19, 0xb2, 0x67, 0x36, 0xf7, 5878+ // 0x0f, 0x0a, 0x92, 0x7d, 0xe3, 0x9d, 0xe9, 0x90, 0x3e, 0x23, 0x27, 0x66, 0x13, 0xec, 0x81, 0x15, 5879+ // 0xbd, 0x22, 0xbf, 0x9f, 0x7e, 0xa9, 0x51, 0x4b, 0x4c, 0xfb, 0x02, 0xd3, 0x70, 0x86, 0x31, 0xe7, 5880+ // 0x3b, 0x05, 0x03, 0x54, 0x60, 0x48, 0x65, 0x18, 0xd2, 0xcd, 0x5f, 0x32, 0x88, 0x0e, 0x35, 0xfd 5881+ // }; 5882+ // 5883+ // private byte[] iv; 5884+ // private int parameterVersion = 58; 5885+ // 5886+ // protected byte[] engineGetEncoded() 5887+ // { 5888+ // return Arrays.clone(iv); 5889+ // } 5890+ // 5891+ // protected byte[] engineGetEncoded( 5892+ // String format) 5893+ // throws IOException 5894+ // { 5895+ // if (isASN1FormatString(format)) 5896+ // { 5897+ // if (parameterVersion == -1) 5898+ // { 5899+ // return new RC2CBCParameter(engineGetEncoded()).getEncoded(); 5900+ // } 5901+ // else 5902+ // { 5903+ // return new RC2CBCParameter(parameterVersion, engineGetEncoded()).getEncoded(); 5904+ // } 5905+ // } 5906+ // 5907+ // if (format.equals("RAW")) 5908+ // { 5909+ // return engineGetEncoded(); 5910+ // } 5911+ // 5912+ // return null; 5913+ // } 5914+ // 5915+ // protected AlgorithmParameterSpec localEngineGetParameterSpec( 5916+ // Class paramSpec) 5917+ // throws InvalidParameterSpecException 5918+ // { 5919+ // if (paramSpec == RC2ParameterSpec.class) 5920+ // { 5921+ // if (parameterVersion != -1) 5922+ // { 5923+ // if (parameterVersion < 256) 5924+ // { 5925+ // return new RC2ParameterSpec(ekb[parameterVersion], iv); 5926+ // } 5927+ // else 5928+ // { 5929+ // return new RC2ParameterSpec(parameterVersion, iv); 5930+ // } 5931+ // } 5932+ // } 5933+ // 5934+ // if (paramSpec == IvParameterSpec.class) 5935+ // { 5936+ // return new IvParameterSpec(iv); 5937+ // } 5938+ // 5939+ // throw new InvalidParameterSpecException("unknown parameter spec passed to RC2 parameters object."); 5940+ // } 5941+ // 5942+ // protected void engineInit( 5943+ // AlgorithmParameterSpec paramSpec) 5944+ // throws InvalidParameterSpecException 5945+ // { 5946+ // if (paramSpec instanceof IvParameterSpec) 5947+ // { 5948+ // this.iv = ((IvParameterSpec)paramSpec).getIV(); 5949+ // } 5950+ // else if (paramSpec instanceof RC2ParameterSpec) 5951+ // { 5952+ // int effKeyBits = ((RC2ParameterSpec)paramSpec).getEffectiveKeyBits(); 5953+ // if (effKeyBits != -1) 5954+ // { 5955+ // if (effKeyBits < 256) 5956+ // { 5957+ // parameterVersion = table[effKeyBits]; 5958+ // } 5959+ // else 5960+ // { 5961+ // parameterVersion = effKeyBits; 5962+ // } 5963+ // } 5964+ // 5965+ // this.iv = ((RC2ParameterSpec)paramSpec).getIV(); 5966+ // } 5967+ // else 5968+ // { 5969+ // throw new InvalidParameterSpecException("IvParameterSpec or RC2ParameterSpec required to initialise a RC2 parameters algorithm parameters object"); 5970+ // } 5971+ // } 5972+ // 5973+ // protected void engineInit( 5974+ // byte[] params) 5975+ // throws IOException 5976+ // { 5977+ // this.iv = Arrays.clone(params); 5978+ // } 5979+ // 5980+ // protected void engineInit( 5981+ // byte[] params, 5982+ // String format) 5983+ // throws IOException 5984+ // { 5985+ // if (isASN1FormatString(format)) 5986+ // { 5987+ // RC2CBCParameter p = RC2CBCParameter.getInstance(ASN1Object.fromByteArray(params)); 5988+ // 5989+ // if (p.getRC2ParameterVersion() != null) 5990+ // { 5991+ // parameterVersion = p.getRC2ParameterVersion().intValue(); 5992+ // } 5993+ // 5994+ // iv = p.getIV(); 5995+ // 5996+ // return; 5997+ // } 5998+ // 5999+ // if (format.equals("RAW")) 6000+ // { 6001+ // engineInit(params); 6002+ // return; 6003+ // } 6004+ // 6005+ // throw new IOException("Unknown parameters format in IV parameters object"); 6006+ // } 6007+ // 6008+ // protected String engineToString() 6009+ // { 6010+ // return "RC2 Parameters"; 6011+ // } 6012+ // } 6013+ // END android-removed 6014+ 6015 public static class PBKDF2 6016 extends JDKAlgorithmParameters 6017 { 6018@@ -429,7 +439,7 @@ 6019 extends JDKAlgorithmParameters 6020 { 6021 PKCS12PBEParams params; 6022- 6023+ 6024 protected byte[] engineGetEncoded() 6025 { 6026 try 6027@@ -441,7 +451,7 @@ 6028 throw new RuntimeException("Oooops! " + e.toString()); 6029 } 6030 } 6031- 6032+ 6033 protected byte[] engineGetEncoded( 6034 String format) 6035 { 6036@@ -449,10 +459,10 @@ 6037 { 6038 return engineGetEncoded(); 6039 } 6040- 6041+ 6042 return null; 6043 } 6044- 6045+ 6046 protected AlgorithmParameterSpec localEngineGetParameterSpec( 6047 Class paramSpec) 6048 throws InvalidParameterSpecException 6049@@ -462,10 +472,10 @@ 6050 return new PBEParameterSpec(params.getIV(), 6051 params.getIterations().intValue()); 6052 } 6053- 6054+ 6055 throw new InvalidParameterSpecException("unknown parameter spec passed to PKCS12 PBE parameters object."); 6056 } 6057- 6058+ 6059 protected void engineInit( 6060 AlgorithmParameterSpec paramSpec) 6061 throws InvalidParameterSpecException 6062@@ -474,20 +484,20 @@ 6063 { 6064 throw new InvalidParameterSpecException("PBEParameterSpec required to initialise a PKCS12 PBE parameters algorithm parameters object"); 6065 } 6066- 6067+ 6068 PBEParameterSpec pbeSpec = (PBEParameterSpec)paramSpec; 6069- 6070+ 6071 this.params = new PKCS12PBEParams(pbeSpec.getSalt(), 6072 pbeSpec.getIterationCount()); 6073 } 6074- 6075+ 6076 protected void engineInit( 6077 byte[] params) 6078 throws IOException 6079 { 6080 this.params = PKCS12PBEParams.getInstance(ASN1Object.fromByteArray(params)); 6081 } 6082- 6083+ 6084 protected void engineInit( 6085 byte[] params, 6086 String format) 6087@@ -498,10 +508,10 @@ 6088 engineInit(params); 6089 return; 6090 } 6091- 6092+ 6093 throw new IOException("Unknown parameters format in PKCS12 PBE parameters object"); 6094 } 6095- 6096+ 6097 protected String engineToString() 6098 { 6099 return "PKCS12 PBE Parameters"; 6100@@ -725,334 +735,336 @@ 6101 } 6102 } 6103 6104- public static class GOST3410 6105- extends JDKAlgorithmParameters 6106- { 6107- GOST3410ParameterSpec currentSpec; 6108- 6109- /** 6110- * Return the X.509 ASN.1 structure GOST3410Parameter. 6111- * <p> 6112- * <pre> 6113- * GOST3410Parameter ::= SEQUENCE { 6114- * prime INTEGER, -- p 6115- * subprime INTEGER, -- q 6116- * base INTEGER, -- a} 6117- * </pre> 6118- */ 6119- protected byte[] engineGetEncoded() 6120- { 6121- GOST3410PublicKeyAlgParameters gost3410P = new GOST3410PublicKeyAlgParameters(new DERObjectIdentifier(currentSpec.getPublicKeyParamSetOID()), new DERObjectIdentifier(currentSpec.getDigestParamSetOID()), new DERObjectIdentifier(currentSpec.getEncryptionParamSetOID())); 6122- 6123- try 6124- { 6125- return gost3410P.getEncoded(ASN1Encodable.DER); 6126- } 6127- catch (IOException e) 6128- { 6129- throw new RuntimeException("Error encoding GOST3410Parameters"); 6130- } 6131- } 6132- 6133- protected byte[] engineGetEncoded( 6134- String format) 6135- { 6136- if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6137- { 6138- return engineGetEncoded(); 6139- } 6140- 6141- return null; 6142- } 6143- 6144- protected AlgorithmParameterSpec localEngineGetParameterSpec( 6145- Class paramSpec) 6146- throws InvalidParameterSpecException 6147- { 6148- if (paramSpec == GOST3410PublicKeyParameterSetSpec.class) 6149- { 6150- return currentSpec; 6151- } 6152- 6153- throw new InvalidParameterSpecException("unknown parameter spec passed to GOST3410 parameters object."); 6154- } 6155- 6156- protected void engineInit( 6157- AlgorithmParameterSpec paramSpec) 6158- throws InvalidParameterSpecException 6159- { 6160- if (!(paramSpec instanceof GOST3410ParameterSpec)) 6161- { 6162- throw new InvalidParameterSpecException("GOST3410ParameterSpec required to initialise a GOST3410 algorithm parameters object"); 6163- } 6164- 6165- this.currentSpec = (GOST3410ParameterSpec)paramSpec; 6166- } 6167- 6168- protected void engineInit( 6169- byte[] params) 6170- throws IOException 6171- { 6172- try 6173- { 6174- ASN1Sequence seq = (ASN1Sequence) ASN1Object.fromByteArray(params); 6175- 6176- this.currentSpec = GOST3410ParameterSpec.fromPublicKeyAlg( 6177- new GOST3410PublicKeyAlgParameters(seq)); 6178- } 6179- catch (ClassCastException e) 6180- { 6181- throw new IOException("Not a valid GOST3410 Parameter encoding."); 6182- } 6183- catch (ArrayIndexOutOfBoundsException e) 6184- { 6185- throw new IOException("Not a valid GOST3410 Parameter encoding."); 6186- } 6187- } 6188- 6189- protected void engineInit( 6190- byte[] params, 6191- String format) 6192- throws IOException 6193- { 6194- if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6195- { 6196- engineInit(params); 6197- } 6198- else 6199- { 6200- throw new IOException("Unknown parameter format " + format); 6201- } 6202- } 6203- 6204- protected String engineToString() 6205- { 6206- return "GOST3410 Parameters"; 6207- } 6208- } 6209- 6210- public static class ElGamal 6211- extends JDKAlgorithmParameters 6212- { 6213- ElGamalParameterSpec currentSpec; 6214- 6215- /** 6216- * Return the X.509 ASN.1 structure ElGamalParameter. 6217- * <p> 6218- * <pre> 6219- * ElGamalParameter ::= SEQUENCE { 6220- * prime INTEGER, -- p 6221- * base INTEGER, -- g} 6222- * </pre> 6223- */ 6224- protected byte[] engineGetEncoded() 6225- { 6226- ElGamalParameter elP = new ElGamalParameter(currentSpec.getP(), currentSpec.getG()); 6227- 6228- try 6229- { 6230- return elP.getEncoded(ASN1Encodable.DER); 6231- } 6232- catch (IOException e) 6233- { 6234- throw new RuntimeException("Error encoding ElGamalParameters"); 6235- } 6236- } 6237- 6238- protected byte[] engineGetEncoded( 6239- String format) 6240- { 6241- if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6242- { 6243- return engineGetEncoded(); 6244- } 6245- 6246- return null; 6247- } 6248- 6249- protected AlgorithmParameterSpec localEngineGetParameterSpec( 6250- Class paramSpec) 6251- throws InvalidParameterSpecException 6252- { 6253- if (paramSpec == ElGamalParameterSpec.class) 6254- { 6255- return currentSpec; 6256- } 6257- else if (paramSpec == DHParameterSpec.class) 6258- { 6259- return new DHParameterSpec(currentSpec.getP(), currentSpec.getG()); 6260- } 6261- 6262- throw new InvalidParameterSpecException("unknown parameter spec passed to ElGamal parameters object."); 6263- } 6264- 6265- protected void engineInit( 6266- AlgorithmParameterSpec paramSpec) 6267- throws InvalidParameterSpecException 6268- { 6269- if (!(paramSpec instanceof ElGamalParameterSpec) && !(paramSpec instanceof DHParameterSpec)) 6270- { 6271- throw new InvalidParameterSpecException("DHParameterSpec required to initialise a ElGamal algorithm parameters object"); 6272- } 6273- 6274- if (paramSpec instanceof ElGamalParameterSpec) 6275- { 6276- this.currentSpec = (ElGamalParameterSpec)paramSpec; 6277- } 6278- else 6279- { 6280- DHParameterSpec s = (DHParameterSpec)paramSpec; 6281- 6282- this.currentSpec = new ElGamalParameterSpec(s.getP(), s.getG()); 6283- } 6284- } 6285- 6286- protected void engineInit( 6287- byte[] params) 6288- throws IOException 6289- { 6290- try 6291- { 6292- ElGamalParameter elP = new ElGamalParameter((ASN1Sequence)ASN1Object.fromByteArray(params)); 6293- 6294- currentSpec = new ElGamalParameterSpec(elP.getP(), elP.getG()); 6295- } 6296- catch (ClassCastException e) 6297- { 6298- throw new IOException("Not a valid ElGamal Parameter encoding."); 6299- } 6300- catch (ArrayIndexOutOfBoundsException e) 6301- { 6302- throw new IOException("Not a valid ElGamal Parameter encoding."); 6303- } 6304- } 6305- 6306- protected void engineInit( 6307- byte[] params, 6308- String format) 6309- throws IOException 6310- { 6311- if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6312- { 6313- engineInit(params); 6314- } 6315- else 6316- { 6317- throw new IOException("Unknown parameter format " + format); 6318- } 6319- } 6320- 6321- protected String engineToString() 6322- { 6323- return "ElGamal Parameters"; 6324- } 6325- } 6326- 6327- public static class IES 6328- extends JDKAlgorithmParameters 6329- { 6330- IESParameterSpec currentSpec; 6331- 6332- /** 6333- * in the absence of a standard way of doing it this will do for 6334- * now... 6335- */ 6336- protected byte[] engineGetEncoded() 6337- { 6338- try 6339- { 6340- ASN1EncodableVector v = new ASN1EncodableVector(); 6341- 6342- v.add(new DEROctetString(currentSpec.getDerivationV())); 6343- v.add(new DEROctetString(currentSpec.getEncodingV())); 6344- v.add(new DERInteger(currentSpec.getMacKeySize())); 6345- 6346- return new DERSequence(v).getEncoded(ASN1Encodable.DER); 6347- } 6348- catch (IOException e) 6349- { 6350- throw new RuntimeException("Error encoding IESParameters"); 6351- } 6352- } 6353- 6354- protected byte[] engineGetEncoded( 6355- String format) 6356- { 6357- if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6358- { 6359- return engineGetEncoded(); 6360- } 6361- 6362- return null; 6363- } 6364- 6365- protected AlgorithmParameterSpec localEngineGetParameterSpec( 6366- Class paramSpec) 6367- throws InvalidParameterSpecException 6368- { 6369- if (paramSpec == IESParameterSpec.class) 6370- { 6371- return currentSpec; 6372- } 6373- 6374- throw new InvalidParameterSpecException("unknown parameter spec passed to ElGamal parameters object."); 6375- } 6376- 6377- protected void engineInit( 6378- AlgorithmParameterSpec paramSpec) 6379- throws InvalidParameterSpecException 6380- { 6381- if (!(paramSpec instanceof IESParameterSpec)) 6382- { 6383- throw new InvalidParameterSpecException("IESParameterSpec required to initialise a IES algorithm parameters object"); 6384- } 6385- 6386- this.currentSpec = (IESParameterSpec)paramSpec; 6387- } 6388- 6389- protected void engineInit( 6390- byte[] params) 6391- throws IOException 6392- { 6393- try 6394- { 6395- ASN1Sequence s = (ASN1Sequence)ASN1Object.fromByteArray(params); 6396- 6397- this.currentSpec = new IESParameterSpec( 6398- ((ASN1OctetString)s.getObjectAt(0)).getOctets(), 6399- ((ASN1OctetString)s.getObjectAt(0)).getOctets(), 6400- ((DERInteger)s.getObjectAt(0)).getValue().intValue()); 6401- } 6402- catch (ClassCastException e) 6403- { 6404- throw new IOException("Not a valid IES Parameter encoding."); 6405- } 6406- catch (ArrayIndexOutOfBoundsException e) 6407- { 6408- throw new IOException("Not a valid IES Parameter encoding."); 6409- } 6410- } 6411- 6412- protected void engineInit( 6413- byte[] params, 6414- String format) 6415- throws IOException 6416- { 6417- if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6418- { 6419- engineInit(params); 6420- } 6421- else 6422- { 6423- throw new IOException("Unknown parameter format " + format); 6424- } 6425- } 6426- 6427- protected String engineToString() 6428- { 6429- return "IES Parameters"; 6430- } 6431- } 6432+ // BEGIN android-removed 6433+ // public static class GOST3410 6434+ // extends JDKAlgorithmParameters 6435+ // { 6436+ // GOST3410ParameterSpec currentSpec; 6437+ // 6438+ // /** 6439+ // * Return the X.509 ASN.1 structure GOST3410Parameter. 6440+ // * <p> 6441+ // * <pre> 6442+ // * GOST3410Parameter ::= SEQUENCE { 6443+ // * prime INTEGER, -- p 6444+ // * subprime INTEGER, -- q 6445+ // * base INTEGER, -- a} 6446+ // * </pre> 6447+ // */ 6448+ // protected byte[] engineGetEncoded() 6449+ // { 6450+ // GOST3410PublicKeyAlgParameters gost3410P = new GOST3410PublicKeyAlgParameters(new DERObjectIdentifier(currentSpec.getPublicKeyParamSetOID()), new DERObjectIdentifier(currentSpec.getDigestParamSetOID()), new DERObjectIdentifier(currentSpec.getEncryptionParamSetOID())); 6451+ // 6452+ // try 6453+ // { 6454+ // return gost3410P.getEncoded(ASN1Encodable.DER); 6455+ // } 6456+ // catch (IOException e) 6457+ // { 6458+ // throw new RuntimeException("Error encoding GOST3410Parameters"); 6459+ // } 6460+ // } 6461+ // 6462+ // protected byte[] engineGetEncoded( 6463+ // String format) 6464+ // { 6465+ // if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6466+ // { 6467+ // return engineGetEncoded(); 6468+ // } 6469+ // 6470+ // return null; 6471+ // } 6472+ // 6473+ // protected AlgorithmParameterSpec localEngineGetParameterSpec( 6474+ // Class paramSpec) 6475+ // throws InvalidParameterSpecException 6476+ // { 6477+ // if (paramSpec == GOST3410PublicKeyParameterSetSpec.class) 6478+ // { 6479+ // return currentSpec; 6480+ // } 6481+ // 6482+ // throw new InvalidParameterSpecException("unknown parameter spec passed to GOST3410 parameters object."); 6483+ // } 6484+ // 6485+ // protected void engineInit( 6486+ // AlgorithmParameterSpec paramSpec) 6487+ // throws InvalidParameterSpecException 6488+ // { 6489+ // if (!(paramSpec instanceof GOST3410ParameterSpec)) 6490+ // { 6491+ // throw new InvalidParameterSpecException("GOST3410ParameterSpec required to initialise a GOST3410 algorithm parameters object"); 6492+ // } 6493+ // 6494+ // this.currentSpec = (GOST3410ParameterSpec)paramSpec; 6495+ // } 6496+ // 6497+ // protected void engineInit( 6498+ // byte[] params) 6499+ // throws IOException 6500+ // { 6501+ // try 6502+ // { 6503+ // ASN1Sequence seq = (ASN1Sequence) ASN1Object.fromByteArray(params); 6504+ // 6505+ // this.currentSpec = GOST3410ParameterSpec.fromPublicKeyAlg( 6506+ // new GOST3410PublicKeyAlgParameters(seq)); 6507+ // } 6508+ // catch (ClassCastException e) 6509+ // { 6510+ // throw new IOException("Not a valid GOST3410 Parameter encoding."); 6511+ // } 6512+ // catch (ArrayIndexOutOfBoundsException e) 6513+ // { 6514+ // throw new IOException("Not a valid GOST3410 Parameter encoding."); 6515+ // } 6516+ // } 6517+ // 6518+ // protected void engineInit( 6519+ // byte[] params, 6520+ // String format) 6521+ // throws IOException 6522+ // { 6523+ // if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6524+ // { 6525+ // engineInit(params); 6526+ // } 6527+ // else 6528+ // { 6529+ // throw new IOException("Unknown parameter format " + format); 6530+ // } 6531+ // } 6532+ // 6533+ // protected String engineToString() 6534+ // { 6535+ // return "GOST3410 Parameters"; 6536+ // } 6537+ // } 6538+ 6539+ // public static class ElGamal 6540+ // extends JDKAlgorithmParameters 6541+ // { 6542+ // ElGamalParameterSpec currentSpec; 6543+ // 6544+ // /** 6545+ // * Return the X.509 ASN.1 structure ElGamalParameter. 6546+ // * <p> 6547+ // * <pre> 6548+ // * ElGamalParameter ::= SEQUENCE { 6549+ // * prime INTEGER, -- p 6550+ // * base INTEGER, -- g} 6551+ // * </pre> 6552+ // */ 6553+ // protected byte[] engineGetEncoded() 6554+ // { 6555+ // ElGamalParameter elP = new ElGamalParameter(currentSpec.getP(), currentSpec.getG()); 6556+ // 6557+ // try 6558+ // { 6559+ // return elP.getEncoded(ASN1Encodable.DER); 6560+ // } 6561+ // catch (IOException e) 6562+ // { 6563+ // throw new RuntimeException("Error encoding ElGamalParameters"); 6564+ // } 6565+ // } 6566+ // 6567+ // protected byte[] engineGetEncoded( 6568+ // String format) 6569+ // { 6570+ // if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6571+ // { 6572+ // return engineGetEncoded(); 6573+ // } 6574+ // 6575+ // return null; 6576+ // } 6577+ // 6578+ // protected AlgorithmParameterSpec localEngineGetParameterSpec( 6579+ // Class paramSpec) 6580+ // throws InvalidParameterSpecException 6581+ // { 6582+ // if (paramSpec == ElGamalParameterSpec.class) 6583+ // { 6584+ // return currentSpec; 6585+ // } 6586+ // else if (paramSpec == DHParameterSpec.class) 6587+ // { 6588+ // return new DHParameterSpec(currentSpec.getP(), currentSpec.getG()); 6589+ // } 6590+ // 6591+ // throw new InvalidParameterSpecException("unknown parameter spec passed to ElGamal parameters object."); 6592+ // } 6593+ // 6594+ // protected void engineInit( 6595+ // AlgorithmParameterSpec paramSpec) 6596+ // throws InvalidParameterSpecException 6597+ // { 6598+ // if (!(paramSpec instanceof ElGamalParameterSpec) && !(paramSpec instanceof DHParameterSpec)) 6599+ // { 6600+ // throw new InvalidParameterSpecException("DHParameterSpec required to initialise a ElGamal algorithm parameters object"); 6601+ // } 6602+ // 6603+ // if (paramSpec instanceof ElGamalParameterSpec) 6604+ // { 6605+ // this.currentSpec = (ElGamalParameterSpec)paramSpec; 6606+ // } 6607+ // else 6608+ // { 6609+ // DHParameterSpec s = (DHParameterSpec)paramSpec; 6610+ // 6611+ // this.currentSpec = new ElGamalParameterSpec(s.getP(), s.getG()); 6612+ // } 6613+ // } 6614+ // 6615+ // protected void engineInit( 6616+ // byte[] params) 6617+ // throws IOException 6618+ // { 6619+ // try 6620+ // { 6621+ // ElGamalParameter elP = new ElGamalParameter((ASN1Sequence)ASN1Object.fromByteArray(params)); 6622+ // 6623+ // currentSpec = new ElGamalParameterSpec(elP.getP(), elP.getG()); 6624+ // } 6625+ // catch (ClassCastException e) 6626+ // { 6627+ // throw new IOException("Not a valid ElGamal Parameter encoding."); 6628+ // } 6629+ // catch (ArrayIndexOutOfBoundsException e) 6630+ // { 6631+ // throw new IOException("Not a valid ElGamal Parameter encoding."); 6632+ // } 6633+ // } 6634+ // 6635+ // protected void engineInit( 6636+ // byte[] params, 6637+ // String format) 6638+ // throws IOException 6639+ // { 6640+ // if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6641+ // { 6642+ // engineInit(params); 6643+ // } 6644+ // else 6645+ // { 6646+ // throw new IOException("Unknown parameter format " + format); 6647+ // } 6648+ // } 6649+ // 6650+ // protected String engineToString() 6651+ // { 6652+ // return "ElGamal Parameters"; 6653+ // } 6654+ // } 6655+ // 6656+ // public static class IES 6657+ // extends JDKAlgorithmParameters 6658+ // { 6659+ // IESParameterSpec currentSpec; 6660+ // 6661+ // /** 6662+ // * in the absence of a standard way of doing it this will do for 6663+ // * now... 6664+ // */ 6665+ // protected byte[] engineGetEncoded() 6666+ // { 6667+ // try 6668+ // { 6669+ // ASN1EncodableVector v = new ASN1EncodableVector(); 6670+ // 6671+ // v.add(new DEROctetString(currentSpec.getDerivationV())); 6672+ // v.add(new DEROctetString(currentSpec.getEncodingV())); 6673+ // v.add(new DERInteger(currentSpec.getMacKeySize())); 6674+ // 6675+ // return new DERSequence(v).getEncoded(ASN1Encodable.DER); 6676+ // } 6677+ // catch (IOException e) 6678+ // { 6679+ // throw new RuntimeException("Error encoding IESParameters"); 6680+ // } 6681+ // } 6682+ // 6683+ // protected byte[] engineGetEncoded( 6684+ // String format) 6685+ // { 6686+ // if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6687+ // { 6688+ // return engineGetEncoded(); 6689+ // } 6690+ // 6691+ // return null; 6692+ // } 6693+ // 6694+ // protected AlgorithmParameterSpec localEngineGetParameterSpec( 6695+ // Class paramSpec) 6696+ // throws InvalidParameterSpecException 6697+ // { 6698+ // if (paramSpec == IESParameterSpec.class) 6699+ // { 6700+ // return currentSpec; 6701+ // } 6702+ // 6703+ // throw new InvalidParameterSpecException("unknown parameter spec passed to ElGamal parameters object."); 6704+ // } 6705+ // 6706+ // protected void engineInit( 6707+ // AlgorithmParameterSpec paramSpec) 6708+ // throws InvalidParameterSpecException 6709+ // { 6710+ // if (!(paramSpec instanceof IESParameterSpec)) 6711+ // { 6712+ // throw new InvalidParameterSpecException("IESParameterSpec required to initialise a IES algorithm parameters object"); 6713+ // } 6714+ // 6715+ // this.currentSpec = (IESParameterSpec)paramSpec; 6716+ // } 6717+ // 6718+ // protected void engineInit( 6719+ // byte[] params) 6720+ // throws IOException 6721+ // { 6722+ // try 6723+ // { 6724+ // ASN1Sequence s = (ASN1Sequence)ASN1Object.fromByteArray(params); 6725+ // 6726+ // this.currentSpec = new IESParameterSpec( 6727+ // ((ASN1OctetString)s.getObjectAt(0)).getOctets(), 6728+ // ((ASN1OctetString)s.getObjectAt(0)).getOctets(), 6729+ // ((DERInteger)s.getObjectAt(0)).getValue().intValue()); 6730+ // } 6731+ // catch (ClassCastException e) 6732+ // { 6733+ // throw new IOException("Not a valid IES Parameter encoding."); 6734+ // } 6735+ // catch (ArrayIndexOutOfBoundsException e) 6736+ // { 6737+ // throw new IOException("Not a valid IES Parameter encoding."); 6738+ // } 6739+ // } 6740+ // 6741+ // protected void engineInit( 6742+ // byte[] params, 6743+ // String format) 6744+ // throws IOException 6745+ // { 6746+ // if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6747+ // { 6748+ // engineInit(params); 6749+ // } 6750+ // else 6751+ // { 6752+ // throw new IOException("Unknown parameter format " + format); 6753+ // } 6754+ // } 6755+ // 6756+ // protected String engineToString() 6757+ // { 6758+ // return "IES Parameters"; 6759+ // } 6760+ // } 6761+ // END android-removed 6762 6763 public static class OAEP 6764 extends JDKAlgorithmParameters 6765@@ -1066,11 +1078,15 @@ 6766 { 6767 AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier( 6768 JCEDigestUtil.getOID(currentSpec.getDigestAlgorithm()), 6769- new DERNull()); 6770+ // BEGIN android-changed 6771+ DERNull.INSTANCE); 6772+ // END android-changed 6773 MGF1ParameterSpec mgfSpec = (MGF1ParameterSpec)currentSpec.getMGFParameters(); 6774 AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier( 6775 PKCSObjectIdentifiers.id_mgf1, 6776- new AlgorithmIdentifier(JCEDigestUtil.getOID(mgfSpec.getDigestAlgorithm()), new DERNull())); 6777+ // BEGIN android-changed 6778+ new AlgorithmIdentifier(JCEDigestUtil.getOID(mgfSpec.getDigestAlgorithm()), DERNull.INSTANCE)); 6779+ // END android-changed 6780 PSource.PSpecified pSource = (PSource.PSpecified)currentSpec.getPSource(); 6781 AlgorithmIdentifier pSourceAlgorithm = new AlgorithmIdentifier( 6782 PKCSObjectIdentifiers.id_pSpecified, new DEROctetString(pSource.getValue())); 6783@@ -1167,110 +1183,116 @@ 6784 } 6785 } 6786 6787- public static class PSS 6788- extends JDKAlgorithmParameters 6789- { 6790- PSSParameterSpec currentSpec; 6791- 6792- /** 6793- * Return the PKCS#1 ASN.1 structure RSASSA-PSS-params. 6794- */ 6795- protected byte[] engineGetEncoded() 6796- throws IOException 6797- { 6798- PSSParameterSpec pssSpec = currentSpec; 6799- AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier( 6800- JCEDigestUtil.getOID(pssSpec.getDigestAlgorithm()), 6801- new DERNull()); 6802- MGF1ParameterSpec mgfSpec = (MGF1ParameterSpec)pssSpec.getMGFParameters(); 6803- AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier( 6804- PKCSObjectIdentifiers.id_mgf1, 6805- new AlgorithmIdentifier(JCEDigestUtil.getOID(mgfSpec.getDigestAlgorithm()), new DERNull())); 6806- RSASSAPSSparams pssP = new RSASSAPSSparams(hashAlgorithm, maskGenAlgorithm, new DERInteger(pssSpec.getSaltLength()), new DERInteger(pssSpec.getTrailerField())); 6807- 6808- return pssP.getEncoded("DER"); 6809- } 6810- 6811- protected byte[] engineGetEncoded( 6812- String format) 6813- throws IOException 6814- { 6815- if (format.equalsIgnoreCase("X.509") 6816- || format.equalsIgnoreCase("ASN.1")) 6817- { 6818- return engineGetEncoded(); 6819- } 6820- 6821- return null; 6822- } 6823- 6824- protected AlgorithmParameterSpec localEngineGetParameterSpec( 6825- Class paramSpec) 6826- throws InvalidParameterSpecException 6827- { 6828- if (paramSpec == PSSParameterSpec.class && currentSpec != null) 6829- { 6830- return currentSpec; 6831- } 6832- 6833- throw new InvalidParameterSpecException("unknown parameter spec passed to PSS parameters object."); 6834- } 6835- 6836- protected void engineInit( 6837- AlgorithmParameterSpec paramSpec) 6838- throws InvalidParameterSpecException 6839- { 6840- if (!(paramSpec instanceof PSSParameterSpec)) 6841- { 6842- throw new InvalidParameterSpecException("PSSParameterSpec required to initialise an PSS algorithm parameters object"); 6843- } 6844- 6845- this.currentSpec = (PSSParameterSpec)paramSpec; 6846- } 6847- 6848- protected void engineInit( 6849- byte[] params) 6850- throws IOException 6851- { 6852- try 6853- { 6854- RSASSAPSSparams pssP = new RSASSAPSSparams((ASN1Sequence)ASN1Object.fromByteArray(params)); 6855- 6856- currentSpec = new PSSParameterSpec( 6857- pssP.getHashAlgorithm().getObjectId().getId(), 6858- pssP.getMaskGenAlgorithm().getObjectId().getId(), 6859- new MGF1ParameterSpec(AlgorithmIdentifier.getInstance(pssP.getMaskGenAlgorithm().getParameters()).getObjectId().getId()), 6860- pssP.getSaltLength().getValue().intValue(), 6861- pssP.getTrailerField().getValue().intValue()); 6862- } 6863- catch (ClassCastException e) 6864- { 6865- throw new IOException("Not a valid PSS Parameter encoding."); 6866- } 6867- catch (ArrayIndexOutOfBoundsException e) 6868- { 6869- throw new IOException("Not a valid PSS Parameter encoding."); 6870- } 6871- } 6872- 6873- protected void engineInit( 6874- byte[] params, 6875- String format) 6876- throws IOException 6877- { 6878- if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6879- { 6880- engineInit(params); 6881- } 6882- else 6883- { 6884- throw new IOException("Unknown parameter format " + format); 6885- } 6886- } 6887- 6888- protected String engineToString() 6889- { 6890- return "PSS Parameters"; 6891- } 6892- } 6893+ // BEGIN android-removed 6894+ // public static class PSS 6895+ // extends JDKAlgorithmParameters 6896+ // { 6897+ // PSSParameterSpec currentSpec; 6898+ // 6899+ // /** 6900+ // * Return the PKCS#1 ASN.1 structure RSASSA-PSS-params. 6901+ // */ 6902+ // protected byte[] engineGetEncoded() 6903+ // throws IOException 6904+ // { 6905+ // PSSParameterSpec pssSpec = currentSpec; 6906+ // AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier( 6907+ // JCEDigestUtil.getOID(pssSpec.getDigestAlgorithm()), 6908+ // // BEGIN android-changed 6909+ // DERNull.INSTANCE); 6910+ // // END android-changed 6911+ // MGF1ParameterSpec mgfSpec = (MGF1ParameterSpec)pssSpec.getMGFParameters(); 6912+ // AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier( 6913+ // PKCSObjectIdentifiers.id_mgf1, 6914+ // // BEGIN android-changed 6915+ // new AlgorithmIdentifier(JCEDigestUtil.getOID(mgfSpec.getDigestAlgorithm()), DERNull.INSTANCE)); 6916+ // // END android-changed 6917+ // RSASSAPSSparams pssP = new RSASSAPSSparams(hashAlgorithm, maskGenAlgorithm, new DERInteger(pssSpec.getSaltLength()), new DERInteger(pssSpec.getTrailerField())); 6918+ // 6919+ // return pssP.getEncoded("DER"); 6920+ // } 6921+ // 6922+ // protected byte[] engineGetEncoded( 6923+ // String format) 6924+ // throws IOException 6925+ // { 6926+ // if (format.equalsIgnoreCase("X.509") 6927+ // || format.equalsIgnoreCase("ASN.1")) 6928+ // { 6929+ // return engineGetEncoded(); 6930+ // } 6931+ // 6932+ // return null; 6933+ // } 6934+ // 6935+ // protected AlgorithmParameterSpec localEngineGetParameterSpec( 6936+ // Class paramSpec) 6937+ // throws InvalidParameterSpecException 6938+ // { 6939+ // if (paramSpec == PSSParameterSpec.class && currentSpec != null) 6940+ // { 6941+ // return currentSpec; 6942+ // } 6943+ // 6944+ // throw new InvalidParameterSpecException("unknown parameter spec passed to PSS parameters object."); 6945+ // } 6946+ // 6947+ // protected void engineInit( 6948+ // AlgorithmParameterSpec paramSpec) 6949+ // throws InvalidParameterSpecException 6950+ // { 6951+ // if (!(paramSpec instanceof PSSParameterSpec)) 6952+ // { 6953+ // throw new InvalidParameterSpecException("PSSParameterSpec required to initialise an PSS algorithm parameters object"); 6954+ // } 6955+ // 6956+ // this.currentSpec = (PSSParameterSpec)paramSpec; 6957+ // } 6958+ // 6959+ // protected void engineInit( 6960+ // byte[] params) 6961+ // throws IOException 6962+ // { 6963+ // try 6964+ // { 6965+ // RSASSAPSSparams pssP = new RSASSAPSSparams((ASN1Sequence)ASN1Object.fromByteArray(params)); 6966+ // 6967+ // currentSpec = new PSSParameterSpec( 6968+ // pssP.getHashAlgorithm().getObjectId().getId(), 6969+ // pssP.getMaskGenAlgorithm().getObjectId().getId(), 6970+ // new MGF1ParameterSpec(AlgorithmIdentifier.getInstance(pssP.getMaskGenAlgorithm().getParameters()).getObjectId().getId()), 6971+ // pssP.getSaltLength().getValue().intValue(), 6972+ // pssP.getTrailerField().getValue().intValue()); 6973+ // } 6974+ // catch (ClassCastException e) 6975+ // { 6976+ // throw new IOException("Not a valid PSS Parameter encoding."); 6977+ // } 6978+ // catch (ArrayIndexOutOfBoundsException e) 6979+ // { 6980+ // throw new IOException("Not a valid PSS Parameter encoding."); 6981+ // } 6982+ // } 6983+ // 6984+ // protected void engineInit( 6985+ // byte[] params, 6986+ // String format) 6987+ // throws IOException 6988+ // { 6989+ // if (isASN1FormatString(format) || format.equalsIgnoreCase("X.509")) 6990+ // { 6991+ // engineInit(params); 6992+ // } 6993+ // else 6994+ // { 6995+ // throw new IOException("Unknown parameter format " + format); 6996+ // } 6997+ // } 6998+ // 6999+ // protected String engineToString() 7000+ // { 7001+ // return "PSS Parameters"; 7002+ // } 7003+ // } 7004+ // END android-removed 7005 } 7006diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKDSASigner.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKDSASigner.java 7007--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKDSASigner.java 2011-02-23 20:08:56.000000000 +0000 7008+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKDSASigner.java 2012-05-11 05:31:26.630725775 +0000 7009@@ -23,13 +23,17 @@ 7010 import org.bouncycastle.crypto.Digest; 7011 import org.bouncycastle.crypto.digests.NullDigest; 7012 import org.bouncycastle.crypto.digests.SHA1Digest; 7013-import org.bouncycastle.crypto.digests.SHA224Digest; 7014+// BEGIN android-removed 7015+// import org.bouncycastle.crypto.digests.SHA224Digest; 7016+// END android-removed 7017 import org.bouncycastle.crypto.digests.SHA256Digest; 7018 import org.bouncycastle.crypto.digests.SHA384Digest; 7019 import org.bouncycastle.crypto.digests.SHA512Digest; 7020 import org.bouncycastle.crypto.params.ParametersWithRandom; 7021 import org.bouncycastle.crypto.signers.DSASigner; 7022-import org.bouncycastle.jce.interfaces.GOST3410Key; 7023+// BEGIN android-removed 7024+// import org.bouncycastle.jce.interfaces.GOST3410Key; 7025+// END android-removed 7026 7027 public class JDKDSASigner 7028 extends SignatureSpi 7029@@ -53,11 +57,16 @@ 7030 { 7031 CipherParameters param; 7032 7033- if (publicKey instanceof GOST3410Key) 7034- { 7035- param = GOST3410Util.generatePublicKeyParameter(publicKey); 7036- } 7037- else if (publicKey instanceof DSAKey) 7038+ // BEGIN android-removed 7039+ // if (publicKey instanceof GOST3410Key) 7040+ // { 7041+ // param = GOST3410Util.generatePublicKeyParameter(publicKey); 7042+ // } 7043+ // else if (publicKey instanceof DSAKey) 7044+ // END android-removed 7045+ // BEGIN android-added 7046+ if (publicKey instanceof DSAKey) 7047+ // END android-added 7048 { 7049 param = DSAUtil.generatePublicKeyParameter(publicKey); 7050 } 7051@@ -103,14 +112,18 @@ 7052 { 7053 CipherParameters param; 7054 7055- if (privateKey instanceof GOST3410Key) 7056- { 7057- param = GOST3410Util.generatePrivateKeyParameter(privateKey); 7058- } 7059- else 7060- { 7061+ // BEGIN android-removed 7062+ // if (privateKey instanceof GOST3410Key) 7063+ // { 7064+ // param = GOST3410Util.generatePrivateKeyParameter(privateKey); 7065+ // } 7066+ // else 7067+ // { 7068+ // END android-removed 7069 param = DSAUtil.generatePrivateKeyParameter(privateKey); 7070- } 7071+ // BEGIN android-removed 7072+ // } 7073+ // END android-removed 7074 7075 if (random != null) 7076 { 7077@@ -231,42 +244,44 @@ 7078 super(new SHA1Digest(), new DSASigner()); 7079 } 7080 } 7081- 7082- static public class dsa224 7083- extends JDKDSASigner 7084- { 7085- public dsa224() 7086- { 7087- super(new SHA224Digest(), new DSASigner()); 7088- } 7089- } 7090- 7091- static public class dsa256 7092- extends JDKDSASigner 7093- { 7094- public dsa256() 7095- { 7096- super(new SHA256Digest(), new DSASigner()); 7097- } 7098- } 7099 7100- static public class dsa384 7101- extends JDKDSASigner 7102- { 7103- public dsa384() 7104- { 7105- super(new SHA384Digest(), new DSASigner()); 7106- } 7107- } 7108- 7109- static public class dsa512 7110- extends JDKDSASigner 7111- { 7112- public dsa512() 7113- { 7114- super(new SHA512Digest(), new DSASigner()); 7115- } 7116- } 7117+ // BEGIN android-removed 7118+ // static public class dsa224 7119+ // extends JDKDSASigner 7120+ // { 7121+ // public dsa224() 7122+ // { 7123+ // super(new SHA224Digest(), new DSASigner()); 7124+ // } 7125+ // } 7126+ // 7127+ // static public class dsa256 7128+ // extends JDKDSASigner 7129+ // { 7130+ // public dsa256() 7131+ // { 7132+ // super(new SHA256Digest(), new DSASigner()); 7133+ // } 7134+ // } 7135+ // 7136+ // static public class dsa384 7137+ // extends JDKDSASigner 7138+ // { 7139+ // public dsa384() 7140+ // { 7141+ // super(new SHA384Digest(), new DSASigner()); 7142+ // } 7143+ // } 7144+ // 7145+ // static public class dsa512 7146+ // extends JDKDSASigner 7147+ // { 7148+ // public dsa512() 7149+ // { 7150+ // super(new SHA512Digest(), new DSASigner()); 7151+ // } 7152+ // } 7153+ // END android-removed 7154 7155 static public class noneDSA 7156 extends JDKDSASigner 7157diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKDigestSignature.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKDigestSignature.java 7158--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKDigestSignature.java 2011-02-23 20:08:56.000000000 +0000 7159+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKDigestSignature.java 2012-05-11 05:31:26.630725775 +0000 7160@@ -23,15 +23,21 @@ 7161 import org.bouncycastle.crypto.AsymmetricBlockCipher; 7162 import org.bouncycastle.crypto.CipherParameters; 7163 import org.bouncycastle.crypto.Digest; 7164-import org.bouncycastle.crypto.digests.MD2Digest; 7165-import org.bouncycastle.crypto.digests.MD4Digest; 7166+// BEGIN android-removed 7167+// import org.bouncycastle.crypto.digests.MD2Digest; 7168+// import org.bouncycastle.crypto.digests.MD4Digest; 7169+// END android-removed 7170 import org.bouncycastle.crypto.digests.MD5Digest; 7171 import org.bouncycastle.crypto.digests.NullDigest; 7172-import org.bouncycastle.crypto.digests.RIPEMD128Digest; 7173-import org.bouncycastle.crypto.digests.RIPEMD160Digest; 7174-import org.bouncycastle.crypto.digests.RIPEMD256Digest; 7175+// BEGIN android-removed 7176+// import org.bouncycastle.crypto.digests.RIPEMD128Digest; 7177+// import org.bouncycastle.crypto.digests.RIPEMD160Digest; 7178+// import org.bouncycastle.crypto.digests.RIPEMD256Digest; 7179+// END android-removed 7180 import org.bouncycastle.crypto.digests.SHA1Digest; 7181-import org.bouncycastle.crypto.digests.SHA224Digest; 7182+// BEGIN android-removed 7183+// import org.bouncycastle.crypto.digests.SHA224Digest; 7184+// END android-removed 7185 import org.bouncycastle.crypto.digests.SHA256Digest; 7186 import org.bouncycastle.crypto.digests.SHA384Digest; 7187 import org.bouncycastle.crypto.digests.SHA512Digest; 7188@@ -265,14 +271,16 @@ 7189 } 7190 } 7191 7192- static public class SHA224WithRSAEncryption 7193- extends JDKDigestSignature 7194- { 7195- public SHA224WithRSAEncryption() 7196- { 7197- super(NISTObjectIdentifiers.id_sha224, new SHA224Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7198- } 7199- } 7200+ // BEGIN android-removed 7201+ // static public class SHA224WithRSAEncryption 7202+ // extends JDKDigestSignature 7203+ // { 7204+ // public SHA224WithRSAEncryption() 7205+ // { 7206+ // super(NISTObjectIdentifiers.id_sha224, new SHA224Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7207+ // } 7208+ // } 7209+ // END android-removed 7210 7211 static public class SHA256WithRSAEncryption 7212 extends JDKDigestSignature 7213@@ -301,23 +309,25 @@ 7214 } 7215 } 7216 7217- static public class MD2WithRSAEncryption 7218- extends JDKDigestSignature 7219- { 7220- public MD2WithRSAEncryption() 7221- { 7222- super(PKCSObjectIdentifiers.md2, new MD2Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7223- } 7224- } 7225- 7226- static public class MD4WithRSAEncryption 7227- extends JDKDigestSignature 7228- { 7229- public MD4WithRSAEncryption() 7230- { 7231- super(PKCSObjectIdentifiers.md4, new MD4Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7232- } 7233- } 7234+ // BEGIN android-removed 7235+ // static public class MD2WithRSAEncryption 7236+ // extends JDKDigestSignature 7237+ // { 7238+ // public MD2WithRSAEncryption() 7239+ // { 7240+ // super(PKCSObjectIdentifiers.md2, new MD2Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7241+ // } 7242+ // } 7243+ // 7244+ // static public class MD4WithRSAEncryption 7245+ // extends JDKDigestSignature 7246+ // { 7247+ // public MD4WithRSAEncryption() 7248+ // { 7249+ // super(PKCSObjectIdentifiers.md4, new MD4Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7250+ // } 7251+ // } 7252+ // END android-removed 7253 7254 static public class MD5WithRSAEncryption 7255 extends JDKDigestSignature 7256@@ -328,39 +338,41 @@ 7257 } 7258 } 7259 7260- static public class RIPEMD160WithRSAEncryption 7261- extends JDKDigestSignature 7262- { 7263- public RIPEMD160WithRSAEncryption() 7264- { 7265- super(TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7266- } 7267- } 7268- 7269- static public class RIPEMD128WithRSAEncryption 7270- extends JDKDigestSignature 7271- { 7272- public RIPEMD128WithRSAEncryption() 7273- { 7274- super(TeleTrusTObjectIdentifiers.ripemd128, new RIPEMD128Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7275- } 7276- } 7277- 7278- static public class RIPEMD256WithRSAEncryption 7279- extends JDKDigestSignature 7280- { 7281- public RIPEMD256WithRSAEncryption() 7282- { 7283- super(TeleTrusTObjectIdentifiers.ripemd256, new RIPEMD256Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7284- } 7285- } 7286- 7287- static public class noneRSA 7288- extends JDKDigestSignature 7289- { 7290- public noneRSA() 7291- { 7292- super(new NullDigest(), new PKCS1Encoding(new RSABlindedEngine())); 7293- } 7294- } 7295+ // BEGIN android-removed 7296+ // static public class RIPEMD160WithRSAEncryption 7297+ // extends JDKDigestSignature 7298+ // { 7299+ // public RIPEMD160WithRSAEncryption() 7300+ // { 7301+ // super(TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7302+ // } 7303+ // } 7304+ // 7305+ // static public class RIPEMD128WithRSAEncryption 7306+ // extends JDKDigestSignature 7307+ // { 7308+ // public RIPEMD128WithRSAEncryption() 7309+ // { 7310+ // super(TeleTrusTObjectIdentifiers.ripemd128, new RIPEMD128Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7311+ // } 7312+ // } 7313+ // 7314+ // static public class RIPEMD256WithRSAEncryption 7315+ // extends JDKDigestSignature 7316+ // { 7317+ // public RIPEMD256WithRSAEncryption() 7318+ // { 7319+ // super(TeleTrusTObjectIdentifiers.ripemd256, new RIPEMD256Digest(), new PKCS1Encoding(new RSABlindedEngine())); 7320+ // } 7321+ // } 7322+ // 7323+ // static public class noneRSA 7324+ // extends JDKDigestSignature 7325+ // { 7326+ // public noneRSA() 7327+ // { 7328+ // super(new NullDigest(), new PKCS1Encoding(new RSABlindedEngine())); 7329+ // } 7330+ // } 7331+ // END android-removed 7332 } 7333diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKKeyFactory.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKKeyFactory.java 7334--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKKeyFactory.java 2011-02-23 20:08:56.000000000 +0000 7335+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKKeyFactory.java 2012-05-11 05:31:26.630725775 +0000 7336@@ -36,17 +36,21 @@ 7337 import org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure; 7338 import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 7339 import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 7340-import org.bouncycastle.jce.interfaces.ElGamalPrivateKey; 7341-import org.bouncycastle.jce.interfaces.ElGamalPublicKey; 7342-import org.bouncycastle.jce.spec.ElGamalPrivateKeySpec; 7343-import org.bouncycastle.jce.spec.ElGamalPublicKeySpec; 7344-import org.bouncycastle.jce.spec.GOST3410PrivateKeySpec; 7345-import org.bouncycastle.jce.spec.GOST3410PublicKeySpec; 7346+// BEGIN android-removed 7347+// import org.bouncycastle.jce.interfaces.ElGamalPrivateKey; 7348+// import org.bouncycastle.jce.interfaces.ElGamalPublicKey; 7349+// import org.bouncycastle.jce.spec.ElGamalPrivateKeySpec; 7350+// import org.bouncycastle.jce.spec.ElGamalPublicKeySpec; 7351+// import org.bouncycastle.jce.spec.GOST3410PrivateKeySpec; 7352+// import org.bouncycastle.jce.spec.GOST3410PublicKeySpec; 7353+// END android-removed 7354 7355 public abstract class JDKKeyFactory 7356 extends KeyFactorySpi 7357 { 7358- protected boolean elGamalFactory = false; 7359+ // BEGIN android-removed 7360+ // protected boolean elGamalFactory = false; 7361+ // END android-removed 7362 7363 public JDKKeyFactory() 7364 { 7365@@ -140,6 +144,20 @@ 7366 7367 return new DHPublicKeySpec(k.getY(), k.getParams().getP(), k.getParams().getG()); 7368 } 7369+ // BEGIN android-added 7370+ else if (spec.isAssignableFrom(DSAPublicKeySpec.class) && key instanceof DSAPublicKey) 7371+ { 7372+ DSAPublicKey k = (DSAPublicKey)key; 7373+ 7374+ return new DSAPublicKeySpec(k.getY(), k.getParams().getP(), k.getParams().getQ(), k.getParams().getG()); 7375+ } 7376+ else if (spec.isAssignableFrom(DSAPrivateKeySpec.class) && key instanceof DSAPrivateKey) 7377+ { 7378+ DSAPrivateKey k = (DSAPrivateKey)key; 7379+ 7380+ return new DSAPrivateKeySpec(k.getX(), k.getParams().getP(), k.getParams().getQ(), k.getParams().getG()); 7381+ } 7382+ // END android-added 7383 7384 throw new RuntimeException("not implemented yet " + key + " " + spec); 7385 } 7386@@ -162,25 +180,33 @@ 7387 } 7388 else if (key instanceof DHPublicKey) 7389 { 7390- if (elGamalFactory) 7391- { 7392- return new JCEElGamalPublicKey((DHPublicKey)key); 7393- } 7394- else 7395- { 7396+ // BEGIN android-removed 7397+ // if (elGamalFactory) 7398+ // { 7399+ // return new JCEElGamalPublicKey((DHPublicKey)key); 7400+ // } 7401+ // else 7402+ // { 7403+ // END android-removed 7404 return new JCEDHPublicKey((DHPublicKey)key); 7405- } 7406+ // BEGIN android-removed 7407+ // } 7408+ // END android-removed 7409 } 7410 else if (key instanceof DHPrivateKey) 7411 { 7412- if (elGamalFactory) 7413- { 7414- return new JCEElGamalPrivateKey((DHPrivateKey)key); 7415- } 7416- else 7417- { 7418+ // BEGIN android-removed 7419+ // if (elGamalFactory) 7420+ // { 7421+ // return new JCEElGamalPrivateKey((DHPrivateKey)key); 7422+ // } 7423+ // else 7424+ // { 7425+ // END android-removed 7426 return new JCEDHPrivateKey((DHPrivateKey)key); 7427- } 7428+ // BEGIN android-removed 7429+ // } 7430+ // END android-removed 7431 } 7432 else if (key instanceof DSAPublicKey) 7433 { 7434@@ -190,14 +216,16 @@ 7435 { 7436 return new JDKDSAPrivateKey((DSAPrivateKey)key); 7437 } 7438- else if (key instanceof ElGamalPublicKey) 7439- { 7440- return new JCEElGamalPublicKey((ElGamalPublicKey)key); 7441- } 7442- else if (key instanceof ElGamalPrivateKey) 7443- { 7444- return new JCEElGamalPrivateKey((ElGamalPrivateKey)key); 7445- } 7446+ // BEGIN android-removed 7447+ // else if (key instanceof ElGamalPublicKey) 7448+ // { 7449+ // return new JCEElGamalPublicKey((ElGamalPublicKey)key); 7450+ // } 7451+ // else if (key instanceof ElGamalPrivateKey) 7452+ // { 7453+ // return new JCEElGamalPrivateKey((ElGamalPrivateKey)key); 7454+ // } 7455+ // END android-removed 7456 7457 throw new InvalidKeyException("key type unknown"); 7458 } 7459@@ -233,10 +261,12 @@ 7460 { 7461 return new JCEDHPublicKey(info); 7462 } 7463- else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm)) 7464- { 7465- return new JCEElGamalPublicKey(info); 7466- } 7467+ // BEGIN android-removed 7468+ // else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm)) 7469+ // { 7470+ // return new JCEElGamalPublicKey(info); 7471+ // } 7472+ // END android-removed 7473 else if (algOid.equals(X9ObjectIdentifiers.id_dsa)) 7474 { 7475 return new JDKDSAPublicKey(info); 7476@@ -249,14 +279,15 @@ 7477 { 7478 return new JCEECPublicKey(info); 7479 } 7480- else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_94)) 7481- { 7482- return new JDKGOST3410PublicKey(info); 7483- } 7484- else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_2001)) 7485- { 7486- return new JCEECPublicKey(info); 7487- } 7488+ // BEGIN android-removed 7489+ // else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_94)) 7490+ // { 7491+ // return new JDKGOST3410PublicKey(info); 7492+ // } 7493+ // else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_2001)) 7494+ // { 7495+ // return new JCEECPublicKey(info); 7496+ // } 7497 else 7498 { 7499 throw new RuntimeException("algorithm identifier " + algOid + " in key not recognised"); 7500@@ -294,10 +325,12 @@ 7501 { 7502 return new JCEDHPrivateKey(info); 7503 } 7504- else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm)) 7505- { 7506- return new JCEElGamalPrivateKey(info); 7507- } 7508+ // BEGIN android-removed 7509+ // else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm)) 7510+ // { 7511+ // return new JCEElGamalPrivateKey(info); 7512+ // } 7513+ // END android-removed 7514 else if (algOid.equals(X9ObjectIdentifiers.id_dsa)) 7515 { 7516 return new JDKDSAPrivateKey(info); 7517@@ -306,14 +339,16 @@ 7518 { 7519 return new JCEECPrivateKey(info); 7520 } 7521- else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_94)) 7522- { 7523- return new JDKGOST3410PrivateKey(info); 7524- } 7525- else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_2001)) 7526- { 7527- return new JCEECPrivateKey(info); 7528- } 7529+ // BEGIN android-removed 7530+ // else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_94)) 7531+ // { 7532+ // return new JDKGOST3410PrivateKey(info); 7533+ // } 7534+ // else if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_2001)) 7535+ // { 7536+ // return new JCEECPrivateKey(info); 7537+ // } 7538+ // END android-removed 7539 else 7540 { 7541 throw new RuntimeException("algorithm identifier " + algOid + " in key not recognised"); 7542@@ -444,89 +479,92 @@ 7543 } 7544 } 7545 7546- public static class GOST3410 7547- extends JDKKeyFactory 7548- { 7549- public GOST3410() 7550- { 7551- } 7552- 7553- protected PrivateKey engineGeneratePrivate( 7554- KeySpec keySpec) 7555- throws InvalidKeySpecException 7556- { 7557- if (keySpec instanceof GOST3410PrivateKeySpec) 7558- { 7559- return new JDKGOST3410PrivateKey((GOST3410PrivateKeySpec)keySpec); 7560- } 7561- 7562- return super.engineGeneratePrivate(keySpec); 7563- } 7564- 7565- protected PublicKey engineGeneratePublic( 7566- KeySpec keySpec) 7567- throws InvalidKeySpecException 7568- { 7569- if (keySpec instanceof GOST3410PublicKeySpec) 7570- { 7571- return new JDKGOST3410PublicKey((GOST3410PublicKeySpec)keySpec); 7572- } 7573- 7574- return super.engineGeneratePublic(keySpec); 7575- } 7576- } 7577- 7578- public static class ElGamal 7579- extends JDKKeyFactory 7580- { 7581- public ElGamal() 7582- { 7583- elGamalFactory = true; 7584- } 7585- 7586- protected PrivateKey engineGeneratePrivate( 7587- KeySpec keySpec) 7588- throws InvalidKeySpecException 7589- { 7590- if (keySpec instanceof ElGamalPrivateKeySpec) 7591- { 7592- return new JCEElGamalPrivateKey((ElGamalPrivateKeySpec)keySpec); 7593- } 7594- else if (keySpec instanceof DHPrivateKeySpec) 7595- { 7596- return new JCEElGamalPrivateKey((DHPrivateKeySpec)keySpec); 7597- } 7598- 7599- return super.engineGeneratePrivate(keySpec); 7600- } 7601+ // BEGIN android-removed 7602+ // public static class GOST3410 7603+ // extends JDKKeyFactory 7604+ // { 7605+ // public GOST3410() 7606+ // { 7607+ // } 7608+ // 7609+ // protected PrivateKey engineGeneratePrivate( 7610+ // KeySpec keySpec) 7611+ // throws InvalidKeySpecException 7612+ // { 7613+ // if (keySpec instanceof GOST3410PrivateKeySpec) 7614+ // { 7615+ // return new JDKGOST3410PrivateKey((GOST3410PrivateKeySpec)keySpec); 7616+ // } 7617+ // 7618+ // return super.engineGeneratePrivate(keySpec); 7619+ // } 7620+ // 7621+ // protected PublicKey engineGeneratePublic( 7622+ // KeySpec keySpec) 7623+ // throws InvalidKeySpecException 7624+ // { 7625+ // if (keySpec instanceof GOST3410PublicKeySpec) 7626+ // { 7627+ // return new JDKGOST3410PublicKey((GOST3410PublicKeySpec)keySpec); 7628+ // } 7629+ // 7630+ // return super.engineGeneratePublic(keySpec); 7631+ // } 7632+ // } 7633 7634- protected PublicKey engineGeneratePublic( 7635- KeySpec keySpec) 7636- throws InvalidKeySpecException 7637- { 7638- if (keySpec instanceof ElGamalPublicKeySpec) 7639- { 7640- return new JCEElGamalPublicKey((ElGamalPublicKeySpec)keySpec); 7641- } 7642- else if (keySpec instanceof DHPublicKeySpec) 7643- { 7644- return new JCEElGamalPublicKey((DHPublicKeySpec)keySpec); 7645- } 7646- 7647- return super.engineGeneratePublic(keySpec); 7648- } 7649- } 7650- 7651- 7652- /** 7653- * This isn't really correct, however the class path project API seems to think such 7654- * a key factory will exist. 7655- */ 7656- public static class X509 7657- extends JDKKeyFactory 7658- { 7659- public X509() 7660- { 7661- } 7662- } 7663+ // public static class ElGamal 7664+ // extends JDKKeyFactory 7665+ // { 7666+ // public ElGamal() 7667+ // { 7668+ // elGamalFactory = true; 7669+ // } 7670+ // 7671+ // protected PrivateKey engineGeneratePrivate( 7672+ // KeySpec keySpec) 7673+ // throws InvalidKeySpecException 7674+ // { 7675+ // if (keySpec instanceof ElGamalPrivateKeySpec) 7676+ // { 7677+ // return new JCEElGamalPrivateKey((ElGamalPrivateKeySpec)keySpec); 7678+ // } 7679+ // else if (keySpec instanceof DHPrivateKeySpec) 7680+ // { 7681+ // return new JCEElGamalPrivateKey((DHPrivateKeySpec)keySpec); 7682+ // } 7683+ // 7684+ // return super.engineGeneratePrivate(keySpec); 7685+ // } 7686+ // 7687+ // protected PublicKey engineGeneratePublic( 7688+ // KeySpec keySpec) 7689+ // throws InvalidKeySpecException 7690+ // { 7691+ // if (keySpec instanceof ElGamalPublicKeySpec) 7692+ // { 7693+ // return new JCEElGamalPublicKey((ElGamalPublicKeySpec)keySpec); 7694+ // } 7695+ // else if (keySpec instanceof DHPublicKeySpec) 7696+ // { 7697+ // return new JCEElGamalPublicKey((DHPublicKeySpec)keySpec); 7698+ // } 7699+ // 7700+ // return super.engineGeneratePublic(keySpec); 7701+ // } 7702+ // } 7703+ // 7704+ // 7705+ // 7706+ // /** 7707+ // * This isn't really correct, however the class path project API seems to think such 7708+ // * a key factory will exist. 7709+ // */ 7710+ // public static class X509 7711+ // extends JDKKeyFactory 7712+ // { 7713+ // public X509() 7714+ // { 7715+ // } 7716+ // } 7717+ // END android-removed 7718 } 7719diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKKeyPairGenerator.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKKeyPairGenerator.java 7720--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKKeyPairGenerator.java 2011-02-23 20:08:56.000000000 +0000 7721+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKKeyPairGenerator.java 2012-05-11 05:31:26.630725775 +0000 7722@@ -6,9 +6,11 @@ 7723 import org.bouncycastle.crypto.generators.DHParametersGenerator; 7724 import org.bouncycastle.crypto.generators.DSAKeyPairGenerator; 7725 import org.bouncycastle.crypto.generators.DSAParametersGenerator; 7726-import org.bouncycastle.crypto.generators.ElGamalKeyPairGenerator; 7727-import org.bouncycastle.crypto.generators.ElGamalParametersGenerator; 7728-import org.bouncycastle.crypto.generators.GOST3410KeyPairGenerator; 7729+// BEGIN android-removed 7730+// import org.bouncycastle.crypto.generators.ElGamalKeyPairGenerator; 7731+// import org.bouncycastle.crypto.generators.ElGamalParametersGenerator; 7732+// import org.bouncycastle.crypto.generators.GOST3410KeyPairGenerator; 7733+// END android-removed 7734 import org.bouncycastle.crypto.generators.RSAKeyPairGenerator; 7735 import org.bouncycastle.crypto.params.DHKeyGenerationParameters; 7736 import org.bouncycastle.crypto.params.DHParameters; 7737@@ -18,20 +20,24 @@ 7738 import org.bouncycastle.crypto.params.DSAParameters; 7739 import org.bouncycastle.crypto.params.DSAPrivateKeyParameters; 7740 import org.bouncycastle.crypto.params.DSAPublicKeyParameters; 7741-import org.bouncycastle.crypto.params.ElGamalKeyGenerationParameters; 7742-import org.bouncycastle.crypto.params.ElGamalParameters; 7743-import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; 7744-import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; 7745-import org.bouncycastle.crypto.params.GOST3410KeyGenerationParameters; 7746-import org.bouncycastle.crypto.params.GOST3410Parameters; 7747-import org.bouncycastle.crypto.params.GOST3410PrivateKeyParameters; 7748-import org.bouncycastle.crypto.params.GOST3410PublicKeyParameters; 7749+// BEGIN android-removed 7750+// import org.bouncycastle.crypto.params.ElGamalKeyGenerationParameters; 7751+// import org.bouncycastle.crypto.params.ElGamalParameters; 7752+// import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; 7753+// import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; 7754+// import org.bouncycastle.crypto.params.GOST3410KeyGenerationParameters; 7755+// import org.bouncycastle.crypto.params.GOST3410Parameters; 7756+// import org.bouncycastle.crypto.params.GOST3410PrivateKeyParameters; 7757+// import org.bouncycastle.crypto.params.GOST3410PublicKeyParameters; 7758+// END android-removed 7759 import org.bouncycastle.crypto.params.RSAKeyGenerationParameters; 7760 import org.bouncycastle.crypto.params.RSAKeyParameters; 7761 import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; 7762-import org.bouncycastle.jce.spec.ElGamalParameterSpec; 7763-import org.bouncycastle.jce.spec.GOST3410ParameterSpec; 7764-import org.bouncycastle.jce.spec.GOST3410PublicKeyParameterSetSpec; 7765+// BEGIN android-removed 7766+// import org.bouncycastle.jce.spec.ElGamalParameterSpec; 7767+// import org.bouncycastle.jce.spec.GOST3410ParameterSpec; 7768+// import org.bouncycastle.jce.spec.GOST3410PublicKeyParameterSetSpec; 7769+// END android-removed 7770 7771 import java.math.BigInteger; 7772 import java.security.InvalidAlgorithmParameterException; 7773@@ -163,7 +169,9 @@ 7774 { 7775 if (!initialised) 7776 { 7777- Integer paramStrength = new Integer(strength); 7778+ // BEGIN android-changed 7779+ Integer paramStrength = Integer.valueOf(strength); 7780+ // END android-changed 7781 7782 if (params.containsKey(paramStrength)) 7783 { 7784@@ -260,139 +268,143 @@ 7785 } 7786 } 7787 7788- public static class ElGamal 7789- extends JDKKeyPairGenerator 7790- { 7791- ElGamalKeyGenerationParameters param; 7792- ElGamalKeyPairGenerator engine = new ElGamalKeyPairGenerator(); 7793- int strength = 1024; 7794- int certainty = 20; 7795- SecureRandom random = new SecureRandom(); 7796- boolean initialised = false; 7797- 7798- public ElGamal() 7799- { 7800- super("ElGamal"); 7801- } 7802- 7803- public void initialize( 7804- int strength, 7805- SecureRandom random) 7806- { 7807- this.strength = strength; 7808- this.random = random; 7809- } 7810- 7811- public void initialize( 7812- AlgorithmParameterSpec params, 7813- SecureRandom random) 7814- throws InvalidAlgorithmParameterException 7815- { 7816- if (!(params instanceof ElGamalParameterSpec) && !(params instanceof DHParameterSpec)) 7817- { 7818- throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec or an ElGamalParameterSpec"); 7819- } 7820- 7821- if (params instanceof ElGamalParameterSpec) 7822- { 7823- ElGamalParameterSpec elParams = (ElGamalParameterSpec)params; 7824- 7825- param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(elParams.getP(), elParams.getG())); 7826- } 7827- else 7828- { 7829- DHParameterSpec dhParams = (DHParameterSpec)params; 7830- 7831- param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(dhParams.getP(), dhParams.getG(), dhParams.getL())); 7832- } 7833- 7834- engine.init(param); 7835- initialised = true; 7836- } 7837- 7838- public KeyPair generateKeyPair() 7839- { 7840- if (!initialised) 7841- { 7842- ElGamalParametersGenerator pGen = new ElGamalParametersGenerator(); 7843- 7844- pGen.init(strength, certainty, random); 7845- param = new ElGamalKeyGenerationParameters(random, pGen.generateParameters()); 7846- engine.init(param); 7847- initialised = true; 7848- } 7849- 7850- AsymmetricCipherKeyPair pair = engine.generateKeyPair(); 7851- ElGamalPublicKeyParameters pub = (ElGamalPublicKeyParameters)pair.getPublic(); 7852- ElGamalPrivateKeyParameters priv = (ElGamalPrivateKeyParameters)pair.getPrivate(); 7853- 7854- return new KeyPair(new JCEElGamalPublicKey(pub), 7855- new JCEElGamalPrivateKey(priv)); 7856- } 7857- } 7858- 7859- public static class GOST3410 7860- extends JDKKeyPairGenerator 7861- { 7862- GOST3410KeyGenerationParameters param; 7863- GOST3410KeyPairGenerator engine = new GOST3410KeyPairGenerator(); 7864- GOST3410ParameterSpec gost3410Params; 7865- int strength = 1024; 7866- SecureRandom random = null; 7867- boolean initialised = false; 7868- 7869- public GOST3410() 7870- { 7871- super("GOST3410"); 7872- } 7873- 7874- public void initialize( 7875- int strength, 7876- SecureRandom random) 7877- { 7878- this.strength = strength; 7879- this.random = random; 7880- } 7881- 7882- private void init( 7883- GOST3410ParameterSpec gParams, 7884- SecureRandom random) 7885- { 7886- GOST3410PublicKeyParameterSetSpec spec = gParams.getPublicKeyParameters(); 7887- 7888- param = new GOST3410KeyGenerationParameters(random, new GOST3410Parameters(spec.getP(), spec.getQ(), spec.getA())); 7889- 7890- engine.init(param); 7891- 7892- initialised = true; 7893- gost3410Params = gParams; 7894- } 7895- 7896- public void initialize( 7897- AlgorithmParameterSpec params, 7898- SecureRandom random) 7899- throws InvalidAlgorithmParameterException 7900- { 7901- if (!(params instanceof GOST3410ParameterSpec)) 7902- { 7903- throw new InvalidAlgorithmParameterException("parameter object not a GOST3410ParameterSpec"); 7904- } 7905- 7906- init((GOST3410ParameterSpec)params, random); 7907- } 7908- 7909- public KeyPair generateKeyPair() 7910- { 7911- if (!initialised) 7912- { 7913- init(new GOST3410ParameterSpec(CryptoProObjectIdentifiers.gostR3410_94_CryptoPro_A.getId()), new SecureRandom()); 7914- } 7915- 7916- AsymmetricCipherKeyPair pair = engine.generateKeyPair(); 7917- GOST3410PublicKeyParameters pub = (GOST3410PublicKeyParameters)pair.getPublic(); 7918- GOST3410PrivateKeyParameters priv = (GOST3410PrivateKeyParameters)pair.getPrivate(); 7919- 7920- return new KeyPair(new JDKGOST3410PublicKey(pub, gost3410Params), new JDKGOST3410PrivateKey(priv, gost3410Params)); 7921- } 7922- } 7923+ // BEGIN android-removed 7924+ // public static class ElGamal 7925+ // extends JDKKeyPairGenerator 7926+ // { 7927+ // ElGamalKeyGenerationParameters param; 7928+ // ElGamalKeyPairGenerator engine = new ElGamalKeyPairGenerator(); 7929+ // int strength = 1024; 7930+ // int certainty = 20; 7931+ // SecureRandom random = new SecureRandom(); 7932+ // boolean initialised = false; 7933+ // 7934+ // public ElGamal() 7935+ // { 7936+ // super("ElGamal"); 7937+ // } 7938+ // 7939+ // public void initialize( 7940+ // int strength, 7941+ // SecureRandom random) 7942+ // { 7943+ // this.strength = strength; 7944+ // this.random = random; 7945+ // } 7946+ // 7947+ // public void initialize( 7948+ // AlgorithmParameterSpec params, 7949+ // SecureRandom random) 7950+ // throws InvalidAlgorithmParameterException 7951+ // { 7952+ // if (!(params instanceof ElGamalParameterSpec) && !(params instanceof DHParameterSpec)) 7953+ // { 7954+ // throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec or an ElGamalParameterSpec"); 7955+ // } 7956+ // 7957+ // if (params instanceof ElGamalParameterSpec) 7958+ // { 7959+ // ElGamalParameterSpec elParams = (ElGamalParameterSpec)params; 7960+ 7961+ // param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(elParams.getP(), elParams.getG())); 7962+ // } 7963+ // else 7964+ // { 7965+ // DHParameterSpec dhParams = (DHParameterSpec)params; 7966+ // 7967+ // param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(dhParams.getP(), dhParams.getG(), dhParams.getL())); 7968+ // } 7969+ // 7970+ // engine.init(param); 7971+ // initialised = true; 7972+ // } 7973+ // 7974+ // public KeyPair generateKeyPair() 7975+ // { 7976+ // if (!initialised) 7977+ // { 7978+ // ElGamalParametersGenerator pGen = new ElGamalParametersGenerator(); 7979+ // 7980+ // pGen.init(strength, certainty, random); 7981+ // param = new ElGamalKeyGenerationParameters(random, pGen.generateParameters()); 7982+ // engine.init(param); 7983+ // initialised = true; 7984+ // } 7985+ // 7986+ // AsymmetricCipherKeyPair pair = engine.generateKeyPair(); 7987+ // ElGamalPublicKeyParameters pub = (ElGamalPublicKeyParameters)pair.getPublic(); 7988+ // ElGamalPrivateKeyParameters priv = (ElGamalPrivateKeyParameters)pair.getPrivate(); 7989+ // 7990+ // return new KeyPair(new JCEElGamalPublicKey(pub), 7991+ // new JCEElGamalPrivateKey(priv)); 7992+ // } 7993+ // } 7994+ // END android-removed 7995+ 7996+ // BEGIN android-removed 7997+ // public static class GOST3410 7998+ // extends JDKKeyPairGenerator 7999+ // { 8000+ // GOST3410KeyGenerationParameters param; 8001+ // GOST3410KeyPairGenerator engine = new GOST3410KeyPairGenerator(); 8002+ // GOST3410ParameterSpec gost3410Params; 8003+ // int strength = 1024; 8004+ // SecureRandom random = null; 8005+ // boolean initialised = false; 8006+ // 8007+ // public GOST3410() 8008+ // { 8009+ // super("GOST3410"); 8010+ // } 8011+ // 8012+ // public void initialize( 8013+ // int strength, 8014+ // SecureRandom random) 8015+ // { 8016+ // this.strength = strength; 8017+ // this.random = random; 8018+ // } 8019+ // 8020+ // private void init( 8021+ // GOST3410ParameterSpec gParams, 8022+ // SecureRandom random) 8023+ // { 8024+ // GOST3410PublicKeyParameterSetSpec spec = gParams.getPublicKeyParameters(); 8025+ // 8026+ // param = new GOST3410KeyGenerationParameters(random, new GOST3410Parameters(spec.getP(), spec.getQ(), spec.getA())); 8027+ // 8028+ // engine.init(param); 8029+ // 8030+ // initialised = true; 8031+ // gost3410Params = gParams; 8032+ // } 8033+ // 8034+ // public void initialize( 8035+ // AlgorithmParameterSpec params, 8036+ // SecureRandom random) 8037+ // throws InvalidAlgorithmParameterException 8038+ // { 8039+ // if (!(params instanceof GOST3410ParameterSpec)) 8040+ // { 8041+ // throw new InvalidAlgorithmParameterException("parameter object not a GOST3410ParameterSpec"); 8042+ // } 8043+ // 8044+ // init((GOST3410ParameterSpec)params, random); 8045+ // } 8046+ // 8047+ // public KeyPair generateKeyPair() 8048+ // { 8049+ // if (!initialised) 8050+ // { 8051+ // init(new GOST3410ParameterSpec(CryptoProObjectIdentifiers.gostR3410_94_CryptoPro_A.getId()), new SecureRandom()); 8052+ // } 8053+ // 8054+ // AsymmetricCipherKeyPair pair = engine.generateKeyPair(); 8055+ // GOST3410PublicKeyParameters pub = (GOST3410PublicKeyParameters)pair.getPublic(); 8056+ // GOST3410PrivateKeyParameters priv = (GOST3410PrivateKeyParameters)pair.getPrivate(); 8057+ // 8058+ // return new KeyPair(new JDKGOST3410PublicKey(pub, gost3410Params), new JDKGOST3410PrivateKey(priv, gost3410Params)); 8059+ // } 8060+ // } 8061+ // END android-removed 8062 } 8063diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKKeyStore.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKKeyStore.java 8064--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKKeyStore.java 2011-02-23 20:08:56.000000000 +0000 8065+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKKeyStore.java 2012-05-11 05:31:26.630725775 +0000 8066@@ -39,7 +39,12 @@ 8067 import org.bouncycastle.crypto.CipherParameters; 8068 import org.bouncycastle.crypto.Digest; 8069 import org.bouncycastle.crypto.PBEParametersGenerator; 8070-import org.bouncycastle.crypto.digests.SHA1Digest; 8071+// BEGIN android-added 8072+import org.bouncycastle.crypto.digests.OpenSSLDigest; 8073+// END android-added 8074+// BEGIN android-removed 8075+// import org.bouncycastle.crypto.digests.SHA1Digest; 8076+// END android-removed 8077 import org.bouncycastle.crypto.generators.PKCS12ParametersGenerator; 8078 import org.bouncycastle.crypto.io.DigestInputStream; 8079 import org.bouncycastle.crypto.io.DigestOutputStream; 8080@@ -442,6 +447,7 @@ 8081 } 8082 catch (Exception e) 8083 { 8084+ 8085 throw new IOException("Exception creating key: " + e.toString()); 8086 } 8087 } 8088@@ -497,7 +503,13 @@ 8089 8090 if (entry == null) 8091 { 8092- throw new KeyStoreException("no such entry as " + alias); 8093+ // BEGIN android-removed 8094+ // Only throw if there is a problem removing, not if missing 8095+ // throw new KeyStoreException("no such entry as " + alias); 8096+ // END android-removed 8097+ // BEGIN android-added 8098+ return; 8099+ // END android-added 8100 } 8101 8102 table.remove(alias); 8103@@ -810,12 +822,16 @@ 8104 // 8105 // we only do an integrity check if the password is provided. 8106 // 8107- HMac hMac = new HMac(new SHA1Digest()); 8108+ // BEGIN android-changed 8109+ HMac hMac = new HMac(new OpenSSLDigest.SHA1()); 8110+ // END android-changed 8111 if (password != null && password.length != 0) 8112 { 8113 byte[] passKey = PBEParametersGenerator.PKCS12PasswordToBytes(password); 8114 8115- PBEParametersGenerator pbeGen = new PKCS12ParametersGenerator(new SHA1Digest()); 8116+ // BEGIN android-changed 8117+ PBEParametersGenerator pbeGen = new PKCS12ParametersGenerator(new OpenSSLDigest.SHA1()); 8118+ // END android-changed 8119 pbeGen.init(passKey, salt, iterationCount); 8120 CipherParameters macParams = pbeGen.generateDerivedMacParameters(hMac.getMacSize()); 8121 Arrays.fill(passKey, (byte)0); 8122@@ -866,9 +882,11 @@ 8123 dOut.write(salt); 8124 dOut.writeInt(iterationCount); 8125 8126- HMac hMac = new HMac(new SHA1Digest()); 8127+ // BEGIN android-changed 8128+ HMac hMac = new HMac(new OpenSSLDigest.SHA1()); 8129 MacOutputStream mOut = new MacOutputStream(dOut, hMac); 8130- PBEParametersGenerator pbeGen = new PKCS12ParametersGenerator(new SHA1Digest()); 8131+ PBEParametersGenerator pbeGen = new PKCS12ParametersGenerator(new OpenSSLDigest.SHA1()); 8132+ // END android-changed 8133 byte[] passKey = PBEParametersGenerator.PKCS12PasswordToBytes(password); 8134 8135 pbeGen.init(passKey, salt, iterationCount); 8136@@ -956,7 +974,9 @@ 8137 Cipher cipher = this.makePBECipher(cipherAlg, Cipher.DECRYPT_MODE, password, salt, iterationCount); 8138 CipherInputStream cIn = new CipherInputStream(dIn, cipher); 8139 8140- Digest dig = new SHA1Digest(); 8141+ // BEGIN android-changed 8142+ Digest dig = new OpenSSLDigest.SHA1(); 8143+ // END android-changed 8144 DigestInputStream dgIn = new DigestInputStream(cIn, dig); 8145 8146 this.loadStore(dgIn); 8147@@ -996,8 +1016,9 @@ 8148 cipher = this.makePBECipher(STORE_CIPHER, Cipher.ENCRYPT_MODE, password, salt, iterationCount); 8149 8150 CipherOutputStream cOut = new CipherOutputStream(dOut, cipher); 8151- DigestOutputStream dgOut = new DigestOutputStream(cOut, new SHA1Digest()); 8152- 8153+ // BEGIN android-changed 8154+ DigestOutputStream dgOut = new DigestOutputStream(cOut, new OpenSSLDigest.SHA1()); 8155+ // END android-changed 8156 this.saveStore(dgOut); 8157 8158 Digest dig = dgOut.getDigest(); 8159@@ -1009,5 +1030,5 @@ 8160 8161 cOut.close(); 8162 } 8163- } 8164+ } 8165 } 8166diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKMessageDigest.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKMessageDigest.java 8167--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKMessageDigest.java 2011-02-23 20:08:56.000000000 +0000 8168+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKMessageDigest.java 2012-05-11 05:31:26.630725775 +0000 8169@@ -57,36 +57,38 @@ 8170 { 8171 super(new SHA1Digest()); 8172 } 8173- 8174+ 8175 public Object clone() 8176 throws CloneNotSupportedException 8177 { 8178 SHA1 d = (SHA1)super.clone(); 8179 d.digest = new SHA1Digest((SHA1Digest)digest); 8180- 8181- return d; 8182- } 8183- } 8184- 8185- static public class SHA224 8186- extends JDKMessageDigest 8187- implements Cloneable 8188- { 8189- public SHA224() 8190- { 8191- super(new SHA224Digest()); 8192- } 8193- 8194- public Object clone() 8195- throws CloneNotSupportedException 8196- { 8197- SHA224 d = (SHA224)super.clone(); 8198- d.digest = new SHA224Digest((SHA224Digest)digest); 8199- 8200+ 8201 return d; 8202 } 8203 } 8204- 8205+ 8206+ // BEGIN android-removed 8207+ // static public class SHA224 8208+ // extends JDKMessageDigest 8209+ // implements Cloneable 8210+ // { 8211+ // public SHA224() 8212+ // { 8213+ // super(new SHA224Digest()); 8214+ // } 8215+ // 8216+ // public Object clone() 8217+ // throws CloneNotSupportedException 8218+ // { 8219+ // SHA224 d = (SHA224)super.clone(); 8220+ // d.digest = new SHA224Digest((SHA224Digest)digest); 8221+ // 8222+ // return d; 8223+ // } 8224+ // } 8225+ // END android-removed 8226+ 8227 static public class SHA256 8228 extends JDKMessageDigest 8229 implements Cloneable 8230@@ -95,13 +97,13 @@ 8231 { 8232 super(new SHA256Digest()); 8233 } 8234- 8235+ 8236 public Object clone() 8237 throws CloneNotSupportedException 8238 { 8239 SHA256 d = (SHA256)super.clone(); 8240 d.digest = new SHA256Digest((SHA256Digest)digest); 8241- 8242+ 8243 return d; 8244 } 8245 } 8246@@ -144,43 +146,45 @@ 8247 } 8248 } 8249 8250- static public class MD2 8251- extends JDKMessageDigest 8252- implements Cloneable 8253- { 8254- public MD2() 8255- { 8256- super(new MD2Digest()); 8257- } 8258- 8259- public Object clone() 8260- throws CloneNotSupportedException 8261- { 8262- MD2 d = (MD2)super.clone(); 8263- d.digest = new MD2Digest((MD2Digest)digest); 8264- 8265- return d; 8266- } 8267- } 8268- 8269- static public class MD4 8270- extends JDKMessageDigest 8271- implements Cloneable 8272- { 8273- public MD4() 8274- { 8275- super(new MD4Digest()); 8276- } 8277- 8278- public Object clone() 8279- throws CloneNotSupportedException 8280- { 8281- MD4 d = (MD4)super.clone(); 8282- d.digest = new MD4Digest((MD4Digest)digest); 8283- 8284- return d; 8285- } 8286- } 8287+ // BEGIN android-removed 8288+ // static public class MD2 8289+ // extends JDKMessageDigest 8290+ // implements Cloneable 8291+ // { 8292+ // public MD2() 8293+ // { 8294+ // super(new MD2Digest()); 8295+ // } 8296+ // 8297+ // public Object clone() 8298+ // throws CloneNotSupportedException 8299+ // { 8300+ // MD2 d = (MD2)super.clone(); 8301+ // d.digest = new MD2Digest((MD2Digest)digest); 8302+ // 8303+ // return d; 8304+ // } 8305+ // } 8306+ // 8307+ // static public class MD4 8308+ // extends JDKMessageDigest 8309+ // implements Cloneable 8310+ // { 8311+ // public MD4() 8312+ // { 8313+ // super(new MD4Digest()); 8314+ // } 8315+ // 8316+ // public Object clone() 8317+ // throws CloneNotSupportedException 8318+ // { 8319+ // MD4 d = (MD4)super.clone(); 8320+ // d.digest = new MD4Digest((MD4Digest)digest); 8321+ // 8322+ // return d; 8323+ // } 8324+ // } 8325+ // END android-removed 8326 8327 static public class MD5 8328 extends JDKMessageDigest 8329@@ -190,147 +194,149 @@ 8330 { 8331 super(new MD5Digest()); 8332 } 8333- 8334+ 8335 public Object clone() 8336 throws CloneNotSupportedException 8337 { 8338 MD5 d = (MD5)super.clone(); 8339 d.digest = new MD5Digest((MD5Digest)digest); 8340- 8341- return d; 8342- } 8343- } 8344- 8345- static public class RIPEMD128 8346- extends JDKMessageDigest 8347- implements Cloneable 8348- { 8349- public RIPEMD128() 8350- { 8351- super(new RIPEMD128Digest()); 8352- } 8353- 8354- public Object clone() 8355- throws CloneNotSupportedException 8356- { 8357- RIPEMD128 d = (RIPEMD128)super.clone(); 8358- d.digest = new RIPEMD128Digest((RIPEMD128Digest)digest); 8359- 8360+ 8361 return d; 8362 } 8363 } 8364 8365- static public class RIPEMD160 8366- extends JDKMessageDigest 8367- implements Cloneable 8368- { 8369- public RIPEMD160() 8370- { 8371- super(new RIPEMD160Digest()); 8372- } 8373- 8374- public Object clone() 8375- throws CloneNotSupportedException 8376- { 8377- RIPEMD160 d = (RIPEMD160)super.clone(); 8378- d.digest = new RIPEMD160Digest((RIPEMD160Digest)digest); 8379- 8380- return d; 8381- } 8382- } 8383- 8384- static public class RIPEMD256 8385- extends JDKMessageDigest 8386- implements Cloneable 8387- { 8388- public RIPEMD256() 8389- { 8390- super(new RIPEMD256Digest()); 8391- } 8392- 8393- public Object clone() 8394- throws CloneNotSupportedException 8395- { 8396- RIPEMD256 d = (RIPEMD256)super.clone(); 8397- d.digest = new RIPEMD256Digest((RIPEMD256Digest)digest); 8398- 8399- return d; 8400- } 8401- } 8402- 8403- static public class RIPEMD320 8404- extends JDKMessageDigest 8405- implements Cloneable 8406- { 8407- public RIPEMD320() 8408- { 8409- super(new RIPEMD320Digest()); 8410- } 8411- 8412- public Object clone() 8413- throws CloneNotSupportedException 8414- { 8415- RIPEMD320 d = (RIPEMD320)super.clone(); 8416- d.digest = new RIPEMD320Digest((RIPEMD320Digest)digest); 8417- 8418- return d; 8419- } 8420- } 8421- 8422- static public class Tiger 8423- extends JDKMessageDigest 8424- implements Cloneable 8425- { 8426- public Tiger() 8427- { 8428- super(new TigerDigest()); 8429- } 8430- 8431- public Object clone() 8432- throws CloneNotSupportedException 8433- { 8434- Tiger d = (Tiger)super.clone(); 8435- d.digest = new TigerDigest((TigerDigest)digest); 8436- 8437- return d; 8438- } 8439- } 8440- 8441- static public class GOST3411 8442- extends JDKMessageDigest 8443- implements Cloneable 8444- { 8445- public GOST3411() 8446- { 8447- super(new GOST3411Digest()); 8448- } 8449- 8450- public Object clone() 8451- throws CloneNotSupportedException 8452- { 8453- GOST3411 d = (GOST3411)super.clone(); 8454- d.digest = new GOST3411Digest((GOST3411Digest)digest); 8455- 8456- return d; 8457- } 8458- } 8459- 8460- static public class Whirlpool 8461- extends JDKMessageDigest 8462- implements Cloneable 8463- { 8464- public Whirlpool() 8465- { 8466- super(new WhirlpoolDigest()); 8467- } 8468- 8469- public Object clone() 8470- throws CloneNotSupportedException 8471- { 8472- Whirlpool d = (Whirlpool)super.clone(); 8473- d.digest = new WhirlpoolDigest((WhirlpoolDigest)digest); 8474- 8475- return d; 8476- } 8477- } 8478+ // BEGIN android-removed 8479+ // static public class RIPEMD128 8480+ // extends JDKMessageDigest 8481+ // implements Cloneable 8482+ // { 8483+ // public RIPEMD128() 8484+ // { 8485+ // super(new RIPEMD128Digest()); 8486+ // } 8487+ // 8488+ // public Object clone() 8489+ // throws CloneNotSupportedException 8490+ // { 8491+ // RIPEMD128 d = (RIPEMD128)super.clone(); 8492+ // d.digest = new RIPEMD128Digest((RIPEMD128Digest)digest); 8493+ // 8494+ // return d; 8495+ // } 8496+ // } 8497+ // 8498+ // static public class RIPEMD160 8499+ // extends JDKMessageDigest 8500+ // implements Cloneable 8501+ // { 8502+ // public RIPEMD160() 8503+ // { 8504+ // super(new RIPEMD160Digest()); 8505+ // } 8506+ // 8507+ // public Object clone() 8508+ // throws CloneNotSupportedException 8509+ // { 8510+ // RIPEMD160 d = (RIPEMD160)super.clone(); 8511+ // d.digest = new RIPEMD160Digest((RIPEMD160Digest)digest); 8512+ // 8513+ // return d; 8514+ // } 8515+ // } 8516+ // 8517+ // static public class RIPEMD256 8518+ // extends JDKMessageDigest 8519+ // implements Cloneable 8520+ // { 8521+ // public RIPEMD256() 8522+ // { 8523+ // super(new RIPEMD256Digest()); 8524+ // } 8525+ // 8526+ // public Object clone() 8527+ // throws CloneNotSupportedException 8528+ // { 8529+ // RIPEMD256 d = (RIPEMD256)super.clone(); 8530+ // d.digest = new RIPEMD256Digest((RIPEMD256Digest)digest); 8531+ // 8532+ // return d; 8533+ // } 8534+ // } 8535+ // 8536+ // static public class RIPEMD320 8537+ // extends JDKMessageDigest 8538+ // implements Cloneable 8539+ // { 8540+ // public RIPEMD320() 8541+ // { 8542+ // super(new RIPEMD320Digest()); 8543+ // } 8544+ // 8545+ // public Object clone() 8546+ // throws CloneNotSupportedException 8547+ // { 8548+ // RIPEMD320 d = (RIPEMD320)super.clone(); 8549+ // d.digest = new RIPEMD320Digest((RIPEMD320Digest)digest); 8550+ // 8551+ // return d; 8552+ // } 8553+ // } 8554+ // 8555+ // static public class Tiger 8556+ // extends JDKMessageDigest 8557+ // implements Cloneable 8558+ // { 8559+ // public Tiger() 8560+ // { 8561+ // super(new TigerDigest()); 8562+ // } 8563+ // 8564+ // public Object clone() 8565+ // throws CloneNotSupportedException 8566+ // { 8567+ // Tiger d = (Tiger)super.clone(); 8568+ // d.digest = new TigerDigest((TigerDigest)digest); 8569+ // 8570+ // return d; 8571+ // } 8572+ // } 8573+ // 8574+ // static public class GOST3411 8575+ // extends JDKMessageDigest 8576+ // implements Cloneable 8577+ // { 8578+ // public GOST3411() 8579+ // { 8580+ // super(new GOST3411Digest()); 8581+ // } 8582+ // 8583+ // public Object clone() 8584+ // throws CloneNotSupportedException 8585+ // { 8586+ // GOST3411 d = (GOST3411)super.clone(); 8587+ // d.digest = new GOST3411Digest((GOST3411Digest)digest); 8588+ // 8589+ // return d; 8590+ // } 8591+ // } 8592+ // 8593+ // static public class Whirlpool 8594+ // extends JDKMessageDigest 8595+ // implements Cloneable 8596+ // { 8597+ // public Whirlpool() 8598+ // { 8599+ // super(new WhirlpoolDigest()); 8600+ // } 8601+ // 8602+ // public Object clone() 8603+ // throws CloneNotSupportedException 8604+ // { 8605+ // Whirlpool d = (Whirlpool)super.clone(); 8606+ // d.digest = new WhirlpoolDigest((WhirlpoolDigest)digest); 8607+ // 8608+ // return d; 8609+ // } 8610+ // } 8611+ // END android-removed 8612 } 8613diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKPKCS12KeyStore.java bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKPKCS12KeyStore.java 8614--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/JDKPKCS12KeyStore.java 2011-02-23 20:08:56.000000000 +0000 8615+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/JDKPKCS12KeyStore.java 2012-05-11 05:31:26.630725775 +0000 8616@@ -260,10 +260,13 @@ 8617 } 8618 } 8619 8620- if (c == null && k == null) 8621- { 8622- throw new KeyStoreException("no such entry as " + alias); 8623- } 8624+ // BEGIN android-removed 8625+ // Only throw if there is a problem removing, not if missing 8626+ // if (c == null && k == null) 8627+ // { 8628+ // throw new KeyStoreException("no such entry as " + alias); 8629+ // } 8630+ // END android-removed 8631 } 8632 8633 /** 8634@@ -438,6 +441,14 @@ 8635 8636 public Date engineGetCreationDate(String alias) 8637 { 8638+ // BEGIN android-added 8639+ if (alias == null) { 8640+ throw new NullPointerException("alias == null"); 8641+ } 8642+ if (keys.get(alias) == null && certs.get(alias) == null) { 8643+ return null; 8644+ } 8645+ // END android-added 8646 return new Date(); 8647 } 8648 8649@@ -496,6 +507,11 @@ 8650 Certificate[] chain) 8651 throws KeyStoreException 8652 { 8653+ // BEGIN android-added 8654+ if (!(key instanceof PrivateKey)) { 8655+ throw new KeyStoreException("PKCS12 does not support non-PrivateKeys"); 8656+ } 8657+ // END android-added 8658 if ((key instanceof PrivateKey) && (chain == null)) 8659 { 8660 throw new KeyStoreException("no certificate chain for private key"); 8661@@ -507,12 +523,18 @@ 8662 } 8663 8664 keys.put(alias, key); 8665+ // BEGIN android-added 8666+ if (chain != null) { 8667+ // END android-added 8668 certs.put(alias, chain[0]); 8669 8670 for (int i = 0; i != chain.length; i++) 8671 { 8672 chainCerts.put(new CertId(chain[i].getPublicKey()), chain[i]); 8673 } 8674+ // BEGIN android-added 8675+ } 8676+ // END android-added 8677 } 8678 8679 public int engineSize() 8680@@ -1488,7 +1510,9 @@ 8681 { 8682 byte[] res = calculatePbeMac(id_SHA1, mSalt, itCount, password, false, data); 8683 8684- AlgorithmIdentifier algId = new AlgorithmIdentifier(id_SHA1, new DERNull()); 8685+ // BEGIN android-changed 8686+ AlgorithmIdentifier algId = new AlgorithmIdentifier(id_SHA1, DERNull.INSTANCE); 8687+ // END android-changed 8688 DigestInfo dInfo = new DigestInfo(algId, res); 8689 8690 mData = new MacData(dInfo, mSalt, itCount); 8691@@ -1545,32 +1569,34 @@ 8692 } 8693 } 8694 8695- public static class BCPKCS12KeyStore3DES 8696- extends JDKPKCS12KeyStore 8697- { 8698- public BCPKCS12KeyStore3DES() 8699- { 8700- super(bcProvider, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 8701- } 8702- } 8703- 8704- public static class DefPKCS12KeyStore 8705- extends JDKPKCS12KeyStore 8706- { 8707- public DefPKCS12KeyStore() 8708- { 8709- super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbewithSHAAnd40BitRC2_CBC); 8710- } 8711- } 8712- 8713- public static class DefPKCS12KeyStore3DES 8714- extends JDKPKCS12KeyStore 8715- { 8716- public DefPKCS12KeyStore3DES() 8717- { 8718- super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 8719- } 8720- } 8721+ // BEGIN android-removed 8722+ // public static class BCPKCS12KeyStore3DES 8723+ // extends JDKPKCS12KeyStore 8724+ // { 8725+ // public BCPKCS12KeyStore3DES() 8726+ // { 8727+ // super(bcProvider, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 8728+ // } 8729+ // } 8730+ // 8731+ // public static class DefPKCS12KeyStore 8732+ // extends JDKPKCS12KeyStore 8733+ // { 8734+ // public DefPKCS12KeyStore() 8735+ // { 8736+ // super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbewithSHAAnd40BitRC2_CBC); 8737+ // } 8738+ // } 8739+ // 8740+ // public static class DefPKCS12KeyStore3DES 8741+ // extends JDKPKCS12KeyStore 8742+ // { 8743+ // public DefPKCS12KeyStore3DES() 8744+ // { 8745+ // super(null, pbeWithSHAAnd3_KeyTripleDES_CBC, pbeWithSHAAnd3_KeyTripleDES_CBC); 8746+ // } 8747+ // } 8748+ // END android-removed 8749 8750 private static class IgnoresCaseHashtable 8751 { 8752@@ -1579,7 +1605,7 @@ 8753 8754 public void put(String key, Object value) 8755 { 8756- String lower = Strings.toLowerCase(key); 8757+ String lower = (key == null) ? null : Strings.toLowerCase(key); 8758 String k = (String)keys.get(lower); 8759 if (k != null) 8760 { 8761@@ -1597,7 +1623,9 @@ 8762 8763 public Object remove(String alias) 8764 { 8765- String k = (String)keys.remove(Strings.toLowerCase(alias)); 8766+ // BEGIN android-changed 8767+ String k = (String)keys.remove(alias == null ? null : Strings.toLowerCase(alias)); 8768+ // END android-changed 8769 if (k == null) 8770 { 8771 return null; 8772@@ -1608,7 +1636,9 @@ 8773 8774 public Object get(String alias) 8775 { 8776- String k = (String)keys.get(Strings.toLowerCase(alias)); 8777+ // BEGIN android-changed 8778+ String k = (String)keys.get(alias == null ? null : Strings.toLowerCase(alias)); 8779+ // END android-changed 8780 if (k == null) 8781 { 8782 return null; 8783diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PBE.java bcprov-jdk16-146/org/bouncycastle/jce/provider/PBE.java 8784--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PBE.java 2011-02-23 20:08:56.000000000 +0000 8785+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/PBE.java 2012-05-11 05:31:26.630725775 +0000 8786@@ -7,12 +7,18 @@ 8787 8788 import org.bouncycastle.crypto.CipherParameters; 8789 import org.bouncycastle.crypto.PBEParametersGenerator; 8790-import org.bouncycastle.crypto.digests.MD2Digest; 8791+// BEGIN android-removed 8792+// import org.bouncycastle.crypto.digests.MD2Digest; 8793+// END android-removed 8794 import org.bouncycastle.crypto.digests.MD5Digest; 8795-import org.bouncycastle.crypto.digests.RIPEMD160Digest; 8796+// BEGIN android-removed 8797+// import org.bouncycastle.crypto.digests.RIPEMD160Digest; 8798+// END android-removed 8799 import org.bouncycastle.crypto.digests.SHA1Digest; 8800 import org.bouncycastle.crypto.digests.SHA256Digest; 8801-import org.bouncycastle.crypto.digests.TigerDigest; 8802+// BEGIN android-removed 8803+// import org.bouncycastle.crypto.digests.TigerDigest; 8804+// END android-removed 8805 import org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator; 8806 import org.bouncycastle.crypto.generators.PKCS12ParametersGenerator; 8807 import org.bouncycastle.crypto.generators.PKCS5S1ParametersGenerator; 8808@@ -53,9 +59,11 @@ 8809 { 8810 switch (hash) 8811 { 8812- case MD2: 8813- generator = new PKCS5S1ParametersGenerator(new MD2Digest()); 8814- break; 8815+ // BEGIN android-removed 8816+ // case MD2: 8817+ // generator = new PKCS5S1ParametersGenerator(new MD2Digest()); 8818+ // break; 8819+ // END android-removed 8820 case MD5: 8821 generator = new PKCS5S1ParametersGenerator(new MD5Digest()); 8822 break; 8823@@ -74,21 +82,25 @@ 8824 { 8825 switch (hash) 8826 { 8827- case MD2: 8828- generator = new PKCS12ParametersGenerator(new MD2Digest()); 8829- break; 8830+ // BEGIN android-removed 8831+ // case MD2: 8832+ // generator = new PKCS12ParametersGenerator(new MD2Digest()); 8833+ // break; 8834+ // END android-removed 8835 case MD5: 8836 generator = new PKCS12ParametersGenerator(new MD5Digest()); 8837 break; 8838 case SHA1: 8839 generator = new PKCS12ParametersGenerator(new SHA1Digest()); 8840 break; 8841- case RIPEMD160: 8842- generator = new PKCS12ParametersGenerator(new RIPEMD160Digest()); 8843- break; 8844- case TIGER: 8845- generator = new PKCS12ParametersGenerator(new TigerDigest()); 8846- break; 8847+ // BEGIN android-removed 8848+ // case RIPEMD160: 8849+ // generator = new PKCS12ParametersGenerator(new RIPEMD160Digest()); 8850+ // break; 8851+ // case TIGER: 8852+ // generator = new PKCS12ParametersGenerator(new TigerDigest()); 8853+ // break; 8854+ // END android-removed 8855 case SHA256: 8856 generator = new PKCS12ParametersGenerator(new SHA256Digest()); 8857 break; 8858diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PKIXCertPath.java bcprov-jdk16-146/org/bouncycastle/jce/provider/PKIXCertPath.java 8859--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PKIXCertPath.java 2011-02-23 20:08:56.000000000 +0000 8860+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/PKIXCertPath.java 2012-05-11 05:31:26.630725775 +0000 8861@@ -33,7 +33,9 @@ 8862 import org.bouncycastle.asn1.pkcs.ContentInfo; 8863 import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 8864 import org.bouncycastle.asn1.pkcs.SignedData; 8865-import org.bouncycastle.openssl.PEMWriter; 8866+// BEGIN android-removed 8867+// import org.bouncycastle.openssl.PEMWriter; 8868+// END android-removed 8869 8870 /** 8871 * CertPath implementation for X.509 certificates. 8872@@ -295,27 +297,29 @@ 8873 return toDEREncoded(new ContentInfo( 8874 PKCSObjectIdentifiers.signedData, sd)); 8875 } 8876- else if (encoding.equalsIgnoreCase("PEM")) 8877- { 8878- ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 8879- PEMWriter pWrt = new PEMWriter(new OutputStreamWriter(bOut)); 8880- 8881- try 8882- { 8883- for (int i = 0; i != certificates.size(); i++) 8884- { 8885- pWrt.writeObject(certificates.get(i)); 8886- } 8887- 8888- pWrt.close(); 8889- } 8890- catch (Exception e) 8891- { 8892- throw new CertificateEncodingException("can't encode certificate for PEM encoded path"); 8893- } 8894- 8895- return bOut.toByteArray(); 8896- } 8897+ // BEGIN android-removed 8898+ // else if (encoding.equalsIgnoreCase("PEM")) 8899+ // { 8900+ // ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 8901+ // PEMWriter pWrt = new PEMWriter(new OutputStreamWriter(bOut)); 8902+ // 8903+ // try 8904+ // { 8905+ // for (int i = 0; i != certificates.size(); i++) 8906+ // { 8907+ // pWrt.writeObject(certificates.get(i)); 8908+ // } 8909+ // 8910+ // pWrt.close(); 8911+ // } 8912+ // catch (Exception e) 8913+ // { 8914+ // throw new CertificateEncodingException("can't encode certificate for PEM encoded path"); 8915+ // } 8916+ // 8917+ // return bOut.toByteArray(); 8918+ // } 8919+ // END android-removed 8920 else 8921 { 8922 throw new CertificateEncodingException("unsupported encoding: " + encoding); 8923diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java bcprov-jdk16-146/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java 8924--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java 2011-02-23 20:08:56.000000000 +0000 8925+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java 2012-05-11 05:31:26.630725775 +0000 8926@@ -1,5 +1,8 @@ 8927 package org.bouncycastle.jce.provider; 8928 8929+// BEGIN android-added 8930+import java.math.BigInteger; 8931+// END android-added 8932 import java.security.InvalidAlgorithmParameterException; 8933 import java.security.PublicKey; 8934 import java.security.cert.CertPath; 8935@@ -13,6 +16,7 @@ 8936 import java.security.cert.TrustAnchor; 8937 import java.security.cert.X509Certificate; 8938 import java.util.ArrayList; 8939+import java.util.Arrays; 8940 import java.util.HashSet; 8941 import java.util.Iterator; 8942 import java.util.List; 8943@@ -33,6 +37,9 @@ 8944 public class PKIXCertPathValidatorSpi 8945 extends CertPathValidatorSpi 8946 { 8947+ // BEGIN android-added 8948+ private final static CertBlacklist blacklist = new CertBlacklist(); 8949+ // END android-added 8950 8951 public CertPathValidatorResult engineValidate( 8952 CertPath certPath, 8953@@ -75,6 +82,22 @@ 8954 { 8955 throw new CertPathValidatorException("Certification path is empty.", null, certPath, 0); 8956 } 8957+ // BEGIN android-added 8958+ { 8959+ X509Certificate cert = (X509Certificate) certs.get(0); 8960+ 8961+ if (cert != null) { 8962+ BigInteger serial = cert.getSerialNumber(); 8963+ if (blacklist.isSerialNumberBlackListed(serial)) { 8964+ // emulate CRL exception message in RFC3280CertPathUtilities.checkCRLs 8965+ String message = "Certificate revocation of serial 0x" + serial.toString(16); 8966+ System.out.println(message); 8967+ AnnotatedException e = new AnnotatedException(message); 8968+ throw new CertPathValidatorException(e.getMessage(), e, certPath, 0); 8969+ } 8970+ } 8971+ } 8972+ // END android-added 8973 8974 // 8975 // (b) 8976@@ -251,6 +274,15 @@ 8977 8978 for (index = certs.size() - 1; index >= 0; index--) 8979 { 8980+ // BEGIN android-added 8981+ if (blacklist.isPublicKeyBlackListed(workingPublicKey)) { 8982+ // emulate CRL exception message in RFC3280CertPathUtilities.checkCRLs 8983+ String message = "Certificate revocation of public key " + workingPublicKey; 8984+ System.out.println(message); 8985+ AnnotatedException e = new AnnotatedException(message); 8986+ throw new CertPathValidatorException(e.getMessage(), e, certPath, index); 8987+ } 8988+ // END android-added 8989 // try 8990 // { 8991 // 8992diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PKIXNameConstraintValidator.java bcprov-jdk16-146/org/bouncycastle/jce/provider/PKIXNameConstraintValidator.java 8993--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/PKIXNameConstraintValidator.java 2011-02-23 20:08:56.000000000 +0000 8994+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/PKIXNameConstraintValidator.java 2012-05-11 05:31:26.630725775 +0000 8995@@ -1533,7 +1533,9 @@ 8996 for (Enumeration e = permitted.getObjects(); e.hasMoreElements();) 8997 { 8998 GeneralSubtree subtree = GeneralSubtree.getInstance(e.nextElement()); 8999- Integer tagNo = new Integer(subtree.getBase().getTagNo()); 9000+ // BEGIN android-changed 9001+ Integer tagNo = Integer.valueOf(subtree.getBase().getTagNo()); 9002+ // END android-changed 9003 if (subtreesMap.get(tagNo) == null) 9004 { 9005 subtreesMap.put(tagNo, new HashSet()); 9006diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/WrapCipherSpi.java bcprov-jdk16-146/org/bouncycastle/jce/provider/WrapCipherSpi.java 9007--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/WrapCipherSpi.java 2011-02-23 20:08:56.000000000 +0000 9008+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/WrapCipherSpi.java 2012-05-11 05:31:26.630725775 +0000 9009@@ -22,8 +22,10 @@ 9010 import javax.crypto.ShortBufferException; 9011 import javax.crypto.spec.IvParameterSpec; 9012 import javax.crypto.spec.PBEParameterSpec; 9013-import javax.crypto.spec.RC2ParameterSpec; 9014-import javax.crypto.spec.RC5ParameterSpec; 9015+// BEGIN android-removed 9016+// import javax.crypto.spec.RC2ParameterSpec; 9017+// import javax.crypto.spec.RC5ParameterSpec; 9018+// END android-removed 9019 import javax.crypto.spec.SecretKeySpec; 9020 9021 import org.bouncycastle.asn1.ASN1InputStream; 9022@@ -36,7 +38,9 @@ 9023 import org.bouncycastle.crypto.CipherParameters; 9024 import org.bouncycastle.crypto.InvalidCipherTextException; 9025 import org.bouncycastle.crypto.Wrapper; 9026-import org.bouncycastle.crypto.engines.RC2WrapEngine; 9027+// BEGIN android-removed 9028+// import org.bouncycastle.crypto.engines.RC2WrapEngine; 9029+// END android-removed 9030 import org.bouncycastle.crypto.params.KeyParameter; 9031 import org.bouncycastle.crypto.params.ParametersWithIV; 9032 9033@@ -50,8 +54,10 @@ 9034 { 9035 IvParameterSpec.class, 9036 PBEParameterSpec.class, 9037- RC2ParameterSpec.class, 9038- RC5ParameterSpec.class 9039+ // BEGIN android-removed 9040+ // RC2ParameterSpec.class, 9041+ // RC5ParameterSpec.class 9042+ // END android-removed 9043 }; 9044 9045 protected int pbeType = PKCS12; 9046@@ -263,16 +269,19 @@ 9047 return null; 9048 } 9049 9050+ // BEGIN android-changed 9051+ // added ShortBufferException to throws statement 9052 protected int engineDoFinal( 9053 byte[] input, 9054 int inputOffset, 9055 int inputLen, 9056 byte[] output, 9057 int outputOffset) 9058- throws IllegalBlockSizeException, BadPaddingException 9059+ throws IllegalBlockSizeException, BadPaddingException, ShortBufferException 9060 { 9061 return 0; 9062 } 9063+ // END android-changed 9064 9065 protected byte[] engineWrap( 9066 Key key) 9067@@ -305,7 +314,12 @@ 9068 byte[] wrappedKey, 9069 String wrappedKeyAlgorithm, 9070 int wrappedKeyType) 9071- throws InvalidKeyException 9072+ // BEGIN android-removed 9073+ // throws InvalidKeyException 9074+ // END android-removed 9075+ // BEGIN android-added 9076+ throws InvalidKeyException, NoSuchAlgorithmException 9077+ // END android-added 9078 { 9079 byte[] encoded; 9080 try 9081@@ -356,10 +370,12 @@ 9082 { 9083 privKey = new JCEECPrivateKey(in); 9084 } 9085- else if (oid.equals(CryptoProObjectIdentifiers.gostR3410_94)) 9086- { 9087- privKey = new JDKGOST3410PrivateKey(in); 9088- } 9089+ // BEGIN android-removed 9090+ // else if (oid.equals(CryptoProObjectIdentifiers.gostR3410_94)) 9091+ // { 9092+ // privKey = new JDKGOST3410PrivateKey(in); 9093+ // } 9094+ // END android-removed 9095 else if (oid.equals(X9ObjectIdentifiers.id_dsa)) 9096 { 9097 privKey = new JDKDSAPrivateKey(in); 9098@@ -403,10 +419,12 @@ 9099 { 9100 throw new InvalidKeyException("Unknown key type " + e.getMessage()); 9101 } 9102- catch (NoSuchAlgorithmException e) 9103- { 9104- throw new InvalidKeyException("Unknown key type " + e.getMessage()); 9105- } 9106+ // BEGIN android-removed 9107+ // catch (NoSuchAlgorithmException e) 9108+ // { 9109+ // throw new InvalidKeyException("Unknown key type " + e.getMessage()); 9110+ // } 9111+ // END android-removed 9112 catch (InvalidKeySpecException e2) 9113 { 9114 throw new InvalidKeyException("Unknown key type " + e2.getMessage()); 9115@@ -420,12 +438,14 @@ 9116 // classes that inherit directly from us 9117 // 9118 9119- public static class RC2Wrap 9120- extends WrapCipherSpi 9121- { 9122- public RC2Wrap() 9123- { 9124- super(new RC2WrapEngine()); 9125- } 9126- } 9127+ // BEGIN android-removed 9128+ // public static class RC2Wrap 9129+ // extends WrapCipherSpi 9130+ // { 9131+ // public RC2Wrap() 9132+ // { 9133+ // super(new RC2WrapEngine()); 9134+ // } 9135+ // } 9136+ // END android-removed 9137 } 9138diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/X509CertificateObject.java bcprov-jdk16-146/org/bouncycastle/jce/provider/X509CertificateObject.java 9139--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/X509CertificateObject.java 2011-02-23 20:08:56.000000000 +0000 9140+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/X509CertificateObject.java 2012-05-11 05:31:26.630725775 +0000 9141@@ -520,12 +520,20 @@ 9142 return JDKKeyFactory.createPublicKeyFromPublicKeyInfo(c.getSubjectPublicKeyInfo()); 9143 } 9144 9145+ // BEGIN android-changed 9146+ private byte[] encoded; 9147+ // END android-changed 9148 public byte[] getEncoded() 9149 throws CertificateEncodingException 9150 { 9151 try 9152 { 9153- return c.getEncoded(ASN1Encodable.DER); 9154+ // BEGIN android-changed 9155+ if (encoded == null) { 9156+ encoded = c.getEncoded(ASN1Encodable.DER); 9157+ } 9158+ return encoded; 9159+ // END android-changed 9160 } 9161 catch (IOException e) 9162 { 9163@@ -711,7 +719,7 @@ 9164 { 9165 Signature signature; 9166 String sigName = X509SignatureUtil.getSignatureName(c.getSignatureAlgorithm()); 9167- 9168+ 9169 try 9170 { 9171 signature = Signature.getInstance(sigName, BouncyCastleProvider.PROVIDER_NAME); 9172diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/X509SignatureUtil.java bcprov-jdk16-146/org/bouncycastle/jce/provider/X509SignatureUtil.java 9173--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/X509SignatureUtil.java 2011-02-23 20:08:56.000000000 +0000 9174+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/X509SignatureUtil.java 2012-05-11 05:31:26.630725775 +0000 9175@@ -25,7 +25,9 @@ 9176 9177 class X509SignatureUtil 9178 { 9179- private static final ASN1Null derNull = new DERNull(); 9180+ // BEGIN android-changed 9181+ private static final ASN1Null derNull = DERNull.INSTANCE; 9182+ // END android-changed 9183 9184 static void setSignatureParameters( 9185 Signature signature, 9186@@ -66,12 +68,14 @@ 9187 9188 if (params != null && !derNull.equals(params)) 9189 { 9190- if (sigAlgId.getObjectId().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) 9191- { 9192- RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params); 9193- 9194- return getDigestAlgName(rsaParams.getHashAlgorithm().getObjectId()) + "withRSAandMGF1"; 9195- } 9196+ // BEGIN android-removed 9197+ // if (sigAlgId.getObjectId().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) 9198+ // { 9199+ // RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params); 9200+ // 9201+ // return getDigestAlgName(rsaParams.getHashAlgorithm().getObjectId()) + "withRSAandMGF1"; 9202+ // } 9203+ // END android-removed 9204 if (sigAlgId.getObjectId().equals(X9ObjectIdentifiers.ecdsa_with_SHA2)) 9205 { 9206 ASN1Sequence ecDsaParams = ASN1Sequence.getInstance(params); 9207@@ -98,10 +102,12 @@ 9208 { 9209 return "SHA1"; 9210 } 9211- else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 9212- { 9213- return "SHA224"; 9214- } 9215+ // BEGIN android-removed 9216+ // else if (NISTObjectIdentifiers.id_sha224.equals(digestAlgOID)) 9217+ // { 9218+ // return "SHA224"; 9219+ // } 9220+ // END android-removed 9221 else if (NISTObjectIdentifiers.id_sha256.equals(digestAlgOID)) 9222 { 9223 return "SHA256"; 9224@@ -114,22 +120,24 @@ 9225 { 9226 return "SHA512"; 9227 } 9228- else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 9229- { 9230- return "RIPEMD128"; 9231- } 9232- else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 9233- { 9234- return "RIPEMD160"; 9235- } 9236- else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 9237- { 9238- return "RIPEMD256"; 9239- } 9240- else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 9241- { 9242- return "GOST3411"; 9243- } 9244+ // BEGIN android-removed 9245+ // else if (TeleTrusTObjectIdentifiers.ripemd128.equals(digestAlgOID)) 9246+ // { 9247+ // return "RIPEMD128"; 9248+ // } 9249+ // else if (TeleTrusTObjectIdentifiers.ripemd160.equals(digestAlgOID)) 9250+ // { 9251+ // return "RIPEMD160"; 9252+ // } 9253+ // else if (TeleTrusTObjectIdentifiers.ripemd256.equals(digestAlgOID)) 9254+ // { 9255+ // return "RIPEMD256"; 9256+ // } 9257+ // else if (CryptoProObjectIdentifiers.gostR3411.equals(digestAlgOID)) 9258+ // { 9259+ // return "GOST3411"; 9260+ // } 9261+ // END android-removed 9262 else 9263 { 9264 return digestAlgOID.getId(); 9265diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/EC.java bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/EC.java 9266--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/EC.java 2011-02-23 20:08:56.000000000 +0000 9267+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/EC.java 2012-05-11 05:31:26.630725775 +0000 9268@@ -4,8 +4,10 @@ 9269 9270 import org.bouncycastle.asn1.DERObjectIdentifier; 9271 import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 9272-import org.bouncycastle.asn1.eac.EACObjectIdentifiers; 9273-import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 9274+// BEGIN android-removed 9275+// import org.bouncycastle.asn1.eac.EACObjectIdentifiers; 9276+// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 9277+// END android-removed 9278 import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 9279 9280 public class EC 9281@@ -16,39 +18,49 @@ 9282 public Mappings() 9283 { 9284 put("KeyAgreement.ECDH", "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$DH"); 9285- put("KeyAgreement.ECDHC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$DHC"); 9286- put("KeyAgreement.ECMQV", "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$MQV"); 9287- put("KeyAgreement." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$DHwithSHA1KDF"); 9288- put("KeyAgreement." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$MQVwithSHA1KDF"); 9289+ // BEGIN android-removed 9290+ // put("KeyAgreement.ECDHC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$DHC"); 9291+ // put("KeyAgreement.ECMQV", "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$MQV"); 9292+ // put("KeyAgreement." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$DHwithSHA1KDF"); 9293+ // put("KeyAgreement." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement$MQVwithSHA1KDF"); 9294+ // END android-removed 9295 9296 put("KeyFactory.EC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$EC"); 9297- put("KeyFactory.ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECDSA"); 9298- put("KeyFactory.ECDH", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECDH"); 9299- put("KeyFactory.ECDHC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECDHC"); 9300- put("KeyFactory.ECMQV", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECMQV"); 9301+ // BEGIN android-removed 9302+ // put("KeyFactory.ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECDSA"); 9303+ // put("KeyFactory.ECDH", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECDH"); 9304+ // put("KeyFactory.ECDHC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECDHC"); 9305+ // put("KeyFactory.ECMQV", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECMQV"); 9306+ // END android-removed 9307 put("Alg.Alias.KeyFactory." + X9ObjectIdentifiers.id_ecPublicKey, "EC"); 9308 // TODO Should this be an alias for ECDH? 9309 put("Alg.Alias.KeyFactory." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC"); 9310- put("Alg.Alias.KeyFactory." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV"); 9311- 9312- put("KeyFactory.ECGOST3410", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECGOST3410"); 9313- put("Alg.Alias.KeyFactory.GOST-3410-2001", "ECGOST3410"); 9314- put("Alg.Alias.KeyFactory.ECGOST-3410", "ECGOST3410"); 9315- put("Alg.Alias.KeyFactory." + CryptoProObjectIdentifiers.gostR3410_2001, "ECGOST3410"); 9316+ // BEGIN android-removed 9317+ // put("Alg.Alias.KeyFactory." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV"); 9318+ // 9319+ // put("KeyFactory.ECGOST3410", "org.bouncycastle.jce.provider.asymmetric.ec.KeyFactory$ECGOST3410"); 9320+ // put("Alg.Alias.KeyFactory.GOST-3410-2001", "ECGOST3410"); 9321+ // put("Alg.Alias.KeyFactory.ECGOST-3410", "ECGOST3410"); 9322+ // put("Alg.Alias.KeyFactory." + CryptoProObjectIdentifiers.gostR3410_2001, "ECGOST3410"); 9323+ // END android-removed 9324 9325 put("KeyPairGenerator.EC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$EC"); 9326- put("KeyPairGenerator.ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDSA"); 9327- put("KeyPairGenerator.ECDH", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDH"); 9328- put("KeyPairGenerator.ECDHC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDHC"); 9329- put("KeyPairGenerator.ECIES", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDH"); 9330- put("KeyPairGenerator.ECMQV", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECMQV"); 9331+ // BEGIN android-removed 9332+ // put("KeyPairGenerator.ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDSA"); 9333+ // put("KeyPairGenerator.ECDH", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDH"); 9334+ // put("KeyPairGenerator.ECDHC", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDHC"); 9335+ // put("KeyPairGenerator.ECIES", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECDH"); 9336+ // put("KeyPairGenerator.ECMQV", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECMQV"); 9337+ // END android-removed 9338 // TODO Should this be an alias for ECDH? 9339 put("Alg.Alias.KeyPairGenerator." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC"); 9340- put("Alg.Alias.KeyPairGenerator." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV"); 9341- 9342- put("KeyPairGenerator.ECGOST3410", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECGOST3410"); 9343- put("Alg.Alias.KeyPairGenerator.ECGOST-3410", "ECGOST3410"); 9344- put("Alg.Alias.KeyPairGenerator.GOST-3410-2001", "ECGOST3410"); 9345+ // BEGIN android-removed 9346+ // put("Alg.Alias.KeyPairGenerator." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV"); 9347+ // 9348+ // put("KeyPairGenerator.ECGOST3410", "org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$ECGOST3410"); 9349+ // put("Alg.Alias.KeyPairGenerator.ECGOST-3410", "ECGOST3410"); 9350+ // put("Alg.Alias.KeyPairGenerator.GOST-3410-2001", "ECGOST3410"); 9351+ // END android-removed 9352 9353 put("Signature.ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSA"); 9354 put("Signature.NONEwithECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSAnone"); 9355@@ -60,23 +72,27 @@ 9356 put("Alg.Alias.Signature.SHA1WithECDSA", "ECDSA"); 9357 put("Alg.Alias.Signature.ECDSAWithSHA1", "ECDSA"); 9358 put("Alg.Alias.Signature.1.2.840.10045.4.1", "ECDSA"); 9359- put("Alg.Alias.Signature." + TeleTrusTObjectIdentifiers.ecSignWithSha1, "ECDSA"); 9360- 9361- addSignatureAlgorithm("SHA224", "ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSA224", X9ObjectIdentifiers.ecdsa_with_SHA224); 9362+ // BEGIN android-removed 9363+ // put("Alg.Alias.Signature." + TeleTrusTObjectIdentifiers.ecSignWithSha1, "ECDSA"); 9364+ // 9365+ // addSignatureAlgorithm("SHA224", "ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSA224", X9ObjectIdentifiers.ecdsa_with_SHA224); 9366+ // END android-removed 9367 addSignatureAlgorithm("SHA256", "ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSA256", X9ObjectIdentifiers.ecdsa_with_SHA256); 9368 addSignatureAlgorithm("SHA384", "ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSA384", X9ObjectIdentifiers.ecdsa_with_SHA384); 9369 addSignatureAlgorithm("SHA512", "ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSA512", X9ObjectIdentifiers.ecdsa_with_SHA512); 9370- addSignatureAlgorithm("RIPEMD160", "ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSARipeMD160",TeleTrusTObjectIdentifiers.ecSignWithRipemd160); 9371- 9372- put("Signature.SHA1WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR"); 9373- put("Signature.SHA224WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR224"); 9374- put("Signature.SHA256WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR256"); 9375- put("Signature.SHA384WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR384"); 9376- put("Signature.SHA512WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR512"); 9377- 9378- addSignatureAlgorithm("SHA1", "CVC-ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecCVCDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1); 9379- addSignatureAlgorithm("SHA224", "CVC-ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecCVCDSA224", EACObjectIdentifiers.id_TA_ECDSA_SHA_224); 9380- addSignatureAlgorithm("SHA256", "CVC-ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecCVCDSA256", EACObjectIdentifiers.id_TA_ECDSA_SHA_256); 9381+ // BEGIN android-removed 9382+ // addSignatureAlgorithm("RIPEMD160", "ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSARipeMD160",TeleTrusTObjectIdentifiers.ecSignWithRipemd160); 9383+ // 9384+ // put("Signature.SHA1WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR"); 9385+ // put("Signature.SHA224WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR224"); 9386+ // put("Signature.SHA256WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR256"); 9387+ // put("Signature.SHA384WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR384"); 9388+ // put("Signature.SHA512WITHECNR", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecNR512"); 9389+ // 9390+ // addSignatureAlgorithm("SHA1", "CVC-ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecCVCDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1); 9391+ // addSignatureAlgorithm("SHA224", "CVC-ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecCVCDSA224", EACObjectIdentifiers.id_TA_ECDSA_SHA_224); 9392+ // addSignatureAlgorithm("SHA256", "CVC-ECDSA", "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecCVCDSA256", EACObjectIdentifiers.id_TA_ECDSA_SHA_256); 9393+ // END android-removed 9394 } 9395 9396 private void addSignatureAlgorithm( 9397diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/ECUtil.java bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/ECUtil.java 9398--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/ECUtil.java 2011-02-23 20:08:56.000000000 +0000 9399+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/ECUtil.java 2012-05-11 05:31:26.630725775 +0000 9400@@ -1,10 +1,14 @@ 9401 package org.bouncycastle.jce.provider.asymmetric.ec; 9402 9403 import org.bouncycastle.asn1.DERObjectIdentifier; 9404-import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 9405+// BEGIN android-removed 9406+// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 9407+// END android-removed 9408 import org.bouncycastle.asn1.nist.NISTNamedCurves; 9409 import org.bouncycastle.asn1.sec.SECNamedCurves; 9410-import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 9411+// BEGIN android-removed 9412+// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 9413+// END android-removed 9414 import org.bouncycastle.asn1.x9.X962NamedCurves; 9415 import org.bouncycastle.asn1.x9.X9ECParameters; 9416 import org.bouncycastle.crypto.params.AsymmetricKeyParameter; 9417@@ -167,14 +171,16 @@ 9418 { 9419 oid = NISTNamedCurves.getOID(name); 9420 } 9421- if (oid == null) 9422- { 9423- oid = TeleTrusTNamedCurves.getOID(name); 9424- } 9425- if (oid == null) 9426- { 9427- oid = ECGOST3410NamedCurves.getOID(name); 9428- } 9429+ // BEGIN android-removed 9430+ // if (oid == null) 9431+ // { 9432+ // oid = TeleTrusTNamedCurves.getOID(name); 9433+ // } 9434+ // if (oid == null) 9435+ // { 9436+ // oid = ECGOST3410NamedCurves.getOID(name); 9437+ // } 9438+ // END android-removed 9439 } 9440 9441 return oid; 9442@@ -192,10 +198,12 @@ 9443 { 9444 params = NISTNamedCurves.getByOID(oid); 9445 } 9446- if (params == null) 9447- { 9448- params = TeleTrusTNamedCurves.getByOID(oid); 9449- } 9450+ // BEGIN android-removed 9451+ // if (params == null) 9452+ // { 9453+ // params = TeleTrusTNamedCurves.getByOID(oid); 9454+ // } 9455+ // END android-removed 9456 } 9457 9458 return params; 9459@@ -213,14 +221,16 @@ 9460 { 9461 name = NISTNamedCurves.getName(oid); 9462 } 9463- if (name == null) 9464- { 9465- name = TeleTrusTNamedCurves.getName(oid); 9466- } 9467- if (name == null) 9468- { 9469- name = ECGOST3410NamedCurves.getName(oid); 9470- } 9471+ // BEGIN android-removed 9472+ // if (name == null) 9473+ // { 9474+ // name = TeleTrusTNamedCurves.getName(oid); 9475+ // } 9476+ // if (name == null) 9477+ // { 9478+ // name = ECGOST3410NamedCurves.getName(oid); 9479+ // } 9480+ // END android-removed 9481 } 9482 9483 return name; 9484diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/KeyAgreement.java bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/KeyAgreement.java 9485--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/KeyAgreement.java 2011-02-23 20:08:56.000000000 +0000 9486+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/KeyAgreement.java 2012-05-11 05:31:26.630725775 +0000 9487@@ -24,20 +24,26 @@ 9488 import org.bouncycastle.crypto.CipherParameters; 9489 import org.bouncycastle.crypto.DerivationFunction; 9490 import org.bouncycastle.crypto.agreement.ECDHBasicAgreement; 9491-import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement; 9492-import org.bouncycastle.crypto.agreement.ECMQVBasicAgreement; 9493-import org.bouncycastle.crypto.agreement.kdf.DHKDFParameters; 9494-import org.bouncycastle.crypto.agreement.kdf.ECDHKEKGenerator; 9495+// BEGIN android-removed 9496+// import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement; 9497+// import org.bouncycastle.crypto.agreement.ECMQVBasicAgreement; 9498+// import org.bouncycastle.crypto.agreement.kdf.DHKDFParameters; 9499+// import org.bouncycastle.crypto.agreement.kdf.ECDHKEKGenerator; 9500+// END android-removed 9501 import org.bouncycastle.crypto.digests.SHA1Digest; 9502 import org.bouncycastle.crypto.params.ECDomainParameters; 9503 import org.bouncycastle.crypto.params.ECPrivateKeyParameters; 9504 import org.bouncycastle.crypto.params.ECPublicKeyParameters; 9505-import org.bouncycastle.crypto.params.MQVPrivateParameters; 9506-import org.bouncycastle.crypto.params.MQVPublicParameters; 9507+// BEGIN android-removed 9508+// import org.bouncycastle.crypto.params.MQVPrivateParameters; 9509+// import org.bouncycastle.crypto.params.MQVPublicParameters; 9510+// END android-removed 9511 import org.bouncycastle.jce.interfaces.ECPrivateKey; 9512 import org.bouncycastle.jce.interfaces.ECPublicKey; 9513-import org.bouncycastle.jce.interfaces.MQVPrivateKey; 9514-import org.bouncycastle.jce.interfaces.MQVPublicKey; 9515+// BEGIN android-removed 9516+// import org.bouncycastle.jce.interfaces.MQVPrivateKey; 9517+// import org.bouncycastle.jce.interfaces.MQVPublicKey; 9518+// END android-removed 9519 9520 /** 9521 * Diffie-Hellman key agreement using elliptic curve keys, ala IEEE P1363 9522@@ -53,9 +59,11 @@ 9523 9524 static 9525 { 9526- Integer i128 = new Integer(128); 9527- Integer i192 = new Integer(192); 9528- Integer i256 = new Integer(256); 9529+ // BEGIN android-changed 9530+ Integer i128 = Integer.valueOf(128); 9531+ Integer i192 = Integer.valueOf(192); 9532+ Integer i256 = Integer.valueOf(256); 9533+ // END android-changed 9534 9535 algorithms.put(NISTObjectIdentifiers.id_aes128_CBC.getId(), i128); 9536 algorithms.put(NISTObjectIdentifiers.id_aes192_CBC.getId(), i192); 9537@@ -70,7 +78,9 @@ 9538 private BigInteger result; 9539 private ECDomainParameters parameters; 9540 private BasicAgreement agreement; 9541- private DerivationFunction kdf; 9542+ // BEGIN android-removed 9543+ // private DerivationFunction kdf; 9544+ // END android-removed 9545 9546 private byte[] bigIntToBytes( 9547 BigInteger r) 9548@@ -85,7 +95,9 @@ 9549 { 9550 this.kaAlgorithm = kaAlgorithm; 9551 this.agreement = agreement; 9552- this.kdf = kdf; 9553+ // BEGIN android-removed 9554+ // this.kdf = kdf; 9555+ // END android-removed 9556 } 9557 9558 protected Key engineDoPhase( 9559@@ -104,25 +116,27 @@ 9560 } 9561 9562 CipherParameters pubKey; 9563- if (agreement instanceof ECMQVBasicAgreement) 9564- { 9565- if (!(key instanceof MQVPublicKey)) 9566- { 9567- throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 9568- + getSimpleName(MQVPublicKey.class) + " for doPhase"); 9569- } 9570- 9571- MQVPublicKey mqvPubKey = (MQVPublicKey)key; 9572- ECPublicKeyParameters staticKey = (ECPublicKeyParameters) 9573- ECUtil.generatePublicKeyParameter(mqvPubKey.getStaticKey()); 9574- ECPublicKeyParameters ephemKey = (ECPublicKeyParameters) 9575- ECUtil.generatePublicKeyParameter(mqvPubKey.getEphemeralKey()); 9576- 9577- pubKey = new MQVPublicParameters(staticKey, ephemKey); 9578- 9579- // TODO Validate that all the keys are using the same parameters? 9580- } 9581- else 9582+ // BEGIN android-removed 9583+ // if (agreement instanceof ECMQVBasicAgreement) 9584+ // { 9585+ // if (!(key instanceof MQVPublicKey)) 9586+ // { 9587+ // throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 9588+ // + getSimpleName(MQVPublicKey.class) + " for doPhase"); 9589+ // } 9590+ // 9591+ // MQVPublicKey mqvPubKey = (MQVPublicKey)key; 9592+ // ECPublicKeyParameters staticKey = (ECPublicKeyParameters) 9593+ // ECUtil.generatePublicKeyParameter(mqvPubKey.getStaticKey()); 9594+ // ECPublicKeyParameters ephemKey = (ECPublicKeyParameters) 9595+ // ECUtil.generatePublicKeyParameter(mqvPubKey.getEphemeralKey()); 9596+ // 9597+ // pubKey = new MQVPublicParameters(staticKey, ephemKey); 9598+ // 9599+ // // TODO Validate that all the keys are using the same parameters? 9600+ // } 9601+ // else 9602+ // END android-removed 9603 { 9604 if (!(key instanceof ECPublicKey)) 9605 { 9606@@ -143,11 +157,13 @@ 9607 protected byte[] engineGenerateSecret() 9608 throws IllegalStateException 9609 { 9610- if (kdf != null) 9611- { 9612- throw new UnsupportedOperationException( 9613- "KDF can only be used when algorithm is known"); 9614- } 9615+ // BEGIN android-removed 9616+ // if (kdf != null) 9617+ // { 9618+ // throw new UnsupportedOperationException( 9619+ // "KDF can only be used when algorithm is known"); 9620+ // } 9621+ // END android-removed 9622 9623 return bigIntToBytes(result); 9624 } 9625@@ -175,23 +191,25 @@ 9626 { 9627 byte[] secret = bigIntToBytes(result); 9628 9629- if (kdf != null) 9630- { 9631- if (!algorithms.containsKey(algorithm)) 9632- { 9633- throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm); 9634- } 9635- 9636- int keySize = ((Integer)algorithms.get(algorithm)).intValue(); 9637- 9638- DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, secret); 9639- 9640- byte[] keyBytes = new byte[keySize / 8]; 9641- kdf.init(params); 9642- kdf.generateBytes(keyBytes, 0, keyBytes.length); 9643- secret = keyBytes; 9644- } 9645- else 9646+ // BEGIN android-removed 9647+ // if (kdf != null) 9648+ // { 9649+ // if (!algorithms.containsKey(algorithm)) 9650+ // { 9651+ // throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm); 9652+ // } 9653+ // 9654+ // int keySize = ((Integer)algorithms.get(algorithm)).intValue(); 9655+ // 9656+ // DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, secret); 9657+ // 9658+ // byte[] keyBytes = new byte[keySize / 8]; 9659+ // kdf.init(params); 9660+ // kdf.generateBytes(keyBytes, 0, keyBytes.length); 9661+ // secret = keyBytes; 9662+ // } 9663+ // else 9664+ // END android-removed 9665 { 9666 // TODO Should we be ensuring the key is the right length? 9667 } 9668@@ -219,35 +237,37 @@ 9669 private void initFromKey(Key key) 9670 throws InvalidKeyException 9671 { 9672- if (agreement instanceof ECMQVBasicAgreement) 9673- { 9674- if (!(key instanceof MQVPrivateKey)) 9675- { 9676- throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 9677- + getSimpleName(MQVPrivateKey.class) + " for initialisation"); 9678- } 9679- 9680- MQVPrivateKey mqvPrivKey = (MQVPrivateKey)key; 9681- ECPrivateKeyParameters staticPrivKey = (ECPrivateKeyParameters) 9682- ECUtil.generatePrivateKeyParameter(mqvPrivKey.getStaticPrivateKey()); 9683- ECPrivateKeyParameters ephemPrivKey = (ECPrivateKeyParameters) 9684- ECUtil.generatePrivateKeyParameter(mqvPrivKey.getEphemeralPrivateKey()); 9685- 9686- ECPublicKeyParameters ephemPubKey = null; 9687- if (mqvPrivKey.getEphemeralPublicKey() != null) 9688- { 9689- ephemPubKey = (ECPublicKeyParameters) 9690- ECUtil.generatePublicKeyParameter(mqvPrivKey.getEphemeralPublicKey()); 9691- } 9692- 9693- MQVPrivateParameters localParams = new MQVPrivateParameters(staticPrivKey, ephemPrivKey, ephemPubKey); 9694- this.parameters = staticPrivKey.getParameters(); 9695- 9696- // TODO Validate that all the keys are using the same parameters? 9697- 9698- agreement.init(localParams); 9699- } 9700- else 9701+ // BEGIN android-removed 9702+ // if (agreement instanceof ECMQVBasicAgreement) 9703+ // { 9704+ // if (!(key instanceof MQVPrivateKey)) 9705+ // { 9706+ // throw new InvalidKeyException(kaAlgorithm + " key agreement requires " 9707+ // + getSimpleName(MQVPrivateKey.class) + " for initialisation"); 9708+ // } 9709+ // 9710+ // MQVPrivateKey mqvPrivKey = (MQVPrivateKey)key; 9711+ // ECPrivateKeyParameters staticPrivKey = (ECPrivateKeyParameters) 9712+ // ECUtil.generatePrivateKeyParameter(mqvPrivKey.getStaticPrivateKey()); 9713+ // ECPrivateKeyParameters ephemPrivKey = (ECPrivateKeyParameters) 9714+ // ECUtil.generatePrivateKeyParameter(mqvPrivKey.getEphemeralPrivateKey()); 9715+ // 9716+ // ECPublicKeyParameters ephemPubKey = null; 9717+ // if (mqvPrivKey.getEphemeralPublicKey() != null) 9718+ // { 9719+ // ephemPubKey = (ECPublicKeyParameters) 9720+ // ECUtil.generatePublicKeyParameter(mqvPrivKey.getEphemeralPublicKey()); 9721+ // } 9722+ // 9723+ // MQVPrivateParameters localParams = new MQVPrivateParameters(staticPrivKey, ephemPrivKey, ephemPubKey); 9724+ // this.parameters = staticPrivKey.getParameters(); 9725+ // 9726+ // // TODO Validate that all the keys are using the same parameters? 9727+ // 9728+ // agreement.init(localParams); 9729+ // } 9730+ // else 9731+ // END android-removed 9732 { 9733 if (!(key instanceof ECPrivateKey)) 9734 { 9735@@ -278,39 +298,41 @@ 9736 } 9737 } 9738 9739- public static class DHC 9740- extends KeyAgreement 9741- { 9742- public DHC() 9743- { 9744- super("ECDHC", new ECDHCBasicAgreement(), null); 9745- } 9746- } 9747- 9748- public static class MQV 9749- extends KeyAgreement 9750- { 9751- public MQV() 9752- { 9753- super("ECMQV", new ECMQVBasicAgreement(), null); 9754- } 9755- } 9756- 9757- public static class DHwithSHA1KDF 9758- extends KeyAgreement 9759- { 9760- public DHwithSHA1KDF() 9761- { 9762- super("ECDHwithSHA1KDF", new ECDHBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 9763- } 9764- } 9765- 9766- public static class MQVwithSHA1KDF 9767- extends KeyAgreement 9768- { 9769- public MQVwithSHA1KDF() 9770- { 9771- super("ECMQVwithSHA1KDF", new ECMQVBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 9772- } 9773- } 9774+ // BEGIN android-removed 9775+ // public static class DHC 9776+ // extends KeyAgreement 9777+ // { 9778+ // public DHC() 9779+ // { 9780+ // super("ECDHC", new ECDHCBasicAgreement(), null); 9781+ // } 9782+ // } 9783+ // 9784+ // public static class MQV 9785+ // extends KeyAgreement 9786+ // { 9787+ // public MQV() 9788+ // { 9789+ // super("ECMQV", new ECMQVBasicAgreement(), null); 9790+ // } 9791+ // } 9792+ // 9793+ // public static class DHwithSHA1KDF 9794+ // extends KeyAgreement 9795+ // { 9796+ // public DHwithSHA1KDF() 9797+ // { 9798+ // super("ECDHwithSHA1KDF", new ECDHBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 9799+ // } 9800+ // } 9801+ // 9802+ // public static class MQVwithSHA1KDF 9803+ // extends KeyAgreement 9804+ // { 9805+ // public MQVwithSHA1KDF() 9806+ // { 9807+ // super("ECMQVwithSHA1KDF", new ECMQVBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest())); 9808+ // } 9809+ // } 9810+ // END android-removed 9811 } 9812diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/KeyPairGenerator.java bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/KeyPairGenerator.java 9813--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/KeyPairGenerator.java 2011-02-23 20:08:56.000000000 +0000 9814+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/KeyPairGenerator.java 2012-05-11 05:31:26.630725775 +0000 9815@@ -10,10 +10,14 @@ 9816 import java.util.Hashtable; 9817 9818 import org.bouncycastle.asn1.DERObjectIdentifier; 9819-import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 9820+// BEGIN android-removed 9821+// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; 9822+// END android-removed 9823 import org.bouncycastle.asn1.nist.NISTNamedCurves; 9824 import org.bouncycastle.asn1.sec.SECNamedCurves; 9825-import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 9826+// BEGIN android-removed 9827+// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; 9828+// END android-removed 9829 import org.bouncycastle.asn1.x9.X962NamedCurves; 9830 import org.bouncycastle.asn1.x9.X9ECParameters; 9831 import org.bouncycastle.crypto.AsymmetricCipherKeyPair; 9832@@ -56,13 +60,15 @@ 9833 static { 9834 ecParameters = new Hashtable(); 9835 9836- ecParameters.put(new Integer(192), new ECGenParameterSpec("prime192v1")); // a.k.a P-192 9837- ecParameters.put(new Integer(239), new ECGenParameterSpec("prime239v1")); 9838- ecParameters.put(new Integer(256), new ECGenParameterSpec("prime256v1")); // a.k.a P-256 9839- 9840- ecParameters.put(new Integer(224), new ECGenParameterSpec("P-224")); 9841- ecParameters.put(new Integer(384), new ECGenParameterSpec("P-384")); 9842- ecParameters.put(new Integer(521), new ECGenParameterSpec("P-521")); 9843+ // BEGIN android-changed 9844+ ecParameters.put(Integer.valueOf(192), new ECGenParameterSpec("prime192v1")); // a.k.a P-192 9845+ ecParameters.put(Integer.valueOf(239), new ECGenParameterSpec("prime239v1")); 9846+ ecParameters.put(Integer.valueOf(256), new ECGenParameterSpec("prime256v1")); // a.k.a P-256 9847+ 9848+ ecParameters.put(Integer.valueOf(224), new ECGenParameterSpec("P-224")); 9849+ ecParameters.put(Integer.valueOf(384), new ECGenParameterSpec("P-384")); 9850+ ecParameters.put(Integer.valueOf(521), new ECGenParameterSpec("P-521")); 9851+ // END android-changed 9852 } 9853 9854 public EC() 9855@@ -83,8 +89,16 @@ 9856 SecureRandom random) 9857 { 9858 this.strength = strength; 9859+ // BEGIN android-added 9860+ if (random != null) { 9861+ // END android-added 9862 this.random = random; 9863- this.ecParams = ecParameters.get(new Integer(strength)); 9864+ // BEGIN android-added 9865+ } 9866+ // END android-added 9867+ // BEGIN android-changed 9868+ this.ecParams = ecParameters.get(Integer.valueOf(strength)); 9869+ // END android-changed 9870 9871 if (ecParams != null) 9872 { 9873@@ -108,6 +122,11 @@ 9874 SecureRandom random) 9875 throws InvalidAlgorithmParameterException 9876 { 9877+ // BEGIN android-added 9878+ if (random == null) { 9879+ random = this.random; 9880+ } 9881+ // END android-added 9882 if (params instanceof ECParameterSpec) 9883 { 9884 ECParameterSpec p = (ECParameterSpec)params; 9885@@ -135,23 +154,25 @@ 9886 { 9887 final String curveName = ((ECGenParameterSpec)params).getName(); 9888 9889- if (this.algorithm.equals("ECGOST3410")) 9890- { 9891- ECDomainParameters ecP = ECGOST3410NamedCurves.getByName(curveName); 9892- if (ecP == null) 9893- { 9894- throw new InvalidAlgorithmParameterException("unknown curve name: " + curveName); 9895- } 9896- 9897- this.ecParams = new ECNamedCurveSpec( 9898- curveName, 9899- ecP.getCurve(), 9900- ecP.getG(), 9901- ecP.getN(), 9902- ecP.getH(), 9903- ecP.getSeed()); 9904- } 9905- else 9906+ // BEGIN android-removed 9907+ // if (this.algorithm.equals("ECGOST3410")) 9908+ // { 9909+ // ECDomainParameters ecP = ECGOST3410NamedCurves.getByName(curveName); 9910+ // if (ecP == null) 9911+ // { 9912+ // throw new InvalidAlgorithmParameterException("unknown curve name: " + curveName); 9913+ // } 9914+ // 9915+ // this.ecParams = new ECNamedCurveSpec( 9916+ // curveName, 9917+ // ecP.getCurve(), 9918+ // ecP.getG(), 9919+ // ecP.getN(), 9920+ // ecP.getH(), 9921+ // ecP.getSeed()); 9922+ // } 9923+ // else 9924+ // END android-removed 9925 { 9926 X9ECParameters ecP = X962NamedCurves.getByName(curveName); 9927 if (ecP == null) 9928@@ -161,10 +182,12 @@ 9929 { 9930 ecP = NISTNamedCurves.getByName(curveName); 9931 } 9932- if (ecP == null) 9933- { 9934- ecP = TeleTrusTNamedCurves.getByName(curveName); 9935- } 9936+ // BEGIN android-removed 9937+ // if (ecP == null) 9938+ // { 9939+ // ecP = TeleTrusTNamedCurves.getByName(curveName); 9940+ // } 9941+ // END android-removed 9942 if (ecP == null) 9943 { 9944 // See if it's actually an OID string (SunJSSE ServerHandshaker setupEphemeralECDHKeys bug) 9945@@ -180,10 +203,12 @@ 9946 { 9947 ecP = NISTNamedCurves.getByOID(oid); 9948 } 9949- if (ecP == null) 9950- { 9951- ecP = TeleTrusTNamedCurves.getByOID(oid); 9952- } 9953+ // BEGIN android-removed 9954+ // if (ecP == null) 9955+ // { 9956+ // ecP = TeleTrusTNamedCurves.getByOID(oid); 9957+ // } 9958+ // END android-removed 9959 if (ecP == null) 9960 { 9961 throw new InvalidAlgorithmParameterException("unknown curve OID: " + curveName); 9962@@ -239,7 +264,15 @@ 9963 { 9964 if (!initialised) 9965 { 9966- throw new IllegalStateException("EC Key Pair Generator not initialised"); 9967+ // BEGIN android-removed 9968+ // throw new IllegalStateException("EC Key Pair Generator not initialised"); 9969+ // END android-removed 9970+ // BEGIN android-added 9971+ /* 9972+ * KeyPairGenerator documentation says that a default initialization must be provided 9973+ */ 9974+ initialize(192, random); 9975+ // END android-added 9976 } 9977 9978 AsymmetricCipherKeyPair pair = engine.generateKeyPair(); 9979@@ -279,14 +312,16 @@ 9980 } 9981 } 9982 9983- public static class ECGOST3410 9984- extends EC 9985- { 9986- public ECGOST3410() 9987- { 9988- super("ECGOST3410"); 9989- } 9990- } 9991+ // BEGIN android-removed 9992+ // public static class ECGOST3410 9993+ // extends EC 9994+ // { 9995+ // public ECGOST3410() 9996+ // { 9997+ // super("ECGOST3410"); 9998+ // } 9999+ // } 10000+ // END android-removed 10001 10002 public static class ECDH 10003 extends EC 10004@@ -314,4 +349,4 @@ 10005 super("ECMQV"); 10006 } 10007 } 10008-} 10009\ No newline at end of file 10010+} 10011diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/Signature.java bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/Signature.java 10012--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/asymmetric/ec/Signature.java 2011-02-23 20:08:56.000000000 +0000 10013+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/asymmetric/ec/Signature.java 2012-05-11 05:31:26.630725775 +0000 10014@@ -18,15 +18,21 @@ 10015 import org.bouncycastle.crypto.DSA; 10016 import org.bouncycastle.crypto.Digest; 10017 import org.bouncycastle.crypto.digests.NullDigest; 10018-import org.bouncycastle.crypto.digests.RIPEMD160Digest; 10019+// BEGIN android-removed 10020+// import org.bouncycastle.crypto.digests.RIPEMD160Digest; 10021+// END android-removed 10022 import org.bouncycastle.crypto.digests.SHA1Digest; 10023-import org.bouncycastle.crypto.digests.SHA224Digest; 10024+// BEGIN android-removed 10025+// import org.bouncycastle.crypto.digests.SHA224Digest; 10026+// END android-removed 10027 import org.bouncycastle.crypto.digests.SHA256Digest; 10028 import org.bouncycastle.crypto.digests.SHA384Digest; 10029 import org.bouncycastle.crypto.digests.SHA512Digest; 10030 import org.bouncycastle.crypto.params.ParametersWithRandom; 10031 import org.bouncycastle.crypto.signers.ECDSASigner; 10032-import org.bouncycastle.crypto.signers.ECNRSigner; 10033+// BEGIN android-removed 10034+// import org.bouncycastle.crypto.signers.ECNRSigner; 10035+// END android-removed 10036 import org.bouncycastle.jce.interfaces.ECKey; 10037 import org.bouncycastle.jce.provider.DSABase; 10038 import org.bouncycastle.jce.provider.DSAEncoder; 10039@@ -122,14 +128,16 @@ 10040 } 10041 } 10042 10043- static public class ecDSA224 10044- extends Signature 10045- { 10046- public ecDSA224() 10047- { 10048- super(new SHA224Digest(), new ECDSASigner(), new StdDSAEncoder()); 10049- } 10050- } 10051+ // BEGIN android-removed 10052+ // static public class ecDSA224 10053+ // extends Signature 10054+ // { 10055+ // public ecDSA224() 10056+ // { 10057+ // super(new SHA224Digest(), new ECDSASigner(), new StdDSAEncoder()); 10058+ // } 10059+ // } 10060+ // END android-removed 10061 10062 static public class ecDSA256 10063 extends Signature 10064@@ -158,86 +166,88 @@ 10065 } 10066 } 10067 10068- static public class ecDSARipeMD160 10069- extends Signature 10070- { 10071- public ecDSARipeMD160() 10072- { 10073- super(new RIPEMD160Digest(), new ECDSASigner(), new StdDSAEncoder()); 10074- } 10075- } 10076- 10077- static public class ecNR 10078- extends Signature 10079- { 10080- public ecNR() 10081- { 10082- super(new SHA1Digest(), new ECNRSigner(), new StdDSAEncoder()); 10083- } 10084- } 10085- 10086- static public class ecNR224 10087- extends Signature 10088- { 10089- public ecNR224() 10090- { 10091- super(new SHA224Digest(), new ECNRSigner(), new StdDSAEncoder()); 10092- } 10093- } 10094- 10095- static public class ecNR256 10096- extends Signature 10097- { 10098- public ecNR256() 10099- { 10100- super(new SHA256Digest(), new ECNRSigner(), new StdDSAEncoder()); 10101- } 10102- } 10103- 10104- static public class ecNR384 10105- extends Signature 10106- { 10107- public ecNR384() 10108- { 10109- super(new SHA384Digest(), new ECNRSigner(), new StdDSAEncoder()); 10110- } 10111- } 10112- 10113- static public class ecNR512 10114- extends Signature 10115- { 10116- public ecNR512() 10117- { 10118- super(new SHA512Digest(), new ECNRSigner(), new StdDSAEncoder()); 10119- } 10120- } 10121- 10122- static public class ecCVCDSA 10123- extends Signature 10124- { 10125- public ecCVCDSA() 10126- { 10127- super(new SHA1Digest(), new ECDSASigner(), new CVCDSAEncoder()); 10128- } 10129- } 10130- 10131- static public class ecCVCDSA224 10132- extends Signature 10133- { 10134- public ecCVCDSA224() 10135- { 10136- super(new SHA224Digest(), new ECDSASigner(), new CVCDSAEncoder()); 10137- } 10138- } 10139- 10140- static public class ecCVCDSA256 10141- extends Signature 10142- { 10143- public ecCVCDSA256() 10144- { 10145- super(new SHA256Digest(), new ECDSASigner(), new CVCDSAEncoder()); 10146- } 10147- } 10148+ // BEGIN android-removed 10149+ // static public class ecDSARipeMD160 10150+ // extends Signature 10151+ // { 10152+ // public ecDSARipeMD160() 10153+ // { 10154+ // super(new RIPEMD160Digest(), new ECDSASigner(), new StdDSAEncoder()); 10155+ // } 10156+ // } 10157+ // 10158+ // static public class ecNR 10159+ // extends Signature 10160+ // { 10161+ // public ecNR() 10162+ // { 10163+ // super(new SHA1Digest(), new ECNRSigner(), new StdDSAEncoder()); 10164+ // } 10165+ // } 10166+ // 10167+ // static public class ecNR224 10168+ // extends Signature 10169+ // { 10170+ // public ecNR224() 10171+ // { 10172+ // super(new SHA224Digest(), new ECNRSigner(), new StdDSAEncoder()); 10173+ // } 10174+ // } 10175+ // 10176+ // static public class ecNR256 10177+ // extends Signature 10178+ // { 10179+ // public ecNR256() 10180+ // { 10181+ // super(new SHA256Digest(), new ECNRSigner(), new StdDSAEncoder()); 10182+ // } 10183+ // } 10184+ // 10185+ // static public class ecNR384 10186+ // extends Signature 10187+ // { 10188+ // public ecNR384() 10189+ // { 10190+ // super(new SHA384Digest(), new ECNRSigner(), new StdDSAEncoder()); 10191+ // } 10192+ // } 10193+ // 10194+ // static public class ecNR512 10195+ // extends Signature 10196+ // { 10197+ // public ecNR512() 10198+ // { 10199+ // super(new SHA512Digest(), new ECNRSigner(), new StdDSAEncoder()); 10200+ // } 10201+ // } 10202+ // 10203+ // static public class ecCVCDSA 10204+ // extends Signature 10205+ // { 10206+ // public ecCVCDSA() 10207+ // { 10208+ // super(new SHA1Digest(), new ECDSASigner(), new CVCDSAEncoder()); 10209+ // } 10210+ // } 10211+ // 10212+ // static public class ecCVCDSA224 10213+ // extends Signature 10214+ // { 10215+ // public ecCVCDSA224() 10216+ // { 10217+ // super(new SHA224Digest(), new ECDSASigner(), new CVCDSAEncoder()); 10218+ // } 10219+ // } 10220+ // 10221+ // static public class ecCVCDSA256 10222+ // extends Signature 10223+ // { 10224+ // public ecCVCDSA256() 10225+ // { 10226+ // super(new SHA256Digest(), new ECDSASigner(), new CVCDSAEncoder()); 10227+ // } 10228+ // } 10229+ // END android-removed 10230 10231 private static class StdDSAEncoder 10232 implements DSAEncoder 10233@@ -331,4 +341,4 @@ 10234 return sig; 10235 } 10236 } 10237-} 10238\ No newline at end of file 10239+} 10240diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/AES.java bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/AES.java 10241--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/AES.java 2011-02-23 20:08:56.000000000 +0000 10242+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/AES.java 2012-05-11 05:31:26.630725775 +0000 10243@@ -13,8 +13,10 @@ 10244 import org.bouncycastle.crypto.CipherKeyGenerator; 10245 import org.bouncycastle.crypto.engines.AESFastEngine; 10246 import org.bouncycastle.crypto.engines.AESWrapEngine; 10247-import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 10248-import org.bouncycastle.crypto.macs.CMac; 10249+// BEGIN android-removed 10250+// import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 10251+// import org.bouncycastle.crypto.macs.CMac; 10252+// END android-removed 10253 import org.bouncycastle.crypto.modes.CBCBlockCipher; 10254 import org.bouncycastle.crypto.modes.CFBBlockCipher; 10255 import org.bouncycastle.crypto.modes.OFBBlockCipher; 10256@@ -41,41 +43,43 @@ 10257 } 10258 } 10259 10260- public static class CBC 10261- extends JCEBlockCipher 10262- { 10263- public CBC() 10264- { 10265- super(new CBCBlockCipher(new AESFastEngine()), 128); 10266- } 10267- } 10268- 10269- static public class CFB 10270- extends JCEBlockCipher 10271- { 10272- public CFB() 10273- { 10274- super(new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 128)), 128); 10275- } 10276- } 10277- 10278- static public class OFB 10279- extends JCEBlockCipher 10280- { 10281- public OFB() 10282- { 10283- super(new BufferedBlockCipher(new OFBBlockCipher(new AESFastEngine(), 128)), 128); 10284- } 10285- } 10286- 10287- public static class AESCMAC 10288- extends JCEMac 10289- { 10290- public AESCMAC() 10291- { 10292- super(new CMac(new AESFastEngine())); 10293- } 10294- } 10295+ // BEGIN android-removed 10296+ // public static class CBC 10297+ // extends JCEBlockCipher 10298+ // { 10299+ // public CBC() 10300+ // { 10301+ // super(new CBCBlockCipher(new AESFastEngine()), 128); 10302+ // } 10303+ // } 10304+ // 10305+ // static public class CFB 10306+ // extends JCEBlockCipher 10307+ // { 10308+ // public CFB() 10309+ // { 10310+ // super(new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 128)), 128); 10311+ // } 10312+ // } 10313+ // 10314+ // static public class OFB 10315+ // extends JCEBlockCipher 10316+ // { 10317+ // public OFB() 10318+ // { 10319+ // super(new BufferedBlockCipher(new OFBBlockCipher(new AESFastEngine(), 128)), 128); 10320+ // } 10321+ // } 10322+ // 10323+ // public static class AESCMAC 10324+ // extends JCEMac 10325+ // { 10326+ // public AESCMAC() 10327+ // { 10328+ // super(new CMac(new AESFastEngine())); 10329+ // } 10330+ // } 10331+ // END android-removed 10332 10333 static public class Wrap 10334 extends WrapCipherSpi 10335@@ -86,14 +90,16 @@ 10336 } 10337 } 10338 10339- public static class RFC3211Wrap 10340- extends WrapCipherSpi 10341- { 10342- public RFC3211Wrap() 10343- { 10344- super(new RFC3211WrapEngine(new AESFastEngine()), 16); 10345- } 10346- } 10347+ // BEGIN android-removed 10348+ // public static class RFC3211Wrap 10349+ // extends WrapCipherSpi 10350+ // { 10351+ // public RFC3211Wrap() 10352+ // { 10353+ // super(new RFC3211WrapEngine(new AESFastEngine()), 16); 10354+ // } 10355+ // } 10356+ // END android-removed 10357 10358 public static class KeyGen 10359 extends JCEKeyGenerator 10360@@ -109,70 +115,72 @@ 10361 } 10362 } 10363 10364- public static class KeyGen128 10365- extends KeyGen 10366- { 10367- public KeyGen128() 10368- { 10369- super(128); 10370- } 10371- } 10372- 10373- public static class KeyGen192 10374- extends KeyGen 10375- { 10376- public KeyGen192() 10377- { 10378- super(192); 10379- } 10380- } 10381- 10382- public static class KeyGen256 10383- extends KeyGen 10384- { 10385- public KeyGen256() 10386- { 10387- super(256); 10388- } 10389- } 10390- 10391- public static class AlgParamGen 10392- extends JDKAlgorithmParameterGenerator 10393- { 10394- protected void engineInit( 10395- AlgorithmParameterSpec genParamSpec, 10396- SecureRandom random) 10397- throws InvalidAlgorithmParameterException 10398- { 10399- throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation."); 10400- } 10401- 10402- protected AlgorithmParameters engineGenerateParameters() 10403- { 10404- byte[] iv = new byte[16]; 10405- 10406- if (random == null) 10407- { 10408- random = new SecureRandom(); 10409- } 10410- 10411- random.nextBytes(iv); 10412- 10413- AlgorithmParameters params; 10414- 10415- try 10416- { 10417- params = AlgorithmParameters.getInstance("AES", BouncyCastleProvider.PROVIDER_NAME); 10418- params.init(new IvParameterSpec(iv)); 10419- } 10420- catch (Exception e) 10421- { 10422- throw new RuntimeException(e.getMessage()); 10423- } 10424- 10425- return params; 10426- } 10427- } 10428+ // BEGIN android-removed 10429+ // public static class KeyGen128 10430+ // extends KeyGen 10431+ // { 10432+ // public KeyGen128() 10433+ // { 10434+ // super(128); 10435+ // } 10436+ // } 10437+ // 10438+ // public static class KeyGen192 10439+ // extends KeyGen 10440+ // { 10441+ // public KeyGen192() 10442+ // { 10443+ // super(192); 10444+ // } 10445+ // } 10446+ // 10447+ // public static class KeyGen256 10448+ // extends KeyGen 10449+ // { 10450+ // public KeyGen256() 10451+ // { 10452+ // super(256); 10453+ // } 10454+ // } 10455+ // 10456+ // public static class AlgParamGen 10457+ // extends JDKAlgorithmParameterGenerator 10458+ // { 10459+ // protected void engineInit( 10460+ // AlgorithmParameterSpec genParamSpec, 10461+ // SecureRandom random) 10462+ // throws InvalidAlgorithmParameterException 10463+ // { 10464+ // throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation."); 10465+ // } 10466+ // 10467+ // protected AlgorithmParameters engineGenerateParameters() 10468+ // { 10469+ // byte[] iv = new byte[16]; 10470+ // 10471+ // if (random == null) 10472+ // { 10473+ // random = new SecureRandom(); 10474+ // } 10475+ // 10476+ // random.nextBytes(iv); 10477+ // 10478+ // AlgorithmParameters params; 10479+ // 10480+ // try 10481+ // { 10482+ // params = AlgorithmParameters.getInstance("AES", BouncyCastleProvider.PROVIDER_NAME); 10483+ // params.init(new IvParameterSpec(iv)); 10484+ // } 10485+ // catch (Exception e) 10486+ // { 10487+ // throw new RuntimeException(e.getMessage()); 10488+ // } 10489+ // 10490+ // return params; 10491+ // } 10492+ // } 10493+ // END android-removed 10494 10495 public static class AlgParams 10496 extends JDKAlgorithmParameters.IVAlgorithmParameters 10497@@ -205,58 +213,66 @@ 10498 put("Alg.Alias.AlgorithmParameters." + NISTObjectIdentifiers.id_aes192_CBC, "AES"); 10499 put("Alg.Alias.AlgorithmParameters." + NISTObjectIdentifiers.id_aes256_CBC, "AES"); 10500 10501- put("AlgorithmParameterGenerator.AES", "org.bouncycastle.jce.provider.symmetric.AES$AlgParamGen"); 10502- put("Alg.Alias.AlgorithmParameterGenerator." + wrongAES128, "AES"); 10503- put("Alg.Alias.AlgorithmParameterGenerator." + wrongAES192, "AES"); 10504- put("Alg.Alias.AlgorithmParameterGenerator." + wrongAES256, "AES"); 10505- put("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes128_CBC, "AES"); 10506- put("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes192_CBC, "AES"); 10507- put("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes256_CBC, "AES"); 10508+ // BEGIN android-removed 10509+ // put("AlgorithmParameterGenerator.AES", "org.bouncycastle.jce.provider.symmetric.AES$AlgParamGen"); 10510+ // put("Alg.Alias.AlgorithmParameterGenerator." + wrongAES128, "AES"); 10511+ // put("Alg.Alias.AlgorithmParameterGenerator." + wrongAES192, "AES"); 10512+ // put("Alg.Alias.AlgorithmParameterGenerator." + wrongAES256, "AES"); 10513+ // put("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes128_CBC, "AES"); 10514+ // put("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes192_CBC, "AES"); 10515+ // put("Alg.Alias.AlgorithmParameterGenerator." + NISTObjectIdentifiers.id_aes256_CBC, "AES"); 10516+ // END android-removed 10517 10518 put("Cipher.AES", "org.bouncycastle.jce.provider.symmetric.AES$ECB"); 10519 put("Alg.Alias.Cipher." + wrongAES128, "AES"); 10520 put("Alg.Alias.Cipher." + wrongAES192, "AES"); 10521 put("Alg.Alias.Cipher." + wrongAES256, "AES"); 10522- put("Cipher." + NISTObjectIdentifiers.id_aes128_ECB, "org.bouncycastle.jce.provider.symmetric.AES$ECB"); 10523- put("Cipher." + NISTObjectIdentifiers.id_aes192_ECB, "org.bouncycastle.jce.provider.symmetric.AES$ECB"); 10524- put("Cipher." + NISTObjectIdentifiers.id_aes256_ECB, "org.bouncycastle.jce.provider.symmetric.AES$ECB"); 10525- put("Cipher." + NISTObjectIdentifiers.id_aes128_CBC, "org.bouncycastle.jce.provider.symmetric.AES$CBC"); 10526- put("Cipher." + NISTObjectIdentifiers.id_aes192_CBC, "org.bouncycastle.jce.provider.symmetric.AES$CBC"); 10527- put("Cipher." + NISTObjectIdentifiers.id_aes256_CBC, "org.bouncycastle.jce.provider.symmetric.AES$CBC"); 10528- put("Cipher." + NISTObjectIdentifiers.id_aes128_OFB, "org.bouncycastle.jce.provider.symmetric.AES$OFB"); 10529- put("Cipher." + NISTObjectIdentifiers.id_aes192_OFB, "org.bouncycastle.jce.provider.symmetric.AES$OFB"); 10530- put("Cipher." + NISTObjectIdentifiers.id_aes256_OFB, "org.bouncycastle.jce.provider.symmetric.AES$OFB"); 10531- put("Cipher." + NISTObjectIdentifiers.id_aes128_CFB, "org.bouncycastle.jce.provider.symmetric.AES$CFB"); 10532- put("Cipher." + NISTObjectIdentifiers.id_aes192_CFB, "org.bouncycastle.jce.provider.symmetric.AES$CFB"); 10533- put("Cipher." + NISTObjectIdentifiers.id_aes256_CFB, "org.bouncycastle.jce.provider.symmetric.AES$CFB"); 10534+ // BEGIN android-removed 10535+ // put("Cipher." + NISTObjectIdentifiers.id_aes128_ECB, "org.bouncycastle.jce.provider.symmetric.AES$ECB"); 10536+ // put("Cipher." + NISTObjectIdentifiers.id_aes192_ECB, "org.bouncycastle.jce.provider.symmetric.AES$ECB"); 10537+ // put("Cipher." + NISTObjectIdentifiers.id_aes256_ECB, "org.bouncycastle.jce.provider.symmetric.AES$ECB"); 10538+ // put("Cipher." + NISTObjectIdentifiers.id_aes128_CBC, "org.bouncycastle.jce.provider.symmetric.AES$CBC"); 10539+ // put("Cipher." + NISTObjectIdentifiers.id_aes192_CBC, "org.bouncycastle.jce.provider.symmetric.AES$CBC"); 10540+ // put("Cipher." + NISTObjectIdentifiers.id_aes256_CBC, "org.bouncycastle.jce.provider.symmetric.AES$CBC"); 10541+ // put("Cipher." + NISTObjectIdentifiers.id_aes128_OFB, "org.bouncycastle.jce.provider.symmetric.AES$OFB"); 10542+ // put("Cipher." + NISTObjectIdentifiers.id_aes192_OFB, "org.bouncycastle.jce.provider.symmetric.AES$OFB"); 10543+ // put("Cipher." + NISTObjectIdentifiers.id_aes256_OFB, "org.bouncycastle.jce.provider.symmetric.AES$OFB"); 10544+ // put("Cipher." + NISTObjectIdentifiers.id_aes128_CFB, "org.bouncycastle.jce.provider.symmetric.AES$CFB"); 10545+ // put("Cipher." + NISTObjectIdentifiers.id_aes192_CFB, "org.bouncycastle.jce.provider.symmetric.AES$CFB"); 10546+ // put("Cipher." + NISTObjectIdentifiers.id_aes256_CFB, "org.bouncycastle.jce.provider.symmetric.AES$CFB"); 10547+ // END android-removed 10548 put("Cipher.AESWRAP", "org.bouncycastle.jce.provider.symmetric.AES$Wrap"); 10549 put("Alg.Alias.Cipher." + NISTObjectIdentifiers.id_aes128_wrap, "AESWRAP"); 10550 put("Alg.Alias.Cipher." + NISTObjectIdentifiers.id_aes192_wrap, "AESWRAP"); 10551 put("Alg.Alias.Cipher." + NISTObjectIdentifiers.id_aes256_wrap, "AESWRAP"); 10552- put("Cipher.AESRFC3211WRAP", "org.bouncycastle.jce.provider.symmetric.AES$RFC3211Wrap"); 10553+ // BEGIN android-removed 10554+ // put("Cipher.AESRFC3211WRAP", "org.bouncycastle.jce.provider.symmetric.AES$RFC3211Wrap"); 10555+ // END android-removed 10556 10557 put("KeyGenerator.AES", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen"); 10558- put("KeyGenerator.2.16.840.1.101.3.4.2", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10559- put("KeyGenerator.2.16.840.1.101.3.4.22", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10560- put("KeyGenerator.2.16.840.1.101.3.4.42", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10561- put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_ECB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10562- put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CBC, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10563- put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_OFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10564- put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10565- put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_ECB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10566- put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CBC, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10567- put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_OFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10568- put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10569- put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_ECB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10570- put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CBC, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10571- put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_OFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10572- put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10573- put("KeyGenerator.AESWRAP", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen"); 10574- put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_wrap, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10575- put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_wrap, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10576- put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_wrap, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10577- 10578- put("Mac.AESCMAC", "org.bouncycastle.jce.provider.symmetric.AES$AESCMAC"); 10579+ // BEGIN android-removed 10580+ // put("KeyGenerator.2.16.840.1.101.3.4.2", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10581+ // put("KeyGenerator.2.16.840.1.101.3.4.22", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10582+ // put("KeyGenerator.2.16.840.1.101.3.4.42", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10583+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_ECB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10584+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CBC, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10585+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_OFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10586+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_CFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10587+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_ECB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10588+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CBC, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10589+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_OFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10590+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_CFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10591+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_ECB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10592+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CBC, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10593+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_OFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10594+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_CFB, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10595+ // put("KeyGenerator.AESWRAP", "org.bouncycastle.jce.provider.symmetric.AES$KeyGen"); 10596+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes128_wrap, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen128"); 10597+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes192_wrap, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen192"); 10598+ // put("KeyGenerator." + NISTObjectIdentifiers.id_aes256_wrap, "org.bouncycastle.jce.provider.symmetric.AES$KeyGen256"); 10599+ // 10600+ // put("Mac.AESCMAC", "org.bouncycastle.jce.provider.symmetric.AES$AESCMAC"); 10601+ // END android-removed 10602 } 10603 } 10604 } 10605diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/ARC4.java bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/ARC4.java 10606--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/ARC4.java 2011-02-23 20:08:56.000000000 +0000 10607+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/ARC4.java 2012-05-11 05:31:26.630725775 +0000 10608@@ -27,7 +27,9 @@ 10609 { 10610 public KeyGen() 10611 { 10612- super("RC4", 128, new CipherKeyGenerator()); 10613+ // BEGIN android-changed 10614+ super("ARC4", 128, new CipherKeyGenerator()); 10615+ // END android-changed 10616 } 10617 } 10618 10619diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/Blowfish.java bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/Blowfish.java 10620--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/Blowfish.java 2011-02-23 20:08:56.000000000 +0000 10621+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/Blowfish.java 2012-05-11 05:31:26.630725775 +0000 10622@@ -57,7 +57,9 @@ 10623 public Mappings() 10624 { 10625 put("Cipher.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$ECB"); 10626- put("Cipher.1.3.6.1.4.1.3029.1.2", "org.bouncycastle.jce.provider.symmetric.Blowfish$CBC"); 10627+ // BEGIN android-removed 10628+ // put("Cipher.1.3.6.1.4.1.3029.1.2", "org.bouncycastle.jce.provider.symmetric.Blowfish$CBC"); 10629+ // END android-removed 10630 put("KeyGenerator.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$KeyGen"); 10631 put("Alg.Alias.KeyGenerator.1.3.6.1.4.1.3029.1.2", "BLOWFISH"); 10632 put("AlgorithmParameters.BLOWFISH", "org.bouncycastle.jce.provider.symmetric.Blowfish$AlgParams"); 10633diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/DESede.java bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/DESede.java 10634--- bcprov-jdk16-146.orig/org/bouncycastle/jce/provider/symmetric/DESede.java 2011-02-23 20:08:56.000000000 +0000 10635+++ bcprov-jdk16-146/org/bouncycastle/jce/provider/symmetric/DESede.java 2012-05-11 05:31:26.630725775 +0000 10636@@ -14,11 +14,15 @@ 10637 import org.bouncycastle.crypto.KeyGenerationParameters; 10638 import org.bouncycastle.crypto.engines.DESedeEngine; 10639 import org.bouncycastle.crypto.engines.DESedeWrapEngine; 10640-import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 10641+// BEGIN android-removed 10642+// import org.bouncycastle.crypto.engines.RFC3211WrapEngine; 10643+// END android-removed 10644 import org.bouncycastle.crypto.generators.DESedeKeyGenerator; 10645 import org.bouncycastle.crypto.macs.CBCBlockCipherMac; 10646-import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 10647-import org.bouncycastle.crypto.macs.CMac; 10648+// BEGIN android-removed 10649+// import org.bouncycastle.crypto.macs.CFBBlockCipherMac; 10650+// import org.bouncycastle.crypto.macs.CMac; 10651+// END android-removed 10652 import org.bouncycastle.crypto.modes.CBCBlockCipher; 10653 import org.bouncycastle.crypto.paddings.ISO7816d4Padding; 10654 import org.bouncycastle.jce.provider.JCEBlockCipher; 10655@@ -51,17 +55,19 @@ 10656 } 10657 } 10658 10659- /** 10660- * DESede CFB8 10661- */ 10662- public static class DESedeCFB8 10663- extends JCEMac 10664- { 10665- public DESedeCFB8() 10666- { 10667- super(new CFBBlockCipherMac(new DESedeEngine())); 10668- } 10669- } 10670+ // BEGIN android-removed 10671+ // /** 10672+ // * DESede CFB8 10673+ // */ 10674+ // public static class DESedeCFB8 10675+ // extends JCEMac 10676+ // { 10677+ // public DESedeCFB8() 10678+ // { 10679+ // super(new CFBBlockCipherMac(new DESedeEngine())); 10680+ // } 10681+ // } 10682+ // END android-removed 10683 10684 /** 10685 * DESede64 10686@@ -96,14 +102,16 @@ 10687 } 10688 } 10689 10690- static public class CMAC 10691- extends JCEMac 10692- { 10693- public CMAC() 10694- { 10695- super(new CMac(new DESedeEngine())); 10696- } 10697- } 10698+ // BEGIN android-removed 10699+ // static public class CMAC 10700+ // extends JCEMac 10701+ // { 10702+ // public CMAC() 10703+ // { 10704+ // super(new CMac(new DESedeEngine())); 10705+ // } 10706+ // } 10707+ // END android-removed 10708 10709 public static class Wrap 10710 extends WrapCipherSpi 10711@@ -114,14 +122,16 @@ 10712 } 10713 } 10714 10715- public static class RFC3211 10716- extends WrapCipherSpi 10717- { 10718- public RFC3211() 10719- { 10720- super(new RFC3211WrapEngine(new DESedeEngine()), 8); 10721- } 10722- } 10723+ // BEGIN android-removed 10724+ // public static class RFC3211 10725+ // extends WrapCipherSpi 10726+ // { 10727+ // public RFC3211() 10728+ // { 10729+ // super(new RFC3211WrapEngine(new DESedeEngine()), 8); 10730+ // } 10731+ // } 10732+ // END android-removed 10733 10734 /** 10735 * DESede - the default for this is to generate a key in 10736@@ -262,32 +272,42 @@ 10737 public Mappings() 10738 { 10739 put("Cipher.DESEDE", "org.bouncycastle.jce.provider.symmetric.DESede$ECB"); 10740- put("Cipher." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.symmetric.DESede$CBC"); 10741- put("Cipher." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.symmetric.DESede$CBC"); 10742+ // BEGIN android-removed 10743+ // put("Cipher." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.symmetric.DESede$CBC"); 10744+ // put("Cipher." + OIWObjectIdentifiers.desCBC, "org.bouncycastle.jce.provider.symmetric.DESede$CBC"); 10745+ // END android-removed 10746 put("Cipher.DESEDEWRAP", "org.bouncycastle.jce.provider.symmetric.DESede$Wrap"); 10747- put("Cipher." + PKCSObjectIdentifiers.id_alg_CMS3DESwrap, "org.bouncycastle.jce.provider.symmetric.DESede$Wrap"); 10748- put("Cipher.DESEDERFC3211WRAP", "org.bouncycastle.jce.provider.symmetric.DESede$RFC3211"); 10749+ // BEGIN android-changed 10750+ put("Alg.Alias.Cipher." + PKCSObjectIdentifiers.id_alg_CMS3DESwrap, "DESEDEWRAP"); 10751+ // END android-changed 10752+ // BEGIN android-removed 10753+ // put("Cipher.DESEDERFC3211WRAP", "org.bouncycastle.jce.provider.symmetric.DESede$RFC3211"); 10754+ // END android-removed 10755 10756 put("KeyGenerator.DESEDE", "org.bouncycastle.jce.provider.symmetric.DESede$KeyGenerator"); 10757- put("KeyGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.symmetric.DESede$KeyGenerator3"); 10758- put("KeyGenerator.DESEDEWRAP", "org.bouncycastle.jce.provider.symmetric.DESede$KeyGenerator"); 10759+ // BEGIN android-removed 10760+ // put("KeyGenerator." + PKCSObjectIdentifiers.des_EDE3_CBC, "org.bouncycastle.jce.provider.symmetric.DESede$KeyGenerator3"); 10761+ // put("KeyGenerator.DESEDEWRAP", "org.bouncycastle.jce.provider.symmetric.DESede$KeyGenerator"); 10762+ // END android-removed 10763 10764 put("SecretKeyFactory.DESEDE", "org.bouncycastle.jce.provider.symmetric.DESede$KeyFactory"); 10765 10766- put("Mac.DESEDECMAC", "org.bouncycastle.jce.provider.symmetric.DESede$CMAC"); 10767- put("Mac.DESEDEMAC", "org.bouncycastle.jce.provider.symmetric.DESede$CBCMAC"); 10768- put("Alg.Alias.Mac.DESEDE", "DESEDEMAC"); 10769- 10770- put("Mac.DESEDEMAC/CFB8", "org.bouncycastle.jce.provider.symmetric.DESede$DESedeCFB8"); 10771- put("Alg.Alias.Mac.DESEDE/CFB8", "DESEDEMAC/CFB8"); 10772- 10773- put("Mac.DESEDEMAC64", "org.bouncycastle.jce.provider.symmetric.DESede$DESede64"); 10774- put("Alg.Alias.Mac.DESEDE64", "DESEDEMAC64"); 10775- 10776- put("Mac.DESEDEMAC64WITHISO7816-4PADDING", "org.bouncycastle.jce.provider.symmetric.DESede$DESede64with7816d4"); 10777- put("Alg.Alias.Mac.DESEDE64WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 10778- put("Alg.Alias.Mac.DESEDEISO9797ALG1MACWITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 10779- put("Alg.Alias.Mac.DESEDEISO9797ALG1WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 10780+ // BEGIN android-removed 10781+ // put("Mac.DESEDECMAC", "org.bouncycastle.jce.provider.symmetric.DESede$CMAC"); 10782+ // put("Mac.DESEDEMAC", "org.bouncycastle.jce.provider.symmetric.DESede$CBCMAC"); 10783+ // put("Alg.Alias.Mac.DESEDE", "DESEDEMAC"); 10784+ // 10785+ // put("Mac.DESEDEMAC/CFB8", "org.bouncycastle.jce.provider.symmetric.DESede$DESedeCFB8"); 10786+ // put("Alg.Alias.Mac.DESEDE/CFB8", "DESEDEMAC/CFB8"); 10787+ // 10788+ // put("Mac.DESEDEMAC64", "org.bouncycastle.jce.provider.symmetric.DESede$DESede64"); 10789+ // put("Alg.Alias.Mac.DESEDE64", "DESEDEMAC64"); 10790+ // 10791+ // put("Mac.DESEDEMAC64WITHISO7816-4PADDING", "org.bouncycastle.jce.provider.symmetric.DESede$DESede64with7816d4"); 10792+ // put("Alg.Alias.Mac.DESEDE64WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 10793+ // put("Alg.Alias.Mac.DESEDEISO9797ALG1MACWITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 10794+ // put("Alg.Alias.Mac.DESEDEISO9797ALG1WITHISO7816-4PADDING", "DESEDEMAC64WITHISO7816-4PADDING"); 10795+ // END android-removed 10796 } 10797 } 10798 } 10799diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/openssl/PEMUtilities.java bcprov-jdk16-146/org/bouncycastle/openssl/PEMUtilities.java 10800--- bcprov-jdk16-146.orig/org/bouncycastle/openssl/PEMUtilities.java 2011-02-23 20:08:56.000000000 +0000 10801+++ bcprov-jdk16-146/org/bouncycastle/openssl/PEMUtilities.java 2012-05-11 05:31:26.630725775 +0000 10802@@ -45,10 +45,12 @@ 10803 PKCS5_SCHEME_2.add(NISTObjectIdentifiers.id_aes192_CBC); 10804 PKCS5_SCHEME_2.add(NISTObjectIdentifiers.id_aes256_CBC); 10805 10806- KEYSIZES.put(PKCSObjectIdentifiers.des_EDE3_CBC.getId(), new Integer(192)); 10807- KEYSIZES.put(NISTObjectIdentifiers.id_aes128_CBC.getId(), new Integer(128)); 10808- KEYSIZES.put(NISTObjectIdentifiers.id_aes192_CBC.getId(), new Integer(192)); 10809- KEYSIZES.put(NISTObjectIdentifiers.id_aes256_CBC.getId(), new Integer(256)); 10810+ // BEGIN android-changed 10811+ KEYSIZES.put(PKCSObjectIdentifiers.des_EDE3_CBC.getId(), Integer.valueOf(192)); 10812+ KEYSIZES.put(NISTObjectIdentifiers.id_aes128_CBC.getId(), Integer.valueOf(128)); 10813+ KEYSIZES.put(NISTObjectIdentifiers.id_aes192_CBC.getId(), Integer.valueOf(192)); 10814+ KEYSIZES.put(NISTObjectIdentifiers.id_aes256_CBC.getId(), Integer.valueOf(256)); 10815+ // END android-changed 10816 } 10817 10818 static int getKeySize(String algorithm) 10819diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/x509/X509Util.java bcprov-jdk16-146/org/bouncycastle/x509/X509Util.java 10820--- bcprov-jdk16-146.orig/org/bouncycastle/x509/X509Util.java 2011-02-23 20:08:56.000000000 +0000 10821+++ bcprov-jdk16-146/org/bouncycastle/x509/X509Util.java 2012-05-11 05:31:26.620725599 +0000 10822@@ -44,14 +44,18 @@ 10823 10824 static 10825 { 10826- algorithms.put("MD2WITHRSAENCRYPTION", PKCSObjectIdentifiers.md2WithRSAEncryption); 10827- algorithms.put("MD2WITHRSA", PKCSObjectIdentifiers.md2WithRSAEncryption); 10828+ // BEGIN android-removed 10829+ // algorithms.put("MD2WITHRSAENCRYPTION", PKCSObjectIdentifiers.md2WithRSAEncryption); 10830+ // algorithms.put("MD2WITHRSA", PKCSObjectIdentifiers.md2WithRSAEncryption); 10831+ // END android-removed 10832 algorithms.put("MD5WITHRSAENCRYPTION", PKCSObjectIdentifiers.md5WithRSAEncryption); 10833 algorithms.put("MD5WITHRSA", PKCSObjectIdentifiers.md5WithRSAEncryption); 10834 algorithms.put("SHA1WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha1WithRSAEncryption); 10835 algorithms.put("SHA1WITHRSA", PKCSObjectIdentifiers.sha1WithRSAEncryption); 10836- algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 10837- algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 10838+ // BEGIN android-removed 10839+ // algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); 10840+ // algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); 10841+ // END android-removed 10842 algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption); 10843 algorithms.put("SHA256WITHRSA", PKCSObjectIdentifiers.sha256WithRSAEncryption); 10844 algorithms.put("SHA384WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha384WithRSAEncryption); 10845@@ -59,45 +63,59 @@ 10846 algorithms.put("SHA512WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha512WithRSAEncryption); 10847 algorithms.put("SHA512WITHRSA", PKCSObjectIdentifiers.sha512WithRSAEncryption); 10848 algorithms.put("SHA1WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 10849- algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 10850+ // BEGIN android-removed 10851+ // algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 10852+ // END android-removed 10853 algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 10854 algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 10855 algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); 10856- algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 10857- algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 10858- algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 10859- algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 10860- algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 10861- algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 10862+ // BEGIN android-removed 10863+ // algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 10864+ // algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); 10865+ // algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 10866+ // algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); 10867+ // algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 10868+ // algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); 10869+ // END android-removed 10870 algorithms.put("SHA1WITHDSA", X9ObjectIdentifiers.id_dsa_with_sha1); 10871 algorithms.put("DSAWITHSHA1", X9ObjectIdentifiers.id_dsa_with_sha1); 10872- algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 10873+ // BEGIN android-removed 10874+ // algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); 10875+ // END android-removed 10876 algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256); 10877 algorithms.put("SHA384WITHDSA", NISTObjectIdentifiers.dsa_with_sha384); 10878 algorithms.put("SHA512WITHDSA", NISTObjectIdentifiers.dsa_with_sha512); 10879 algorithms.put("SHA1WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1); 10880 algorithms.put("ECDSAWITHSHA1", X9ObjectIdentifiers.ecdsa_with_SHA1); 10881- algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 10882+ // BEGIN android-removed 10883+ // algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); 10884+ // END android-removed 10885 algorithms.put("SHA256WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256); 10886 algorithms.put("SHA384WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); 10887 algorithms.put("SHA512WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); 10888- algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 10889- algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 10890- algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10891- algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10892- algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10893+ // BEGIN android-removed 10894+ // algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 10895+ // algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 10896+ // algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10897+ // algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10898+ // algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10899+ // END android-removed 10900 10901 // 10902 // According to RFC 3279, the ASN.1 encoding SHALL (id-dsa-with-sha1) or MUST (ecdsa-with-SHA*) omit the parameters field. 10903 // The parameters field SHALL be NULL for RSA based signature algorithms. 10904 // 10905 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA1); 10906- noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 10907+ // BEGIN android-removed 10908+ // noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224); 10909+ // END android-removed 10910 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA256); 10911 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA384); 10912 noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA512); 10913 noParams.add(X9ObjectIdentifiers.id_dsa_with_sha1); 10914- noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 10915+ // BEGIN android-removed 10916+ // noParams.add(NISTObjectIdentifiers.dsa_with_sha224); 10917+ // END android-removed 10918 noParams.add(NISTObjectIdentifiers.dsa_with_sha256); 10919 noParams.add(NISTObjectIdentifiers.dsa_with_sha384); 10920 noParams.add(NISTObjectIdentifiers.dsa_with_sha512); 10921@@ -105,25 +123,39 @@ 10922 // 10923 // RFC 4491 10924 // 10925- noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 10926- noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10927+ // BEGIN android-removed 10928+ // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94); 10929+ // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001); 10930+ // END android-removed 10931 10932 // 10933 // explicit params 10934 // 10935- AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, new DERNull()); 10936+ // BEGIN android-changed 10937+ AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE); 10938+ // END android-changed 10939 params.put("SHA1WITHRSAANDMGF1", creatPSSParams(sha1AlgId, 20)); 10940 10941- AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, new DERNull()); 10942- params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 10943- 10944- AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, new DERNull()); 10945+ // BEGIN android-removed 10946+ // // BEGIN android-changed 10947+ // AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, DERNull.INSTANCE); 10948+ // // END android-changed 10949+ // params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28)); 10950+ // END android-removed 10951+ 10952+ // BEGIN android-changed 10953+ AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, DERNull.INSTANCE); 10954+ // END android-changed 10955 params.put("SHA256WITHRSAANDMGF1", creatPSSParams(sha256AlgId, 32)); 10956 10957- AlgorithmIdentifier sha384AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384, new DERNull()); 10958+ // BEGIN android-changed 10959+ AlgorithmIdentifier sha384AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384, DERNull.INSTANCE); 10960+ // END android-changed 10961 params.put("SHA384WITHRSAANDMGF1", creatPSSParams(sha384AlgId, 48)); 10962 10963- AlgorithmIdentifier sha512AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha512, new DERNull()); 10964+ // BEGIN android-changed 10965+ AlgorithmIdentifier sha512AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha512, DERNull.INSTANCE); 10966+ // END android-changed 10967 params.put("SHA512WITHRSAANDMGF1", creatPSSParams(sha512AlgId, 64)); 10968 } 10969 10970@@ -166,7 +198,9 @@ 10971 } 10972 else 10973 { 10974- return new AlgorithmIdentifier(sigOid, new DERNull()); 10975+ // BEGIN android-changed 10976+ return new AlgorithmIdentifier(sigOid, DERNull.INSTANCE); 10977+ // END android-changed 10978 } 10979 } 10980 10981diff -Naur bcprov-jdk16-146.orig/org/bouncycastle/x509/extension/X509ExtensionUtil.java bcprov-jdk16-146/org/bouncycastle/x509/extension/X509ExtensionUtil.java 10982--- bcprov-jdk16-146.orig/org/bouncycastle/x509/extension/X509ExtensionUtil.java 2011-02-23 20:08:56.000000000 +0000 10983+++ bcprov-jdk16-146/org/bouncycastle/x509/extension/X509ExtensionUtil.java 2012-05-11 05:31:26.620725599 +0000 10984@@ -62,7 +62,9 @@ 10985 { 10986 GeneralName genName = GeneralName.getInstance(it.nextElement()); 10987 List list = new ArrayList(); 10988- list.add(new Integer(genName.getTagNo())); 10989+ // BEGIN android-changed 10990+ list.add(Integer.valueOf(genName.getTagNo())); 10991+ // END android-changed 10992 switch (genName.getTagNo()) 10993 { 10994 case GeneralName.ediPartyName: 10995