blob: e1f390363fa876407e01960a6443eb3542136327 [file] [log] [blame]
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/ASN1Null.java bcprov-jdk15on-150/org/bouncycastle/asn1/ASN1Null.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/ASN1Null.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/ASN1Null.java 2013-01-31 02:26:40.000000000 +0000
@@ -11,9 +11,11 @@
/**
* @deprecated use DERNull.INSTANCE
*/
- public ASN1Null()
+ // BEGIN android-changed
+ /*package*/ ASN1Null()
{
}
+ // END android-changed
public static ASN1Null getInstance(Object o)
{
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERBoolean.java bcprov-jdk15on-150/org/bouncycastle/asn1/DERBoolean.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERBoolean.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/DERBoolean.java 2013-12-12 00:35:05.000000000 +0000
@@ -10,7 +10,9 @@
private static final byte[] TRUE_VALUE = new byte[] { (byte)0xff };
private static final byte[] FALSE_VALUE = new byte[] { 0 };
- private byte[] value;
+ // BEGIN android-changed
+ final private byte[] value;
+ // END android-changed
public static final ASN1Boolean FALSE = new ASN1Boolean(false);
public static final ASN1Boolean TRUE = new ASN1Boolean(true);
@@ -55,6 +57,17 @@
return (value != 0 ? TRUE : FALSE);
}
+ // BEGIN android-added
+ /**
+ * return a DERBoolean from the passed in array.
+ */
+ public static DERBoolean getInstance(
+ byte[] octets)
+ {
+ return (octets[0] != 0) ? TRUE : FALSE;
+ }
+
+ // END android-added
/**
* return a Boolean from a tagged object.
*
@@ -80,7 +93,9 @@
}
}
- DERBoolean(
+ // BEGIN android-changed
+ protected DERBoolean(
+ // END android-changed
byte[] value)
{
if (value.length != 1)
@@ -106,8 +121,10 @@
* @deprecated use getInstance(boolean) method.
* @param value
*/
- public DERBoolean(
+ // BEGIN android-changed
+ protected DERBoolean(
boolean value)
+ // END android-changed
{
this.value = (value) ? TRUE_VALUE : FALSE_VALUE;
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERNull.java bcprov-jdk15on-150/org/bouncycastle/asn1/DERNull.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERNull.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/DERNull.java 2013-01-31 02:26:40.000000000 +0000
@@ -15,7 +15,9 @@
/**
* @deprecated use DERNull.INSTANCE
*/
- public DERNull()
+ // BEGIN android-changed
+ protected DERNull()
+ // END android-changed
{
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERObjectIdentifier.java bcprov-jdk15on-150/org/bouncycastle/asn1/DERObjectIdentifier.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERObjectIdentifier.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/DERObjectIdentifier.java 2013-12-12 00:35:05.000000000 +0000
@@ -162,7 +162,13 @@
}
}
- this.identifier = objId.toString();
+ // BEGIN android-changed
+ /*
+ * Intern the identifier so there aren't hundreds of duplicates
+ * (in practice).
+ */
+ this.identifier = objId.toString().intern();
+ // END android-changed
this.body = Arrays.clone(bytes);
}
@@ -181,7 +187,13 @@
throw new IllegalArgumentException("string " + identifier + " not an OID");
}
- this.identifier = identifier;
+ // BEGIN android-changed
+ /*
+ * Intern the identifier so there aren't hundreds of duplicates
+ * (in practice).
+ */
+ this.identifier = identifier.intern();
+ // END android-changed
}
DERObjectIdentifier(DERObjectIdentifier oid, String branchID)
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERPrintableString.java bcprov-jdk15on-150/org/bouncycastle/asn1/DERPrintableString.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/DERPrintableString.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/DERPrintableString.java 2013-01-31 02:26:40.000000000 +0000
@@ -12,7 +12,9 @@
extends ASN1Primitive
implements ASN1String
{
- private byte[] string;
+ // BEGIN android-changed
+ private final byte[] string;
+ // END android-changed
/**
* return a printable string from the passed in object.
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/StreamUtil.java bcprov-jdk15on-150/org/bouncycastle/asn1/StreamUtil.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/StreamUtil.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/StreamUtil.java 2014-05-05 17:17:14.000000000 +0000
@@ -8,7 +8,9 @@
class StreamUtil
{
- private static final long MAX_MEMORY = Runtime.getRuntime().maxMemory();
+ // BEGIN android-removed
+ // private static final long MAX_MEMORY = Runtime.getRuntime().maxMemory();
+ // END android-removed
/**
* Find out possible longest length...
@@ -48,12 +50,15 @@
}
}
- if (MAX_MEMORY > Integer.MAX_VALUE)
+ // BEGIN android-changed
+ long maxMemory = Runtime.getRuntime().maxMemory();
+ if (maxMemory > Integer.MAX_VALUE)
{
return Integer.MAX_VALUE;
}
- return (int)MAX_MEMORY;
+ return (int) maxMemory;
+ // END android-changed
}
static int calculateBodyLength(
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/cms/ContentInfo.java bcprov-jdk15on-150/org/bouncycastle/asn1/cms/ContentInfo.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/cms/ContentInfo.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/cms/ContentInfo.java 2013-12-12 00:35:05.000000000 +0000
@@ -28,7 +28,9 @@
*/
public class ContentInfo
extends ASN1Object
- implements CMSObjectIdentifiers
+ // BEGIN android-removed
+ // implements CMSObjectIdentifiers
+ // END android-removed
{
private ASN1ObjectIdentifier contentType;
private ASN1Encodable content;
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java bcprov-jdk15on-150/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2013-12-12 00:35:05.000000000 +0000
@@ -13,10 +13,12 @@
static final ASN1ObjectIdentifier pkcs_1 = new ASN1ObjectIdentifier("1.2.840.113549.1.1");
/** PKCS#1: 1.2.840.113549.1.1.1 */
static final ASN1ObjectIdentifier rsaEncryption = pkcs_1.branch("1");
- /** PKCS#1: 1.2.840.113549.1.1.2 */
- static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2");
- /** PKCS#1: 1.2.840.113549.1.1.3 */
- static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3");
+ // BEGIN android-removed
+ // /** PKCS#1: 1.2.840.113549.1.1.2 */
+ // static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2");
+ // /** PKCS#1: 1.2.840.113549.1.1.3 */
+ // static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3");
+ // END android-removed
/** PKCS#1: 1.2.840.113549.1.1.4 */
static final ASN1ObjectIdentifier md5WithRSAEncryption = pkcs_1.branch("4");
/** PKCS#1: 1.2.840.113549.1.1.5 */
@@ -96,15 +98,19 @@
// md2 OBJECT IDENTIFIER ::=
// {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 2}
//
- /** 1.2.840.113549.2.2 */
- static final ASN1ObjectIdentifier md2 = digestAlgorithm.branch("2");
+ // BEGIN android-removed
+ // /** 1.2.840.113549.2.2 */
+ // static final ASN1ObjectIdentifier md2 = digestAlgorithm.branch("2");
+ // END android-removed
//
// md4 OBJECT IDENTIFIER ::=
// {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 4}
//
- /** 1.2.840.113549.2.4 */
- static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4");
+ // BEGIN android-removed
+ // /** 1.2.840.113549.2.4 */
+ // static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4");
+ // END android-removed
//
// md5 OBJECT IDENTIFIER ::=
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java bcprov-jdk15on-150/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java 2013-05-25 02:14:15.000000000 +0000
@@ -14,7 +14,9 @@
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
+// BEGIN android-changed
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-changed
/**
* The AuthorityKeyIdentifier object.
@@ -106,7 +108,9 @@
public AuthorityKeyIdentifier(
SubjectPublicKeyInfo spki)
{
- Digest digest = new SHA1Digest();
+ // BEGIN android-changed
+ Digest digest = AndroidDigestFactory.getSHA1();
+ // END android-changed
byte[] resBuf = new byte[digest.getDigestSize()];
byte[] bytes = spki.getPublicKeyData().getBytes();
@@ -124,7 +128,9 @@
GeneralNames name,
BigInteger serialNumber)
{
- Digest digest = new SHA1Digest();
+ // BEGIN android-changed
+ Digest digest = AndroidDigestFactory.getSHA1();
+ // END android-changed
byte[] resBuf = new byte[digest.getDigestSize()];
byte[] bytes = spki.getPublicKeyData().getBytes();
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java bcprov-jdk15on-150/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java 2013-01-31 02:26:40.000000000 +0000
@@ -6,7 +6,9 @@
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
+// BEGIN android-changed
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-changed
/**
* The SubjectKeyIdentifier object.
@@ -124,7 +126,9 @@
private static byte[] getDigest(SubjectPublicKeyInfo spki)
{
- Digest digest = new SHA1Digest();
+ // BEGIN android-changed
+ Digest digest = AndroidDigestFactory.getSHA1();
+ // END android-changed
byte[] resBuf = new byte[digest.getDigestSize()];
byte[] bytes = spki.getPublicKeyData().getBytes();
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/X509Name.java bcprov-jdk15on-150/org/bouncycastle/asn1/x509/X509Name.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/X509Name.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/x509/X509Name.java 2013-12-12 00:35:05.000000000 +0000
@@ -255,8 +255,10 @@
*/
public static final Hashtable SymbolLookUp = DefaultLookUp;
- private static final Boolean TRUE = new Boolean(true); // for J2ME compatibility
- private static final Boolean FALSE = new Boolean(false);
+ // BEGIN android-changed
+ private static final Boolean TRUE = Boolean.TRUE;
+ private static final Boolean FALSE = Boolean.FALSE;
+ // END android-changed
static
{
@@ -446,7 +448,9 @@
throw new IllegalArgumentException("cannot encode value");
}
}
- added.addElement((i != 0) ? TRUE : FALSE); // to allow earlier JDK compatibility
+ // BEGIN android-changed
+ added.addElement(Boolean.valueOf(i != 0));
+ // END android-changed
}
}
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java bcprov-jdk15on-150/org/bouncycastle/asn1/x509/X509NameTokenizer.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2013-05-25 02:14:15.000000000 +0000
@@ -78,6 +78,17 @@
}
else
{
+ // BEGIN android-added
+ // copied from a newer version of BouncyCastle
+ if (c == '#' && buf.charAt(buf.length() - 1) == '=')
+ {
+ buf.append('\\');
+ }
+ else if (c == '+' && separator != '+')
+ {
+ buf.append('\\');
+ }
+ // END android-added
buf.append(c);
}
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x9/ECNamedCurveTable.java bcprov-jdk15on-150/org/bouncycastle/asn1/x9/ECNamedCurveTable.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/asn1/x9/ECNamedCurveTable.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/asn1/x9/ECNamedCurveTable.java 2013-12-12 00:35:05.000000000 +0000
@@ -6,7 +6,9 @@
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.nist.NISTNamedCurves;
import org.bouncycastle.asn1.sec.SECNamedCurves;
-import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
+// BEGIN android-removed
+// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
+// END android-removed
/**
* A general class that reads all X9.62 style EC curve tables.
@@ -30,10 +32,12 @@
ecP = SECNamedCurves.getByName(name);
}
- if (ecP == null)
- {
- ecP = TeleTrusTNamedCurves.getByName(name);
- }
+ // BEGIN android-removed
+ // if (ecP == null)
+ // {
+ // ecP = TeleTrusTNamedCurves.getByName(name);
+ // }
+ // END android-removed
if (ecP == null)
{
@@ -60,10 +64,12 @@
ecP = SECNamedCurves.getByOID(oid);
}
- if (ecP == null)
- {
- ecP = TeleTrusTNamedCurves.getByOID(oid);
- }
+ // BEGIN android-removed
+ // if (ecP == null)
+ // {
+ // ecP = TeleTrusTNamedCurves.getByOID(oid);
+ // }
+ // END android-removed
// NOTE: All the NIST curves are currently from SEC, so no point in redundant OID lookup
@@ -82,7 +88,9 @@
addEnumeration(v, X962NamedCurves.getNames());
addEnumeration(v, SECNamedCurves.getNames());
addEnumeration(v, NISTNamedCurves.getNames());
- addEnumeration(v, TeleTrusTNamedCurves.getNames());
+ // BEGIN android-removed
+ // addEnumeration(v, TeleTrusTNamedCurves.getNames());
+ // END android-removed
return v.elements();
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactory.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 1970-01-01 00:00:00.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 2013-09-26 18:06:21.000000000 +0000
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.bouncycastle.crypto.digests;
+
+import org.bouncycastle.crypto.Digest;
+
+/**
+ * Level of indirection to let us select OpenSSLDigest implementations
+ * for libcore but fallback to BouncyCastle ones on the RI.
+ */
+public final class AndroidDigestFactory {
+ private static final String OpenSSLFactoryClassName
+ = AndroidDigestFactory.class.getName() + "OpenSSL";
+ private static final String BouncyCastleFactoryClassName
+ = AndroidDigestFactory.class.getName() + "BouncyCastle";
+
+ private static final AndroidDigestFactoryInterface FACTORY;
+ static {
+ Class factoryImplementationClass;
+ try {
+ factoryImplementationClass = Class.forName(OpenSSLFactoryClassName);
+ // Double check for NativeCrypto in case we are running on RI for testing
+ Class.forName("com.android.org.conscrypt.NativeCrypto");
+ } catch (ClassNotFoundException e1) {
+ try {
+ factoryImplementationClass = Class.forName(BouncyCastleFactoryClassName);
+ } catch (ClassNotFoundException e2) {
+ AssertionError e = new AssertionError("Failed to load "
+ + "AndroidDigestFactoryInterface "
+ + "implementation. Looked for "
+ + OpenSSLFactoryClassName + " and "
+ + BouncyCastleFactoryClassName);
+ e.initCause(e1);
+ throw e;
+ }
+ }
+ if (!AndroidDigestFactoryInterface.class.isAssignableFrom(factoryImplementationClass)) {
+ throw new AssertionError(factoryImplementationClass
+ + "does not implement AndroidDigestFactoryInterface");
+ }
+ try {
+ FACTORY = (AndroidDigestFactoryInterface) factoryImplementationClass.newInstance();
+ } catch (InstantiationException e) {
+ throw new AssertionError(e);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public static Digest getMD5() {
+ return FACTORY.getMD5();
+ }
+
+ public static Digest getSHA1() {
+ return FACTORY.getSHA1();
+ }
+
+ public static Digest getSHA224() {
+ return FACTORY.getSHA224();
+ }
+
+ public static Digest getSHA256() {
+ return FACTORY.getSHA256();
+ }
+
+ public static Digest getSHA384() {
+ return FACTORY.getSHA384();
+ }
+
+ public static Digest getSHA512() {
+ return FACTORY.getSHA512();
+ }
+}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java 1970-01-01 00:00:00.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java 2013-09-26 18:06:21.000000000 +0000
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.bouncycastle.crypto.digests;
+
+import org.bouncycastle.crypto.Digest;
+
+public class AndroidDigestFactoryBouncyCastle implements AndroidDigestFactoryInterface {
+ public Digest getMD5() {
+ return new MD5Digest();
+ }
+ public Digest getSHA1() {
+ return new SHA1Digest();
+ }
+ public Digest getSHA224() {
+ return new SHA224Digest();
+ }
+ public Digest getSHA256() {
+ return new SHA256Digest();
+ }
+ public Digest getSHA384() {
+ return new SHA384Digest();
+ }
+ public Digest getSHA512() {
+ return new SHA512Digest();
+ }
+}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java 1970-01-01 00:00:00.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java 2013-09-26 18:06:21.000000000 +0000
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.bouncycastle.crypto.digests;
+
+import org.bouncycastle.crypto.Digest;
+
+interface AndroidDigestFactoryInterface {
+ public Digest getMD5();
+ public Digest getSHA1();
+ public Digest getSHA224();
+ public Digest getSHA256();
+ public Digest getSHA384();
+ public Digest getSHA512();
+}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java 1970-01-01 00:00:00.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java 2013-09-26 18:06:21.000000000 +0000
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.bouncycastle.crypto.digests;
+
+import org.bouncycastle.crypto.Digest;
+
+public class AndroidDigestFactoryOpenSSL implements AndroidDigestFactoryInterface {
+ public Digest getMD5() {
+ return new OpenSSLDigest.MD5();
+ }
+ public Digest getSHA1() {
+ return new OpenSSLDigest.SHA1();
+ }
+ public Digest getSHA224() {
+ return new OpenSSLDigest.SHA224();
+ }
+ public Digest getSHA256() {
+ return new OpenSSLDigest.SHA256();
+ }
+ public Digest getSHA384() {
+ return new OpenSSLDigest.SHA384();
+ }
+ public Digest getSHA512() {
+ return new OpenSSLDigest.SHA512();
+ }
+}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java bcprov-jdk15on-150/org/bouncycastle/crypto/digests/OpenSSLDigest.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java 1970-01-01 00:00:00.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/digests/OpenSSLDigest.java 2014-02-27 18:09:19.000000000 +0000
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.bouncycastle.crypto.digests;
+
+import org.bouncycastle.crypto.ExtendedDigest;
+import org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi;
+import java.security.DigestException;
+import java.security.MessageDigest;
+
+/**
+ * Implements the BouncyCastle Digest interface using OpenSSL's EVP API. This
+ * must be an ExtendedDigest for {@link BcKeyStoreSpi} to be able to use it.
+ */
+public class OpenSSLDigest implements ExtendedDigest {
+ private final MessageDigest delegate;
+
+ private final int byteSize;
+
+ public OpenSSLDigest(String algorithm, int byteSize) {
+ try {
+ delegate = MessageDigest.getInstance(algorithm, "AndroidOpenSSL");
+ this.byteSize = byteSize;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String getAlgorithmName() {
+ return delegate.getAlgorithm();
+ }
+
+ public int getDigestSize() {
+ return delegate.getDigestLength();
+ }
+
+ public int getByteLength() {
+ return byteSize;
+ }
+
+ public void reset() {
+ delegate.reset();
+ }
+
+ public void update(byte in) {
+ delegate.update(in);
+ }
+
+ public void update(byte[] in, int inOff, int len) {
+ delegate.update(in, inOff, len);
+ }
+
+ public int doFinal(byte[] out, int outOff) {
+ try {
+ return delegate.digest(out, outOff, out.length - outOff);
+ } catch (DigestException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static class MD5 extends OpenSSLDigest {
+ public MD5() { super("MD5", 64); }
+ }
+
+ public static class SHA1 extends OpenSSLDigest {
+ public SHA1() { super("SHA-1", 64); }
+ }
+
+ public static class SHA224 extends OpenSSLDigest {
+ public SHA224() { super("SHA-224", 64); }
+ }
+
+ public static class SHA256 extends OpenSSLDigest {
+ public SHA256() { super("SHA-256", 64); }
+ }
+
+ public static class SHA384 extends OpenSSLDigest {
+ public SHA384() { super("SHA-384", 128); }
+ }
+
+ public static class SHA512 extends OpenSSLDigest {
+ public SHA512() { super("SHA-512", 128); }
+ }
+}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/encodings/OAEPEncoding.java bcprov-jdk15on-150/org/bouncycastle/crypto/encodings/OAEPEncoding.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/encodings/OAEPEncoding.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/encodings/OAEPEncoding.java 2013-05-25 02:14:15.000000000 +0000
@@ -6,7 +6,9 @@
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.InvalidCipherTextException;
-import org.bouncycastle.crypto.digests.SHA1Digest;
+// BEGIN android-changed
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-changed
import org.bouncycastle.crypto.params.ParametersWithRandom;
/**
@@ -25,7 +27,9 @@
public OAEPEncoding(
AsymmetricBlockCipher cipher)
{
- this(cipher, new SHA1Digest(), null);
+ // BEGIN android-changed
+ this(cipher, AndroidDigestFactory.getSHA1(), null);
+ // END android-changed
}
public OAEPEncoding(
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/encodings/PKCS1Encoding.java bcprov-jdk15on-150/org/bouncycastle/crypto/encodings/PKCS1Encoding.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/encodings/PKCS1Encoding.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/encodings/PKCS1Encoding.java 2013-01-31 02:26:40.000000000 +0000
@@ -216,6 +216,12 @@
throw new InvalidCipherTextException("unknown block type");
}
}
+ // BEGIN android-added
+ if ((type == 1 && forPrivateKey) || (type == 2 && !forPrivateKey))
+ {
+ throw new InvalidCipherTextException("invalid block type " + type);
+ }
+ // END android-added
if (useStrictLength && block.length != engine.getOutputBlockSize())
{
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/engines/DESedeWrapEngine.java bcprov-jdk15on-150/org/bouncycastle/crypto/engines/DESedeWrapEngine.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/engines/DESedeWrapEngine.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/engines/DESedeWrapEngine.java 2012-09-17 23:04:47.000000000 +0000
@@ -6,7 +6,9 @@
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.InvalidCipherTextException;
import org.bouncycastle.crypto.Wrapper;
-import org.bouncycastle.crypto.digests.SHA1Digest;
+// BEGIN android-changed
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-changed
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;
@@ -52,7 +54,9 @@
//
// checksum digest
//
- Digest sha1 = new SHA1Digest();
+ // BEGIN android-changed
+ Digest sha1 = AndroidDigestFactory.getSHA1();
+ // END android-changed
byte[] digest = new byte[20];
/**
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java bcprov-jdk15on-150/org/bouncycastle/crypto/generators/DHParametersHelper.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/generators/DHParametersHelper.java 2012-09-17 23:04:47.000000000 +0000
@@ -3,10 +3,17 @@
import java.math.BigInteger;
import java.security.SecureRandom;
+// BEGIN android-added
+import java.util.logging.Logger;
+// END android-added
import org.bouncycastle.util.BigIntegers;
class DHParametersHelper
{
+ // BEGIN android-added
+ private static final Logger logger = Logger.getLogger(DHParametersHelper.class.getName());
+ // END android-added
+
private static final BigInteger ONE = BigInteger.valueOf(1);
private static final BigInteger TWO = BigInteger.valueOf(2);
@@ -17,11 +24,19 @@
*/
static BigInteger[] generateSafePrimes(int size, int certainty, SecureRandom random)
{
+ // BEGIN android-added
+ logger.info("Generating safe primes. This may take a long time.");
+ long start = System.currentTimeMillis();
+ int tries = 0;
+ // END android-added
BigInteger p, q;
int qLength = size - 1;
for (;;)
{
+ // BEGIN android-added
+ tries++;
+ // END android-added
q = new BigInteger(qLength, 2, random);
// p <- 2q + 1
@@ -32,6 +47,11 @@
break;
}
}
+ // BEGIN android-added
+ long end = System.currentTimeMillis();
+ long duration = end - start;
+ logger.info("Generated safe primes: " + tries + " tries took " + duration + "ms");
+ // END android-added
return new BigInteger[] { p, q };
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/DSAParametersGenerator.java bcprov-jdk15on-150/org/bouncycastle/crypto/generators/DSAParametersGenerator.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/DSAParametersGenerator.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/generators/DSAParametersGenerator.java 2013-12-12 00:35:05.000000000 +0000
@@ -4,7 +4,9 @@
import java.security.SecureRandom;
import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
+// BEGIN android-changed
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-changed
import org.bouncycastle.crypto.params.DSAParameterGenerationParameters;
import org.bouncycastle.crypto.params.DSAParameters;
import org.bouncycastle.crypto.params.DSAValidationParameters;
@@ -31,7 +33,9 @@
public DSAParametersGenerator()
{
- this(new SHA1Digest());
+ // BEGIN android-changed
+ this(AndroidDigestFactory.getSHA1());
+ // END android-changed
}
public DSAParametersGenerator(Digest digest)
@@ -122,7 +126,9 @@
int n = (L - 1) / 160;
byte[] w = new byte[L / 8];
- if (!(digest instanceof SHA1Digest))
+ // BEGIN android-changed
+ if (!(digest.getAlgorithmName().equals("SHA-1")))
+ // END android-changed
{
throw new IllegalStateException("can only use SHA-1 for generating FIPS 186-2 parameters");
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java bcprov-jdk15on-150/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java 2012-09-17 23:04:47.000000000 +0000
@@ -3,7 +3,9 @@
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.PBEParametersGenerator;
-import org.bouncycastle.crypto.digests.MD5Digest;
+// BEGIN android-changed
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-changed
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;
@@ -17,7 +19,9 @@
public class OpenSSLPBEParametersGenerator
extends PBEParametersGenerator
{
- private Digest digest = new MD5Digest();
+ // BEGIN android-changed
+ private Digest digest = AndroidDigestFactory.getMD5();
+ // END android-changed
/**
* Construct a OpenSSL Parameters generator.
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java bcprov-jdk15on-150/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java 2013-12-12 00:35:05.000000000 +0000
@@ -4,7 +4,9 @@
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.Mac;
import org.bouncycastle.crypto.PBEParametersGenerator;
-import org.bouncycastle.crypto.digests.SHA1Digest;
+// BEGIN android-changed
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-changed
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;
@@ -28,7 +30,9 @@
*/
public PKCS5S2ParametersGenerator()
{
- this(new SHA1Digest());
+ // BEGIN android-changed
+ this(AndroidDigestFactory.getSHA1());
+ // END android-changed
}
public PKCS5S2ParametersGenerator(Digest digest)
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/macs/HMac.java bcprov-jdk15on-150/org/bouncycastle/crypto/macs/HMac.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/macs/HMac.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/macs/HMac.java 2013-09-26 18:06:21.000000000 +0000
@@ -36,14 +36,18 @@
{
blockLengths = new Hashtable();
- blockLengths.put("GOST3411", Integers.valueOf(32));
-
- blockLengths.put("MD2", Integers.valueOf(16));
- blockLengths.put("MD4", Integers.valueOf(64));
+ // BEGIN android-removed
+ // blockLengths.put("GOST3411", Integers.valueOf(32));
+ //
+ // blockLengths.put("MD2", Integers.valueOf(16));
+ // blockLengths.put("MD4", Integers.valueOf(64));
+ // END android-removed
blockLengths.put("MD5", Integers.valueOf(64));
- blockLengths.put("RIPEMD128", Integers.valueOf(64));
- blockLengths.put("RIPEMD160", Integers.valueOf(64));
+ // BEGIN android-removed
+ // blockLengths.put("RIPEMD128", Integers.valueOf(64));
+ // blockLengths.put("RIPEMD160", Integers.valueOf(64));
+ // END android-removed
blockLengths.put("SHA-1", Integers.valueOf(64));
blockLengths.put("SHA-224", Integers.valueOf(64));
@@ -51,8 +55,10 @@
blockLengths.put("SHA-384", Integers.valueOf(128));
blockLengths.put("SHA-512", Integers.valueOf(128));
- blockLengths.put("Tiger", Integers.valueOf(64));
- blockLengths.put("Whirlpool", Integers.valueOf(64));
+ // BEGIN android-removed
+ // blockLengths.put("Tiger", Integers.valueOf(64));
+ // blockLengths.put("Whirlpool", Integers.valueOf(64));
+ // END android-removed
}
private static int getByteLength(
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/modes/GCMBlockCipher.java bcprov-jdk15on-150/org/bouncycastle/crypto/modes/GCMBlockCipher.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/modes/GCMBlockCipher.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/modes/GCMBlockCipher.java 2013-01-31 02:26:40.000000000 +0000
@@ -22,6 +22,11 @@
implements AEADBlockCipher
{
private static final int BLOCK_SIZE = 16;
+ // BEGIN android-added
+ // 2^36-32 : limitation imposed by NIST GCM as otherwise the counter is wrapped and it can leak
+ // plaintext and authentication key
+ private static final long MAX_INPUT_SIZE = 68719476704L;
+ // END android-added
// not final due to a compiler bug
private BlockCipher cipher;
@@ -194,6 +199,14 @@
return totalData < macSize ? 0 : totalData - macSize;
}
+ // BEGIN android-added
+ /** Helper used to ensure that {@link #MAX_INPUT_SIZE} is not exceeded. */
+ private long getTotalInputSizeAfterNewInput(int newInputLen)
+ {
+ return totalLength + newInputLen + bufOff;
+ }
+ // END android-added
+
public int getUpdateOutputSize(int len)
{
int totalData = len + bufOff;
@@ -210,6 +223,11 @@
public void processAADByte(byte in)
{
+ // BEGIN android-added
+ if (getTotalInputSizeAfterNewInput(1) > MAX_INPUT_SIZE) {
+ throw new DataLengthException("Input exceeded " + MAX_INPUT_SIZE + " bytes");
+ }
+ // END android-added
atBlock[atBlockPos] = in;
if (++atBlockPos == BLOCK_SIZE)
{
@@ -222,6 +240,11 @@
public void processAADBytes(byte[] in, int inOff, int len)
{
+ // BEGIN android-added
+ if (getTotalInputSizeAfterNewInput(len) > MAX_INPUT_SIZE) {
+ throw new DataLengthException("Input exceeded " + MAX_INPUT_SIZE + " bytes");
+ }
+ // END android-added
for (int i = 0; i < len; ++i)
{
atBlock[atBlockPos] = in[inOff + i];
@@ -259,6 +282,11 @@
public int processByte(byte in, byte[] out, int outOff)
throws DataLengthException
{
+ // BEGIN android-added
+ if (getTotalInputSizeAfterNewInput(1) > MAX_INPUT_SIZE) {
+ throw new DataLengthException("Input exceeded " + MAX_INPUT_SIZE + " bytes");
+ }
+ // END android-added
bufBlock[bufOff] = in;
if (++bufOff == bufBlock.length)
{
@@ -271,6 +299,11 @@
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)
throws DataLengthException
{
+ // BEGIN android-added
+ if (getTotalInputSizeAfterNewInput(len) > MAX_INPUT_SIZE) {
+ throw new DataLengthException("Input exceeded " + MAX_INPUT_SIZE + " bytes");
+ }
+ // END android-added
int resultLen = 0;
for (int i = 0; i < len; ++i)
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java bcprov-jdk15on-150/org/bouncycastle/crypto/signers/RSADigestSigner.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/signers/RSADigestSigner.java 2013-12-12 00:35:05.000000000 +0000
@@ -39,9 +39,11 @@
*/
static
{
- oidMap.put("RIPEMD128", TeleTrusTObjectIdentifiers.ripemd128);
- oidMap.put("RIPEMD160", TeleTrusTObjectIdentifiers.ripemd160);
- oidMap.put("RIPEMD256", TeleTrusTObjectIdentifiers.ripemd256);
+ // BEGIN android-removed
+ // oidMap.put("RIPEMD128", TeleTrusTObjectIdentifiers.ripemd128);
+ // oidMap.put("RIPEMD160", TeleTrusTObjectIdentifiers.ripemd160);
+ // oidMap.put("RIPEMD256", TeleTrusTObjectIdentifiers.ripemd256);
+ // END android-removed
oidMap.put("SHA-1", X509ObjectIdentifiers.id_SHA1);
oidMap.put("SHA-224", NISTObjectIdentifiers.id_sha224);
@@ -49,8 +51,10 @@
oidMap.put("SHA-384", NISTObjectIdentifiers.id_sha384);
oidMap.put("SHA-512", NISTObjectIdentifiers.id_sha512);
- oidMap.put("MD2", PKCSObjectIdentifiers.md2);
- oidMap.put("MD4", PKCSObjectIdentifiers.md4);
+ // BEGIN android-removed
+ // oidMap.put("MD2", PKCSObjectIdentifiers.md2);
+ // oidMap.put("MD4", PKCSObjectIdentifiers.md4);
+ // END android-removed
oidMap.put("MD5", PKCSObjectIdentifiers.md5);
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java bcprov-jdk15on-150/org/bouncycastle/crypto/util/PrivateKeyFactory.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2013-12-12 00:35:05.000000000 +0000
@@ -10,7 +10,9 @@
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.oiw.ElGamalParameter;
+// BEGIN android-removed
+// import org.bouncycastle.asn1.oiw.ElGamalParameter;
+// END android-removed
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.DHParameter;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
@@ -30,8 +32,10 @@
import org.bouncycastle.crypto.params.DSAPrivateKeyParameters;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
-import org.bouncycastle.crypto.params.ElGamalParameters;
-import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.params.ElGamalParameters;
+// import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters;
+// END android-removed
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
/**
@@ -97,14 +101,16 @@
return new DHPrivateKeyParameters(derX.getValue(), dhParams);
}
- else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm))
- {
- ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters());
- ASN1Integer derX = (ASN1Integer)keyInfo.parsePrivateKey();
-
- return new ElGamalPrivateKeyParameters(derX.getValue(), new ElGamalParameters(
- params.getP(), params.getG()));
- }
+ // BEGIN android-removed
+ // else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm))
+ // {
+ // ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters());
+ // ASN1Integer = (ASN1Integer)keyInfo.parsePrivateKey();
+ //
+ // return new ElGamalPrivateKeyParameters(derX.getValue(), new ElGamalParameters(
+ // params.getP(), params.getG()));
+ // }
+ // END android-removed
else if (algId.getAlgorithm().equals(X9ObjectIdentifiers.id_dsa))
{
ASN1Integer derX = (ASN1Integer)keyInfo.parsePrivateKey();
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java bcprov-jdk15on-150/org/bouncycastle/crypto/util/PublicKeyFactory.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/crypto/util/PublicKeyFactory.java 2013-12-12 00:35:05.000000000 +0000
@@ -12,7 +12,9 @@
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.oiw.ElGamalParameter;
+// BEGIN android-removed
+// import org.bouncycastle.asn1.oiw.ElGamalParameter;
+// END android-removed
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.DHParameter;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
@@ -37,8 +39,10 @@
import org.bouncycastle.crypto.params.DSAPublicKeyParameters;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
-import org.bouncycastle.crypto.params.ElGamalParameters;
-import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.params.ElGamalParameters;
+// import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters;
+// END android-removed
import org.bouncycastle.crypto.params.RSAKeyParameters;
/**
@@ -132,14 +136,16 @@
return new DHPublicKeyParameters(derY.getValue(), dhParams);
}
- else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm))
- {
- ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters());
- ASN1Integer derY = (ASN1Integer)keyInfo.parsePublicKey();
-
- return new ElGamalPublicKeyParameters(derY.getValue(), new ElGamalParameters(
- params.getP(), params.getG()));
- }
+ // BEGIN android-removed
+ // else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm))
+ // {
+ // ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters());
+ // ASN1Integer derY = (ASN1Integer)keyInfo.parsePublicKey();
+ //
+ // return new ElGamalPublicKeyParameters(derY.getValue(), new ElGamalParameters(
+ // params.getP(), params.getG()));
+ // }
+ // END android-removed
else if (algId.getAlgorithm().equals(X9ObjectIdentifiers.id_dsa)
|| algId.getAlgorithm().equals(OIWObjectIdentifiers.dsaWithSHA1))
{
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/DH.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/DH.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/DH.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/DH.java 2014-05-08 00:26:23.000000000 +0000
@@ -1,7 +1,14 @@
package org.bouncycastle.jcajce.provider.asymmetric;
+// BEGIN android-added
+import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
+import org.bouncycastle.jcajce.provider.asymmetric.dh.KeyFactorySpi;
+// END android-added
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
import org.bouncycastle.jcajce.provider.util.AsymmetricAlgorithmProvider;
+// BEGIN android-added
+import org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter;
+// END android-added
public class DH
{
@@ -24,6 +31,10 @@
provider.addAlgorithm("KeyFactory.DH", PREFIX + "KeyFactorySpi");
provider.addAlgorithm("Alg.Alias.KeyFactory.DIFFIEHELLMAN", "DH");
+ // BEGIN android-added
+ AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();
+ registerOid(provider, PKCSObjectIdentifiers.dhKeyAgreement, "DH", keyFact);
+ // END android-added
provider.addAlgorithm("AlgorithmParameters.DH", PREFIX + "AlgorithmParametersSpi");
provider.addAlgorithm("Alg.Alias.AlgorithmParameters.DIFFIEHELLMAN", "DH");
@@ -32,10 +43,12 @@
provider.addAlgorithm("AlgorithmParameterGenerator.DH", PREFIX + "AlgorithmParameterGeneratorSpi");
- provider.addAlgorithm("Cipher.DHIES", PREFIX + "IESCipher$IES");
- provider.addAlgorithm("Cipher.DHIESwithAES", PREFIX + "IESCipher$IESwithAES");
- provider.addAlgorithm("Cipher.DHIESWITHAES", PREFIX + "IESCipher$IESwithAES");
- provider.addAlgorithm("Cipher.DHIESWITHDESEDE", PREFIX + "IESCipher$IESwithDESede");
+ // BEGIN android-removed
+ // provider.addAlgorithm("Cipher.DHIES", PREFIX + "IESCipher$IES");
+ // provider.addAlgorithm("Cipher.DHIESwithAES", PREFIX + "IESCipher$IESwithAES");
+ // provider.addAlgorithm("Cipher.DHIESWITHAES", PREFIX + "IESCipher$IESwithAES");
+ // provider.addAlgorithm("Cipher.DHIESWITHDESEDE", PREFIX + "IESCipher$IESwithDESede");
+ // END android-removed
}
}
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/DSA.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/DSA.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/DSA.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/DSA.java 2013-12-16 16:39:58.000000000 +0000
@@ -27,40 +27,53 @@
provider.addAlgorithm("KeyPairGenerator.DSA", PREFIX + "KeyPairGeneratorSpi");
provider.addAlgorithm("KeyFactory.DSA", PREFIX + "KeyFactorySpi");
- provider.addAlgorithm("Signature.DSA", PREFIX + "DSASigner$stdDSA");
+ // BEGIN android-changed
+ provider.addAlgorithm("Signature.SHA1withDSA", PREFIX + "DSASigner$stdDSA");
+ // END android-changed
provider.addAlgorithm("Signature.NONEWITHDSA", PREFIX + "DSASigner$noneDSA");
provider.addAlgorithm("Alg.Alias.Signature.RAWDSA", "NONEWITHDSA");
- provider.addAlgorithm("Signature.DETDSA", PREFIX + "DSASigner$detDSA");
- provider.addAlgorithm("Signature.SHA1WITHDETDSA", PREFIX + "DSASigner$detDSA");
- provider.addAlgorithm("Signature.SHA224WITHDETDSA", PREFIX + "DSASigner$detDSA224");
- provider.addAlgorithm("Signature.SHA256WITHDETDSA", PREFIX + "DSASigner$detDSA256");
- provider.addAlgorithm("Signature.SHA384WITHDETDSA", PREFIX + "DSASigner$detDSA384");
- provider.addAlgorithm("Signature.SHA512WITHDETDSA", PREFIX + "DSASigner$detDSA512");
+ // BEGIN android-removed
+ // provider.addAlgorithm("Signature.DETDSA", PREFIX + "DSASigner$detDSA");
+ // provider.addAlgorithm("Signature.SHA1WITHDETDSA", PREFIX + "DSASigner$detDSA");
+ // provider.addAlgorithm("Signature.SHA224WITHDETDSA", PREFIX + "DSASigner$detDSA224");
+ // provider.addAlgorithm("Signature.SHA256WITHDETDSA", PREFIX + "DSASigner$detDSA256");
+ // provider.addAlgorithm("Signature.SHA384WITHDETDSA", PREFIX + "DSASigner$detDSA384");
+ // provider.addAlgorithm("Signature.SHA512WITHDETDSA", PREFIX + "DSASigner$detDSA512");
+ // END android-removed
addSignatureAlgorithm(provider, "SHA224", "DSA", PREFIX + "DSASigner$dsa224", NISTObjectIdentifiers.dsa_with_sha224);
addSignatureAlgorithm(provider, "SHA256", "DSA", PREFIX + "DSASigner$dsa256", NISTObjectIdentifiers.dsa_with_sha256);
- addSignatureAlgorithm(provider, "SHA384", "DSA", PREFIX + "DSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384);
- addSignatureAlgorithm(provider, "SHA512", "DSA", PREFIX + "DSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512);
+ // BEGIN android-removed
+ // addSignatureAlgorithm(provider, "SHA384", "DSA", PREFIX + "DSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384);
+ // addSignatureAlgorithm(provider, "SHA512", "DSA", PREFIX + "DSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512);
+ // END android-removed
+
+ // BEGIN android-added
+ provider.addAlgorithm("Alg.Alias.Signature.DSA", "SHA1withDSA");
+ // END android-added
+ // BEGIN android-changed
+ provider.addAlgorithm("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.SHA1withDSA", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHDSA", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.DSAwithSHA1", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.DSAWITHSHA1", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.SHA1WithDSA", "SHA1withDSA");
+ provider.addAlgorithm("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA");
- provider.addAlgorithm("Alg.Alias.Signature.SHA/DSA", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.SHA1withDSA", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHDSA", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.DSAwithSHA1", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.DSAWITHSHA1", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.SHA1WithDSA", "DSA");
- provider.addAlgorithm("Alg.Alias.Signature.DSAWithSHA1", "DSA");
-
- provider.addAlgorithm("Alg.Alias.Signature.1.2.840.10040.4.3", "DSA");
+ provider.addAlgorithm("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA");
+ // END android-changed
AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();
for (int i = 0; i != DSAUtil.dsaOids.length; i++)
{
- provider.addAlgorithm("Alg.Alias.Signature." + DSAUtil.dsaOids[i], "DSA");
+ // BEGIN android-changed
+ provider.addAlgorithm("Alg.Alias.Signature." + DSAUtil.dsaOids[i], "SHA1withDSA");
+ // END android-changed
registerOid(provider, DSAUtil.dsaOids[i], "DSA", keyFact);
registerOidAlgorithmParameters(provider, DSAUtil.dsaOids[i], "DSA");
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/EC.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/EC.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/EC.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/EC.java 2013-12-12 00:35:05.000000000 +0000
@@ -1,7 +1,9 @@
package org.bouncycastle.jcajce.provider.asymmetric;
-import org.bouncycastle.asn1.eac.EACObjectIdentifiers;
-import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
+// BEGIN android-removed
+// import org.bouncycastle.asn1.eac.EACObjectIdentifiers;
+// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
+// END android-removed
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
import org.bouncycastle.jcajce.provider.asymmetric.ec.KeyFactorySpi;
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
@@ -21,39 +23,49 @@
public void configure(ConfigurableProvider provider)
{
provider.addAlgorithm("KeyAgreement.ECDH", PREFIX + "KeyAgreementSpi$DH");
- provider.addAlgorithm("KeyAgreement.ECDHC", PREFIX + "KeyAgreementSpi$DHC");
- provider.addAlgorithm("KeyAgreement.ECMQV", PREFIX + "KeyAgreementSpi$MQV");
- provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$DHwithSHA1KDF");
- provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$MQVwithSHA1KDF");
+ // BEGIN android-removed
+ // provider.addAlgorithm("KeyAgreement.ECDHC", PREFIX + "KeyAgreementSpi$DHC");
+ // provider.addAlgorithm("KeyAgreement.ECMQV", PREFIX + "KeyAgreementSpi$MQV");
+ // provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$DHwithSHA1KDF");
+ // provider.addAlgorithm("KeyAgreement." + X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, PREFIX + "KeyAgreementSpi$MQVwithSHA1KDF");
+ // END android-removed
registerOid(provider, X9ObjectIdentifiers.id_ecPublicKey, "EC", new KeyFactorySpi.EC());
// TODO Should this be an alias for ECDH?
registerOid(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC", new KeyFactorySpi.EC());
- registerOid(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV());
-
- registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.id_ecPublicKey, "EC");
- // TODO Should this be an alias for ECDH?
- registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC");
- registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "EC");
+ // BEGIN android-removed
+ // registerOid(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV());
+ // END android-removed
+
+ // BEGIN android-removed
+ // registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.id_ecPublicKey, "EC");
+ // // TODO Should this be an alias for ECDH?
+ // registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC");
+ // registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "EC");
+ // END android-removed
provider.addAlgorithm("KeyFactory.EC", PREFIX + "KeyFactorySpi$EC");
- provider.addAlgorithm("KeyFactory.ECDSA", PREFIX + "KeyFactorySpi$ECDSA");
- provider.addAlgorithm("KeyFactory.ECDH", PREFIX + "KeyFactorySpi$ECDH");
- provider.addAlgorithm("KeyFactory.ECDHC", PREFIX + "KeyFactorySpi$ECDHC");
- provider.addAlgorithm("KeyFactory.ECMQV", PREFIX + "KeyFactorySpi$ECMQV");
+ // BEGIN android-removed
+ // provider.addAlgorithm("KeyFactory.ECDSA", PREFIX + "KeyFactorySpi$ECDSA");
+ // provider.addAlgorithm("KeyFactory.ECDH", PREFIX + "KeyFactorySpi$ECDH");
+ // provider.addAlgorithm("KeyFactory.ECDHC", PREFIX + "KeyFactorySpi$ECDHC");
+ // provider.addAlgorithm("KeyFactory.ECMQV", PREFIX + "KeyFactorySpi$ECMQV");
+ // END android-removed
provider.addAlgorithm("KeyPairGenerator.EC", PREFIX + "KeyPairGeneratorSpi$EC");
- provider.addAlgorithm("KeyPairGenerator.ECDSA", PREFIX + "KeyPairGeneratorSpi$ECDSA");
- provider.addAlgorithm("KeyPairGenerator.ECDH", PREFIX + "KeyPairGeneratorSpi$ECDH");
- provider.addAlgorithm("KeyPairGenerator.ECDHC", PREFIX + "KeyPairGeneratorSpi$ECDHC");
- provider.addAlgorithm("KeyPairGenerator.ECIES", PREFIX + "KeyPairGeneratorSpi$ECDH");
- provider.addAlgorithm("KeyPairGenerator.ECMQV", PREFIX + "KeyPairGeneratorSpi$ECMQV");
-
- provider.addAlgorithm("Cipher.ECIES", PREFIX + "IESCipher$ECIES");
- provider.addAlgorithm("Cipher.ECIESwithAES", PREFIX + "IESCipher$ECIESwithAES");
- provider.addAlgorithm("Cipher.ECIESWITHAES", PREFIX + "IESCipher$ECIESwithAES");
- provider.addAlgorithm("Cipher.ECIESwithDESEDE", PREFIX + "IESCipher$ECIESwithDESede");
- provider.addAlgorithm("Cipher.ECIESWITHDESEDE", PREFIX + "IESCipher$ECIESwithDESede");
+ // BEGIN android-removed
+ // provider.addAlgorithm("KeyPairGenerator.ECDSA", PREFIX + "KeyPairGeneratorSpi$ECDSA");
+ // provider.addAlgorithm("KeyPairGenerator.ECDH", PREFIX + "KeyPairGeneratorSpi$ECDH");
+ // provider.addAlgorithm("KeyPairGenerator.ECDHC", PREFIX + "KeyPairGeneratorSpi$ECDHC");
+ // provider.addAlgorithm("KeyPairGenerator.ECIES", PREFIX + "KeyPairGeneratorSpi$ECDH");
+ // provider.addAlgorithm("KeyPairGenerator.ECMQV", PREFIX + "KeyPairGeneratorSpi$ECMQV");
+ //
+ // provider.addAlgorithm("Cipher.ECIES", PREFIX + "IESCipher$ECIES");
+ // provider.addAlgorithm("Cipher.ECIESwithAES", PREFIX + "IESCipher$ECIESwithAES");
+ // provider.addAlgorithm("Cipher.ECIESWITHAES", PREFIX + "IESCipher$ECIESwithAES");
+ // provider.addAlgorithm("Cipher.ECIESwithDESEDE", PREFIX + "IESCipher$ECIESwithDESede");
+ // provider.addAlgorithm("Cipher.ECIESWITHDESEDE", PREFIX + "IESCipher$ECIESwithDESede");
+ // END android-removed
provider.addAlgorithm("Signature.ECDSA", PREFIX + "SignatureSpi$ecDSA");
provider.addAlgorithm("Signature.NONEwithECDSA", PREFIX + "SignatureSpi$ecDSAnone");
@@ -65,32 +77,36 @@
provider.addAlgorithm("Alg.Alias.Signature.SHA1WithECDSA", "ECDSA");
provider.addAlgorithm("Alg.Alias.Signature.ECDSAWithSHA1", "ECDSA");
provider.addAlgorithm("Alg.Alias.Signature.1.2.840.10045.4.1", "ECDSA");
- provider.addAlgorithm("Alg.Alias.Signature." + TeleTrusTObjectIdentifiers.ecSignWithSha1, "ECDSA");
-
- provider.addAlgorithm("Signature.DETECDSA", PREFIX + "SignatureSpi$ecDetDSA");
- provider.addAlgorithm("Signature.SHA1WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA");
- provider.addAlgorithm("Signature.SHA224WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA224");
- provider.addAlgorithm("Signature.SHA256WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA256");
- provider.addAlgorithm("Signature.SHA384WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA384");
- provider.addAlgorithm("Signature.SHA512WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA512");
+ // BEGIN android-removed
+ // provider.addAlgorithm("Alg.Alias.Signature." + TeleTrusTObjectIdentifiers.ecSignWithSha1, "ECDSA");
+ //
+ // provider.addAlgorithm("Signature.DETECDSA", PREFIX + "SignatureSpi$ecDetDSA");
+ // provider.addAlgorithm("Signature.SHA1WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA");
+ // provider.addAlgorithm("Signature.SHA224WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA224");
+ // provider.addAlgorithm("Signature.SHA256WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA256");
+ // provider.addAlgorithm("Signature.SHA384WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA384");
+ // provider.addAlgorithm("Signature.SHA512WITHDETECDSA", PREFIX + "SignatureSpi$ecDetDSA512");
+ // END android-removed
addSignatureAlgorithm(provider, "SHA224", "ECDSA", PREFIX + "SignatureSpi$ecDSA224", X9ObjectIdentifiers.ecdsa_with_SHA224);
addSignatureAlgorithm(provider, "SHA256", "ECDSA", PREFIX + "SignatureSpi$ecDSA256", X9ObjectIdentifiers.ecdsa_with_SHA256);
addSignatureAlgorithm(provider, "SHA384", "ECDSA", PREFIX + "SignatureSpi$ecDSA384", X9ObjectIdentifiers.ecdsa_with_SHA384);
addSignatureAlgorithm(provider, "SHA512", "ECDSA", PREFIX + "SignatureSpi$ecDSA512", X9ObjectIdentifiers.ecdsa_with_SHA512);
- addSignatureAlgorithm(provider, "RIPEMD160", "ECDSA", PREFIX + "SignatureSpi$ecDSARipeMD160",TeleTrusTObjectIdentifiers.ecSignWithRipemd160);
-
- provider.addAlgorithm("Signature.SHA1WITHECNR", PREFIX + "SignatureSpi$ecNR");
- provider.addAlgorithm("Signature.SHA224WITHECNR", PREFIX + "SignatureSpi$ecNR224");
- provider.addAlgorithm("Signature.SHA256WITHECNR", PREFIX + "SignatureSpi$ecNR256");
- provider.addAlgorithm("Signature.SHA384WITHECNR", PREFIX + "SignatureSpi$ecNR384");
- provider.addAlgorithm("Signature.SHA512WITHECNR", PREFIX + "SignatureSpi$ecNR512");
-
- addSignatureAlgorithm(provider, "SHA1", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1);
- addSignatureAlgorithm(provider, "SHA224", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA224", EACObjectIdentifiers.id_TA_ECDSA_SHA_224);
- addSignatureAlgorithm(provider, "SHA256", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA256", EACObjectIdentifiers.id_TA_ECDSA_SHA_256);
- addSignatureAlgorithm(provider, "SHA384", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA384", EACObjectIdentifiers.id_TA_ECDSA_SHA_384);
- addSignatureAlgorithm(provider, "SHA512", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA512", EACObjectIdentifiers.id_TA_ECDSA_SHA_512);
+ // BEGIN android-removed
+ // addSignatureAlgorithm(provider, "RIPEMD160", "ECDSA", PREFIX + "SignatureSpi$ecDSARipeMD160",TeleTrusTObjectIdentifiers.ecSignWithRipemd160);
+ //
+ // provider.addAlgorithm("Signature.SHA1WITHECNR", PREFIX + "SignatureSpi$ecNR");
+ // provider.addAlgorithm("Signature.SHA224WITHECNR", PREFIX + "SignatureSpi$ecNR224");
+ // provider.addAlgorithm("Signature.SHA256WITHECNR", PREFIX + "SignatureSpi$ecNR256");
+ // provider.addAlgorithm("Signature.SHA384WITHECNR", PREFIX + "SignatureSpi$ecNR384");
+ // provider.addAlgorithm("Signature.SHA512WITHECNR", PREFIX + "SignatureSpi$ecNR512");
+ //
+ // addSignatureAlgorithm(provider, "SHA1", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1);
+ // addSignatureAlgorithm(provider, "SHA224", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA224", EACObjectIdentifiers.id_TA_ECDSA_SHA_224);
+ // addSignatureAlgorithm(provider, "SHA256", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA256", EACObjectIdentifiers.id_TA_ECDSA_SHA_256);
+ // addSignatureAlgorithm(provider, "SHA384", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA384", EACObjectIdentifiers.id_TA_ECDSA_SHA_384);
+ // addSignatureAlgorithm(provider, "SHA512", "CVC-ECDSA", PREFIX + "SignatureSpi$ecCVCDSA512", EACObjectIdentifiers.id_TA_ECDSA_SHA_512);
+ // END android-removed
}
}
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/RSA.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/RSA.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/RSA.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/RSA.java 2013-09-26 18:06:21.000000000 +0000
@@ -3,7 +3,9 @@
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
+// BEGIN android-removed
+// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
+// END android-removed
import org.bouncycastle.asn1.x509.X509ObjectIdentifiers;
import org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi;
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
@@ -24,41 +26,49 @@
public void configure(ConfigurableProvider provider)
{
provider.addAlgorithm("AlgorithmParameters.OAEP", PREFIX + "AlgorithmParametersSpi$OAEP");
- provider.addAlgorithm("AlgorithmParameters.PSS", PREFIX + "AlgorithmParametersSpi$PSS");
-
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSAPSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSASSA-PSS", "PSS");
-
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224withRSA/PSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256withRSA/PSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384withRSA/PSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512withRSA/PSS", "PSS");
-
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224WITHRSAANDMGF1", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256WITHRSAANDMGF1", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384WITHRSAANDMGF1", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512WITHRSAANDMGF1", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RAWRSAPSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAPSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSASSA-PSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAANDMGF1", "PSS");
+ // BEGIN android-removed
+ // provider.addAlgorithm("AlgorithmParameters.PSS", PREFIX + "AlgorithmParametersSpi$PSS");
+ //
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSAPSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RSASSA-PSS", "PSS");
+ //
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224withRSA/PSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256withRSA/PSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384withRSA/PSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512withRSA/PSS", "PSS");
+ //
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA224WITHRSAANDMGF1", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA256WITHRSAANDMGF1", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA384WITHRSAANDMGF1", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA512WITHRSAANDMGF1", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.RAWRSAPSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAPSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSASSA-PSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.NONEWITHRSAANDMGF1", "PSS");
+ // END android-removed
provider.addAlgorithm("Cipher.RSA", PREFIX + "CipherSpi$NoPadding");
- provider.addAlgorithm("Cipher.RSA/RAW", PREFIX + "CipherSpi$NoPadding");
- provider.addAlgorithm("Cipher.RSA/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
- provider.addAlgorithm("Cipher.1.2.840.113549.1.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
- provider.addAlgorithm("Cipher.2.5.8.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
- provider.addAlgorithm("Cipher.RSA/1", PREFIX + "CipherSpi$PKCS1v1_5Padding_PrivateOnly");
- provider.addAlgorithm("Cipher.RSA/2", PREFIX + "CipherSpi$PKCS1v1_5Padding_PublicOnly");
- provider.addAlgorithm("Cipher.RSA/OAEP", PREFIX + "CipherSpi$OAEPPadding");
- provider.addAlgorithm("Cipher." + PKCSObjectIdentifiers.id_RSAES_OAEP, PREFIX + "CipherSpi$OAEPPadding");
- provider.addAlgorithm("Cipher.RSA/ISO9796-1", PREFIX + "CipherSpi$ISO9796d1Padding");
+ // BEGIN android-changed
+ provider.addAlgorithm("Alg.Alias.Cipher.RSA/RAW", "RSA");
+ // END android-changed
+ // BEGIN android-removed
+ // provider.addAlgorithm("Cipher.RSA/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
+ // provider.addAlgorithm("Cipher.1.2.840.113549.1.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
+ // provider.addAlgorithm("Cipher.2.5.8.1.1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
+ // provider.addAlgorithm("Cipher.RSA/1", PREFIX + "CipherSpi$PKCS1v1_5Padding_PrivateOnly");
+ // provider.addAlgorithm("Cipher.RSA/2", PREFIX + "CipherSpi$PKCS1v1_5Padding_PublicOnly");
+ // provider.addAlgorithm("Cipher.RSA/OAEP", PREFIX + "CipherSpi$OAEPPadding");
+ // provider.addAlgorithm("Cipher." + PKCSObjectIdentifiers.id_RSAES_OAEP, PREFIX + "CipherSpi$OAEPPadding");
+ // provider.addAlgorithm("Cipher.RSA/ISO9796-1", PREFIX + "CipherSpi$ISO9796d1Padding");
+ // END android-removed
provider.addAlgorithm("Alg.Alias.Cipher.RSA//RAW", "RSA");
provider.addAlgorithm("Alg.Alias.Cipher.RSA//NOPADDING", "RSA");
- provider.addAlgorithm("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1");
- provider.addAlgorithm("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP");
- provider.addAlgorithm("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1");
+ // BEGIN android-removed
+ // provider.addAlgorithm("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1");
+ // provider.addAlgorithm("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP");
+ // provider.addAlgorithm("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1");
+ // END android-removed
provider.addAlgorithm("KeyFactory.RSA", PREFIX + "KeyFactorySpi");
provider.addAlgorithm("KeyPairGenerator.RSA", PREFIX + "KeyPairGeneratorSpi");
@@ -68,73 +78,81 @@
registerOid(provider, PKCSObjectIdentifiers.rsaEncryption, "RSA", keyFact);
registerOid(provider, X509ObjectIdentifiers.id_ea_rsa, "RSA", keyFact);
registerOid(provider, PKCSObjectIdentifiers.id_RSAES_OAEP, "RSA", keyFact);
- registerOid(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "RSA", keyFact);
-
- registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.rsaEncryption, "RSA");
- registerOidAlgorithmParameters(provider, X509ObjectIdentifiers.id_ea_rsa, "RSA");
- registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSAES_OAEP, "OAEP");
- registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "PSS");
-
-
- provider.addAlgorithm("Signature.RSASSA-PSS", PREFIX + "PSSSignatureSpi$PSSwithRSA");
- provider.addAlgorithm("Signature." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA");
- provider.addAlgorithm("Signature.OID." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA");
-
- provider.addAlgorithm("Signature.SHA224withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA224withRSA");
- provider.addAlgorithm("Signature.SHA256withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA256withRSA");
- provider.addAlgorithm("Signature.SHA384withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA384withRSA");
- provider.addAlgorithm("Signature.SHA512withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA512withRSA");
-
- provider.addAlgorithm("Signature.RSA", PREFIX + "DigestSignatureSpi$noneRSA");
- provider.addAlgorithm("Signature.RAWRSASSA-PSS", PREFIX + "PSSSignatureSpi$nonePSS");
-
- provider.addAlgorithm("Alg.Alias.Signature.RAWRSA", "RSA");
- provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSA", "RSA");
- provider.addAlgorithm("Alg.Alias.Signature.RAWRSAPSS", "RAWRSASSA-PSS");
- provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAPSS", "RAWRSASSA-PSS");
- provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSASSA-PSS", "RAWRSASSA-PSS");
- provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAANDMGF1", "RAWRSASSA-PSS");
- provider.addAlgorithm("Alg.Alias.Signature.RSAPSS", "RSASSA-PSS");
-
-
- provider.addAlgorithm("Alg.Alias.Signature.SHA224withRSAandMGF1", "SHA224withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA256withRSAandMGF1", "SHA256withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA384withRSAandMGF1", "SHA384withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA512withRSAandMGF1", "SHA512withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA224WITHRSAANDMGF1", "SHA224withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA256WITHRSAANDMGF1", "SHA256withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA384WITHRSAANDMGF1", "SHA384withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA512WITHRSAANDMGF1", "SHA512withRSA/PSS");
-
- if (provider.hasAlgorithm("MessageDigest", "MD2"))
- {
- addDigestSignature(provider, "MD2", PREFIX + "DigestSignatureSpi$MD2", PKCSObjectIdentifiers.md2WithRSAEncryption);
- }
-
- if (provider.hasAlgorithm("MessageDigest", "MD4"))
- {
- addDigestSignature(provider, "MD4", PREFIX + "DigestSignatureSpi$MD4", PKCSObjectIdentifiers.md4WithRSAEncryption);
- }
+ // BEGIN android-removed
+ // registerOid(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "RSA", keyFact);
+ //
+ // registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.rsaEncryption, "RSA");
+ // registerOidAlgorithmParameters(provider, X509ObjectIdentifiers.id_ea_rsa, "RSA");
+ // registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSAES_OAEP, "OAEP");
+ // registerOidAlgorithmParameters(provider, PKCSObjectIdentifiers.id_RSASSA_PSS, "PSS");
+ //
+ //
+ // provider.addAlgorithm("Signature.RSASSA-PSS", PREFIX + "PSSSignatureSpi$PSSwithRSA");
+ // provider.addAlgorithm("Signature." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA");
+ // provider.addAlgorithm("Signature.OID." + PKCSObjectIdentifiers.id_RSASSA_PSS, PREFIX + "PSSSignatureSpi$PSSwithRSA");
+ //
+ // provider.addAlgorithm("Signature.SHA224withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA224withRSA");
+ // provider.addAlgorithm("Signature.SHA256withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA256withRSA");
+ // provider.addAlgorithm("Signature.SHA384withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA384withRSA");
+ // provider.addAlgorithm("Signature.SHA512withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA512withRSA");
+ //
+ // provider.addAlgorithm("Signature.RSA", PREFIX + "DigestSignatureSpi$noneRSA");
+ // provider.addAlgorithm("Signature.RAWRSASSA-PSS", PREFIX + "PSSSignatureSpi$nonePSS");
+ //
+ // provider.addAlgorithm("Alg.Alias.Signature.RAWRSA", "RSA");
+ // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSA", "RSA");
+ // provider.addAlgorithm("Alg.Alias.Signature.RAWRSAPSS", "RAWRSASSA-PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAPSS", "RAWRSASSA-PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSASSA-PSS", "RAWRSASSA-PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.NONEWITHRSAANDMGF1", "RAWRSASSA-PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.RSAPSS", "RSASSA-PSS");
+ //
+ //
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA224withRSAandMGF1", "SHA224withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA256withRSAandMGF1", "SHA256withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA384withRSAandMGF1", "SHA384withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA512withRSAandMGF1", "SHA512withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA224WITHRSAANDMGF1", "SHA224withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA256WITHRSAANDMGF1", "SHA256withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA384WITHRSAANDMGF1", "SHA384withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA512WITHRSAANDMGF1", "SHA512withRSA/PSS");
+ //
+ // if (provider.hasAlgorithm("MessageDigest", "MD2"))
+ // {
+ // addDigestSignature(provider, "MD2", PREFIX + "DigestSignatureSpi$MD2", PKCSObjectIdentifiers.md2WithRSAEncryption);
+ // }
+ //
+ // if (provider.hasAlgorithm("MessageDigest", "MD4"))
+ // {
+ // addDigestSignature(provider, "MD4", PREFIX + "DigestSignatureSpi$MD4", PKCSObjectIdentifiers.md4WithRSAEncryption);
+ // }
+ // END android-removed
if (provider.hasAlgorithm("MessageDigest", "MD5"))
{
addDigestSignature(provider, "MD5", PREFIX + "DigestSignatureSpi$MD5", PKCSObjectIdentifiers.md5WithRSAEncryption);
- provider.addAlgorithm("Signature.MD5withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$MD5WithRSAEncryption");
- provider.addAlgorithm("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2");
+ // BEGIN android-removed
+ // provider.addAlgorithm("Signature.MD5withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$MD5WithRSAEncryption");
+ // provider.addAlgorithm("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2");
+ // END android-removed
}
if (provider.hasAlgorithm("MessageDigest", "SHA1"))
{
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1withRSA/PSS", "PSS");
- provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1WITHRSAANDMGF1", "PSS");
- provider.addAlgorithm("Signature.SHA1withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA1withRSA");
- provider.addAlgorithm("Alg.Alias.Signature.SHA1withRSAandMGF1", "SHA1withRSA/PSS");
- provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHRSAANDMGF1", "SHA1withRSA/PSS");
+ // BEGIN android-removed
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1withRSA/PSS", "PSS");
+ // provider.addAlgorithm("Alg.Alias.AlgorithmParameters.SHA1WITHRSAANDMGF1", "PSS");
+ // provider.addAlgorithm("Signature.SHA1withRSA/PSS", PREFIX + "PSSSignatureSpi$SHA1withRSA");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA1withRSAandMGF1", "SHA1withRSA/PSS");
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHRSAANDMGF1", "SHA1withRSA/PSS");
+ // END android-removed
addDigestSignature(provider, "SHA1", PREFIX + "DigestSignatureSpi$SHA1", PKCSObjectIdentifiers.sha1WithRSAEncryption);
- provider.addAlgorithm("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2");
- provider.addAlgorithm("Signature.SHA1withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$SHA1WithRSAEncryption");
+ // BEGIN android-removed
+ // provider.addAlgorithm("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2");
+ // provider.addAlgorithm("Signature.SHA1withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$SHA1WithRSAEncryption");
+ // END android-removed
provider.addAlgorithm("Alg.Alias.Signature." + OIWObjectIdentifiers.sha1WithRSA, "SHA1WITHRSA");
provider.addAlgorithm("Alg.Alias.Signature.OID." + OIWObjectIdentifiers.sha1WithRSA, "SHA1WITHRSA");
}
@@ -144,25 +162,27 @@
addDigestSignature(provider, "SHA384", PREFIX + "DigestSignatureSpi$SHA384", PKCSObjectIdentifiers.sha384WithRSAEncryption);
addDigestSignature(provider, "SHA512", PREFIX + "DigestSignatureSpi$SHA512", PKCSObjectIdentifiers.sha512WithRSAEncryption);
- if (provider.hasAlgorithm("MessageDigest", "RIPEMD128"))
- {
- addDigestSignature(provider, "RIPEMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
- addDigestSignature(provider, "RMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", null);
- }
-
- if (provider.hasAlgorithm("MessageDigest", "RIPEMD160"))
- {
- addDigestSignature(provider, "RIPEMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
- addDigestSignature(provider, "RMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", null);
- provider.addAlgorithm("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2");
- provider.addAlgorithm("Signature.RIPEMD160withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$RIPEMD160WithRSAEncryption");
- }
-
- if (provider.hasAlgorithm("MessageDigest", "RIPEMD256"))
- {
- addDigestSignature(provider, "RIPEMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
- addDigestSignature(provider, "RMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", null);
- }
+ // BEGIN android-removed
+ // if (provider.hasAlgorithm("MessageDigest", "RIPEMD128"))
+ // {
+ // addDigestSignature(provider, "RIPEMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
+ // addDigestSignature(provider, "RMD128", PREFIX + "DigestSignatureSpi$RIPEMD128", null);
+ // }
+ //
+ // if (provider.hasAlgorithm("MessageDigest", "RIPEMD160"))
+ // {
+ // addDigestSignature(provider, "RIPEMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
+ // addDigestSignature(provider, "RMD160", PREFIX + "DigestSignatureSpi$RIPEMD160", null);
+ // provider.addAlgorithm("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2");
+ // provider.addAlgorithm("Signature.RIPEMD160withRSA/ISO9796-2", PREFIX + "ISOSignatureSpi$RIPEMD160WithRSAEncryption");
+ // }
+ //
+ // if (provider.hasAlgorithm("MessageDigest", "RIPEMD256"))
+ // {
+ // addDigestSignature(provider, "RIPEMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
+ // addDigestSignature(provider, "RMD256", PREFIX + "DigestSignatureSpi$RIPEMD256", null);
+ // }
+ // END android-removed
}
private void addDigestSignature(
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/X509.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/X509.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/X509.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/X509.java 2012-09-17 23:04:47.000000000 +0000
@@ -18,8 +18,10 @@
public void configure(ConfigurableProvider provider)
{
- provider.addAlgorithm("KeyFactory.X.509", "org.bouncycastle.jcajce.provider.asymmetric.x509.KeyFactory");
- provider.addAlgorithm("Alg.Alias.KeyFactory.X509", "X.509");
+ // BEGIN android-removed
+ // provider.addAlgorithm("KeyFactory.X.509", "org.bouncycastle.jcajce.provider.asymmetric.x509.KeyFactory");
+ // provider.addAlgorithm("Alg.Alias.KeyFactory.X509", "X.509");
+ // END android-removed
//
// certificate factories.
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java 2013-12-12 00:35:05.000000000 +0000
@@ -23,13 +23,20 @@
import org.bouncycastle.crypto.DSA;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.digests.NullDigest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.digests.SHA224Digest;
-import org.bouncycastle.crypto.digests.SHA256Digest;
-import org.bouncycastle.crypto.digests.SHA384Digest;
-import org.bouncycastle.crypto.digests.SHA512Digest;
+// BEGIN android-added
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-added
+// BEGIN android-removed
+// import org.bouncycastle.crypto.digests.SHA1Digest;
+// import org.bouncycastle.crypto.digests.SHA224Digest;
+// import org.bouncycastle.crypto.digests.SHA256Digest;
+// import org.bouncycastle.crypto.digests.SHA384Digest;
+// import org.bouncycastle.crypto.digests.SHA512Digest;
+// END android-removed
import org.bouncycastle.crypto.params.ParametersWithRandom;
-import org.bouncycastle.crypto.signers.HMacDSAKCalculator;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.signers.HMacDSAKCalculator;
+// END android-removed
public class DSASigner
extends SignatureSpi
@@ -217,90 +224,102 @@
{
public stdDSA()
{
- super(new SHA1Digest(), new org.bouncycastle.crypto.signers.DSASigner());
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA1(), new org.bouncycastle.crypto.signers.DSASigner());
+ // END android-changed
}
}
- static public class detDSA
- extends DSASigner
- {
- public detDSA()
- {
- super(new SHA1Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA1Digest())));
- }
- }
+ // BEGIN android-removed
+ // static public class detDSA
+ // extends DSASigner
+ // {
+ // public detDSA()
+ // {
+ // super(new SHA1Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA1Digest())));
+ // }
+ // }
+ // END android-removed
static public class dsa224
extends DSASigner
{
public dsa224()
{
- super(new SHA224Digest(), new org.bouncycastle.crypto.signers.DSASigner());
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA224(), new org.bouncycastle.crypto.signers.DSASigner());
+ // END android-changed
}
}
- static public class detDSA224
- extends DSASigner
- {
- public detDSA224()
- {
- super(new SHA224Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA224Digest())));
- }
- }
+ // BEGIN android-removed
+ // static public class detDSA224
+ // extends DSASigner
+ // {
+ // public detDSA224()
+ // {
+ // super(new SHA224Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA224Digest())));
+ // }
+ // }
+ // END android-removed
static public class dsa256
extends DSASigner
{
public dsa256()
{
- super(new SHA256Digest(), new org.bouncycastle.crypto.signers.DSASigner());
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA256(), new org.bouncycastle.crypto.signers.DSASigner());
+ // END android-changed
}
}
- static public class detDSA256
- extends DSASigner
- {
- public detDSA256()
- {
- super(new SHA256Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA256Digest())));
- }
- }
-
- static public class dsa384
- extends DSASigner
- {
- public dsa384()
- {
- super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner());
- }
- }
-
- static public class detDSA384
- extends DSASigner
- {
- public detDSA384()
- {
- super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA384Digest())));
- }
- }
-
- static public class dsa512
- extends DSASigner
- {
- public dsa512()
- {
- super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner());
- }
- }
-
- static public class detDSA512
- extends DSASigner
- {
- public detDSA512()
- {
- super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA512Digest())));
- }
- }
+ // BEGIN android-removed
+ // static public class detDSA256
+ // extends DSASigner
+ // {
+ // public detDSA256()
+ // {
+ // super(new SHA256Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA256Digest())));
+ // }
+ // }
+ //
+ // static public class dsa384
+ // extends DSASigner
+ // {
+ // public dsa384()
+ // {
+ // super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner());
+ // }
+ // }
+ //
+ // static public class detDSA384
+ // extends DSASigner
+ // {
+ // public detDSA384()
+ // {
+ // super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA384Digest())));
+ // }
+ // }
+ //
+ // static public class dsa512
+ // extends DSASigner
+ // {
+ // public dsa512()
+ // {
+ // super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner());
+ // }
+ // }
+ //
+ // static public class detDSA512
+ // extends DSASigner
+ // {
+ // public detDSA512()
+ // {
+ // super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner(new HMacDSAKCalculator(new SHA512Digest())));
+ // }
+ // }
+ // END android-removed
static public class noneDSA
extends DSASigner
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java 2013-12-12 00:35:05.000000000 +0000
@@ -23,21 +23,27 @@
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.DerivationFunction;
import org.bouncycastle.crypto.agreement.ECDHBasicAgreement;
-import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement;
-import org.bouncycastle.crypto.agreement.ECMQVBasicAgreement;
-import org.bouncycastle.crypto.agreement.kdf.DHKDFParameters;
-import org.bouncycastle.crypto.agreement.kdf.ECDHKEKGenerator;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement;
+// import org.bouncycastle.crypto.agreement.ECMQVBasicAgreement;
+// import org.bouncycastle.crypto.agreement.kdf.DHKDFParameters;
+// import org.bouncycastle.crypto.agreement.kdf.ECDHKEKGenerator;
+// END android-removed
import org.bouncycastle.crypto.digests.SHA1Digest;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
-import org.bouncycastle.crypto.params.MQVPrivateParameters;
-import org.bouncycastle.crypto.params.MQVPublicParameters;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.params.MQVPrivateParameters;
+// import org.bouncycastle.crypto.params.MQVPublicParameters;
+// END android-removed
import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil;
import org.bouncycastle.jce.interfaces.ECPrivateKey;
import org.bouncycastle.jce.interfaces.ECPublicKey;
-import org.bouncycastle.jce.interfaces.MQVPrivateKey;
-import org.bouncycastle.jce.interfaces.MQVPublicKey;
+// BEGIN android-removed
+// import org.bouncycastle.jce.interfaces.MQVPrivateKey;
+// import org.bouncycastle.jce.interfaces.MQVPublicKey;
+// END android-removed
import org.bouncycastle.util.Integers;
/**
@@ -71,7 +77,9 @@
private BigInteger result;
private ECDomainParameters parameters;
private BasicAgreement agreement;
- private DerivationFunction kdf;
+ // BEGIN android-removed
+ // private DerivationFunction kdf;
+ // END android-removed
private byte[] bigIntToBytes(
BigInteger r)
@@ -86,7 +94,9 @@
{
this.kaAlgorithm = kaAlgorithm;
this.agreement = agreement;
- this.kdf = kdf;
+ // BEGIN android-removed
+ // this.kdf = kdf;
+ // END android-removed
}
protected Key engineDoPhase(
@@ -105,25 +115,27 @@
}
CipherParameters pubKey;
- if (agreement instanceof ECMQVBasicAgreement)
- {
- if (!(key instanceof MQVPublicKey))
- {
- throw new InvalidKeyException(kaAlgorithm + " key agreement requires "
- + getSimpleName(MQVPublicKey.class) + " for doPhase");
- }
-
- MQVPublicKey mqvPubKey = (MQVPublicKey)key;
- ECPublicKeyParameters staticKey = (ECPublicKeyParameters)
- ECUtil.generatePublicKeyParameter(mqvPubKey.getStaticKey());
- ECPublicKeyParameters ephemKey = (ECPublicKeyParameters)
- ECUtil.generatePublicKeyParameter(mqvPubKey.getEphemeralKey());
-
- pubKey = new MQVPublicParameters(staticKey, ephemKey);
-
- // TODO Validate that all the keys are using the same parameters?
- }
- else
+ // BEGIN android-removed
+ // if (agreement instanceof ECMQVBasicAgreement)
+ // {
+ // if (!(key instanceof MQVPublicKey))
+ // {
+ // throw new InvalidKeyException(kaAlgorithm + " key agreement requires "
+ // + getSimpleName(MQVPublicKey.class) + " for doPhase");
+ // }
+ //
+ // MQVPublicKey mqvPubKey = (MQVPublicKey)key;
+ // ECPublicKeyParameters staticKey = (ECPublicKeyParameters)
+ // ECUtil.generatePublicKeyParameter(mqvPubKey.getStaticKey());
+ // ECPublicKeyParameters ephemKey = (ECPublicKeyParameters)
+ // ECUtil.generatePublicKeyParameter(mqvPubKey.getEphemeralKey());
+ //
+ // pubKey = new MQVPublicParameters(staticKey, ephemKey);
+ //
+ // // TODO Validate that all the keys are using the same parameters?
+ // }
+ // else
+ // END android-removed
{
if (!(key instanceof PublicKey))
{
@@ -144,11 +156,13 @@
protected byte[] engineGenerateSecret()
throws IllegalStateException
{
- if (kdf != null)
- {
- throw new UnsupportedOperationException(
- "KDF can only be used when algorithm is known");
- }
+ // BEGIN android-removed
+ // if (kdf != null)
+ // {
+ // throw new UnsupportedOperationException(
+ // "KDF can only be used when algorithm is known");
+ // }
+ // END android-removed
return bigIntToBytes(result);
}
@@ -176,23 +190,25 @@
{
byte[] secret = bigIntToBytes(result);
- if (kdf != null)
- {
- if (!algorithms.containsKey(algorithm))
- {
- throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm);
- }
-
- int keySize = ((Integer)algorithms.get(algorithm)).intValue();
-
- DHKDFParameters params = new DHKDFParameters(new ASN1ObjectIdentifier(algorithm), keySize, secret);
-
- byte[] keyBytes = new byte[keySize / 8];
- kdf.init(params);
- kdf.generateBytes(keyBytes, 0, keyBytes.length);
- secret = keyBytes;
- }
- else
+ // BEGIN android-removed
+ // if (kdf != null)
+ // {
+ // if (!algorithms.containsKey(algorithm))
+ // {
+ // throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm);
+ // }
+ //
+ // int keySize = ((Integer)algorithms.get(algorithm)).intValue();
+ //
+ // DHKDFParameters params = new DHKDFParameters(new ASN1ObjectIdentifier(algorithm), keySize, secret);
+ //
+ // byte[] keyBytes = new byte[keySize / 8];
+ // kdf.init(params);
+ // kdf.generateBytes(keyBytes, 0, keyBytes.length);
+ // secret = keyBytes;
+ // }
+ // else
+ // END android-removed
{
// TODO Should we be ensuring the key is the right length?
}
@@ -206,6 +222,12 @@
SecureRandom random)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
+ // BEGIN android-added
+ if (params != null)
+ {
+ throw new InvalidAlgorithmParameterException("No algorithm parameters supported");
+ }
+ // END android-added
initFromKey(key);
}
@@ -220,35 +242,37 @@
private void initFromKey(Key key)
throws InvalidKeyException
{
- if (agreement instanceof ECMQVBasicAgreement)
- {
- if (!(key instanceof MQVPrivateKey))
- {
- throw new InvalidKeyException(kaAlgorithm + " key agreement requires "
- + getSimpleName(MQVPrivateKey.class) + " for initialisation");
- }
-
- MQVPrivateKey mqvPrivKey = (MQVPrivateKey)key;
- ECPrivateKeyParameters staticPrivKey = (ECPrivateKeyParameters)
- ECUtil.generatePrivateKeyParameter(mqvPrivKey.getStaticPrivateKey());
- ECPrivateKeyParameters ephemPrivKey = (ECPrivateKeyParameters)
- ECUtil.generatePrivateKeyParameter(mqvPrivKey.getEphemeralPrivateKey());
-
- ECPublicKeyParameters ephemPubKey = null;
- if (mqvPrivKey.getEphemeralPublicKey() != null)
- {
- ephemPubKey = (ECPublicKeyParameters)
- ECUtil.generatePublicKeyParameter(mqvPrivKey.getEphemeralPublicKey());
- }
-
- MQVPrivateParameters localParams = new MQVPrivateParameters(staticPrivKey, ephemPrivKey, ephemPubKey);
- this.parameters = staticPrivKey.getParameters();
-
- // TODO Validate that all the keys are using the same parameters?
-
- agreement.init(localParams);
- }
- else
+ // BEGIN android-removed
+ // if (agreement instanceof ECMQVBasicAgreement)
+ // {
+ // if (!(key instanceof MQVPrivateKey))
+ // {
+ // throw new InvalidKeyException(kaAlgorithm + " key agreement requires "
+ // + getSimpleName(MQVPrivateKey.class) + " for initialisation");
+ // }
+ //
+ // MQVPrivateKey mqvPrivKey = (MQVPrivateKey)key;
+ // ECPrivateKeyParameters staticPrivKey = (ECPrivateKeyParameters)
+ // ECUtil.generatePrivateKeyParameter(mqvPrivKey.getStaticPrivateKey());
+ // ECPrivateKeyParameters ephemPrivKey = (ECPrivateKeyParameters)
+ // ECUtil.generatePrivateKeyParameter(mqvPrivKey.getEphemeralPrivateKey());
+ //
+ // ECPublicKeyParameters ephemPubKey = null;
+ // if (mqvPrivKey.getEphemeralPublicKey() != null)
+ // {
+ // ephemPubKey = (ECPublicKeyParameters)
+ // ECUtil.generatePublicKeyParameter(mqvPrivKey.getEphemeralPublicKey());
+ // }
+ //
+ // MQVPrivateParameters localParams = new MQVPrivateParameters(staticPrivKey, ephemPrivKey, ephemPubKey);
+ // this.parameters = staticPrivKey.getParameters();
+ //
+ // // TODO Validate that all the keys are using the same parameters?
+ //
+ // agreement.init(localParams);
+ // }
+ // else
+ // END android-removed
{
if (!(key instanceof PrivateKey))
{
@@ -279,39 +303,41 @@
}
}
- public static class DHC
- extends KeyAgreementSpi
- {
- public DHC()
- {
- super("ECDHC", new ECDHCBasicAgreement(), null);
- }
- }
-
- public static class MQV
- extends KeyAgreementSpi
- {
- public MQV()
- {
- super("ECMQV", new ECMQVBasicAgreement(), null);
- }
- }
-
- public static class DHwithSHA1KDF
- extends KeyAgreementSpi
- {
- public DHwithSHA1KDF()
- {
- super("ECDHwithSHA1KDF", new ECDHBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest()));
- }
- }
-
- public static class MQVwithSHA1KDF
- extends KeyAgreementSpi
- {
- public MQVwithSHA1KDF()
- {
- super("ECMQVwithSHA1KDF", new ECMQVBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest()));
- }
- }
+ // BEGIN android-removed
+ // public static class DHC
+ // extends KeyAgreementSpi
+ // {
+ // public DHC()
+ // {
+ // super("ECDHC", new ECDHCBasicAgreement(), null);
+ // }
+ // }
+ //
+ // public static class MQV
+ // extends KeyAgreementSpi
+ // {
+ // public MQV()
+ // {
+ // super("ECMQV", new ECMQVBasicAgreement(), null);
+ // }
+ // }
+ //
+ // public static class DHwithSHA1KDF
+ // extends KeyAgreementSpi
+ // {
+ // public DHwithSHA1KDF()
+ // {
+ // super("ECDHwithSHA1KDF", new ECDHBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest()));
+ // }
+ // }
+ //
+ // public static class MQVwithSHA1KDF
+ // extends KeyAgreementSpi
+ // {
+ // public MQVwithSHA1KDF()
+ // {
+ // super("ECMQVwithSHA1KDF", new ECMQVBasicAgreement(), new ECDHKEKGenerator(new SHA1Digest()));
+ // }
+ // }
+ // END android-removed
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java 2013-05-25 02:14:15.000000000 +0000
@@ -201,14 +201,16 @@
}
}
- public static class ECGOST3410
- extends KeyFactorySpi
- {
- public ECGOST3410()
- {
- super("ECGOST3410", BouncyCastleProvider.CONFIGURATION);
- }
- }
+ // BEGIN android-removed
+ // public static class ECGOST3410
+ // extends KeyFactorySpi
+ // {
+ // public ECGOST3410()
+ // {
+ // super("ECGOST3410", BouncyCastleProvider.CONFIGURATION);
+ // }
+ // }
+ // END android-removed
public static class ECDH
extends KeyFactorySpi
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java 2013-12-12 00:35:05.000000000 +0000
@@ -84,7 +84,13 @@
SecureRandom random)
{
this.strength = strength;
+ // BEGIN android-added
+ if (random != null) {
+ // END android-added
this.random = random;
+ // BEGIN android-added
+ }
+ // END android-added
ECGenParameterSpec ecParams = (ECGenParameterSpec)ecParameters.get(Integers.valueOf(strength));
if (ecParams != null)
@@ -109,6 +115,11 @@
SecureRandom random)
throws InvalidAlgorithmParameterException
{
+ // BEGIN android-added
+ if (random == null) {
+ random = this.random;
+ }
+ // END android-added
if (params instanceof ECParameterSpec)
{
ECParameterSpec p = (ECParameterSpec)params;
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java 2013-12-12 00:35:05.000000000 +0000
@@ -16,16 +16,23 @@
import org.bouncycastle.crypto.DSA;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.digests.NullDigest;
-import org.bouncycastle.crypto.digests.RIPEMD160Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.digests.SHA224Digest;
-import org.bouncycastle.crypto.digests.SHA256Digest;
-import org.bouncycastle.crypto.digests.SHA384Digest;
-import org.bouncycastle.crypto.digests.SHA512Digest;
+// BEGIN android-added
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-added
+// BEGIN android-removed
+// import org.bouncycastle.crypto.digests.RIPEMD160Digest;
+// import org.bouncycastle.crypto.digests.SHA1Digest;
+// import org.bouncycastle.crypto.digests.SHA224Digest;
+// import org.bouncycastle.crypto.digests.SHA256Digest;
+// import org.bouncycastle.crypto.digests.SHA384Digest;
+// import org.bouncycastle.crypto.digests.SHA512Digest;
+// END android-removed
import org.bouncycastle.crypto.params.ParametersWithRandom;
import org.bouncycastle.crypto.signers.ECDSASigner;
-import org.bouncycastle.crypto.signers.ECNRSigner;
-import org.bouncycastle.crypto.signers.HMacDSAKCalculator;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.signers.ECNRSigner;
+// import org.bouncycastle.crypto.signers.HMacDSAKCalculator;
+// END android-removed
import org.bouncycastle.jcajce.provider.asymmetric.util.DSABase;
import org.bouncycastle.jcajce.provider.asymmetric.util.DSAEncoder;
import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil;
@@ -70,18 +77,22 @@
{
public ecDSA()
{
- super(new SHA1Digest(), new ECDSASigner(), new StdDSAEncoder());
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA1(), new ECDSASigner(), new StdDSAEncoder());
+ // END android-changed
}
}
- static public class ecDetDSA
- extends SignatureSpi
- {
- public ecDetDSA()
- {
- super(new SHA1Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA1Digest())), new StdDSAEncoder());
- }
- }
+ // BEGIN android-removed
+ // static public class ecDetDSA
+ // extends SignatureSpi
+ // {
+ // public ecDetDSA()
+ // {
+ // super(new SHA1Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA1Digest())), new StdDSAEncoder());
+ // }
+ // }
+ // END android-removed
static public class ecDSAnone
extends SignatureSpi
@@ -97,171 +108,187 @@
{
public ecDSA224()
{
- super(new SHA224Digest(), new ECDSASigner(), new StdDSAEncoder());
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA224(), new ECDSASigner(), new StdDSAEncoder());
+ // END android-changed
}
}
- static public class ecDetDSA224
- extends SignatureSpi
- {
- public ecDetDSA224()
- {
- super(new SHA224Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA224Digest())), new StdDSAEncoder());
- }
- }
+ // BEGIN android-removed
+ // static public class ecDetDSA224
+ // extends SignatureSpi
+ // {
+ // public ecDetDSA224()
+ // {
+ // super(new SHA224Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA224Digest())), new StdDSAEncoder());
+ // }
+ // }
+ // END android-removed
static public class ecDSA256
extends SignatureSpi
{
public ecDSA256()
{
- super(new SHA256Digest(), new ECDSASigner(), new StdDSAEncoder());
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA256(), new ECDSASigner(), new StdDSAEncoder());
+ // END android-changed
}
}
- static public class ecDetDSA256
- extends SignatureSpi
- {
- public ecDetDSA256()
- {
- super(new SHA256Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest())), new StdDSAEncoder());
- }
- }
+ // BEGIN android-removed
+ // static public class ecDetDSA256
+ // extends SignatureSpi
+ // {
+ // public ecDetDSA256()
+ // {
+ // super(new SHA256Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest())), new StdDSAEncoder());
+ // }
+ // }
+ // END android-removed
static public class ecDSA384
extends SignatureSpi
{
public ecDSA384()
{
- super(new SHA384Digest(), new ECDSASigner(), new StdDSAEncoder());
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA384(), new ECDSASigner(), new StdDSAEncoder());
+ // END android-changed
}
}
- static public class ecDetDSA384
- extends SignatureSpi
- {
- public ecDetDSA384()
- {
- super(new SHA384Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA384Digest())), new StdDSAEncoder());
- }
- }
+ // BEGIN android-removed
+ // static public class ecDetDSA384
+ // extends SignatureSpi
+ // {
+ // public ecDetDSA384()
+ // {
+ // super(new SHA384Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA384Digest())), new StdDSAEncoder());
+ // }
+ // }
+ // END android-removed
static public class ecDSA512
extends SignatureSpi
{
public ecDSA512()
{
- super(new SHA512Digest(), new ECDSASigner(), new StdDSAEncoder());
- }
- }
-
- static public class ecDetDSA512
- extends SignatureSpi
- {
- public ecDetDSA512()
- {
- super(new SHA512Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA512Digest())), new StdDSAEncoder());
- }
- }
-
- static public class ecDSARipeMD160
- extends SignatureSpi
- {
- public ecDSARipeMD160()
- {
- super(new RIPEMD160Digest(), new ECDSASigner(), new StdDSAEncoder());
- }
- }
-
- static public class ecNR
- extends SignatureSpi
- {
- public ecNR()
- {
- super(new SHA1Digest(), new ECNRSigner(), new StdDSAEncoder());
- }
- }
-
- static public class ecNR224
- extends SignatureSpi
- {
- public ecNR224()
- {
- super(new SHA224Digest(), new ECNRSigner(), new StdDSAEncoder());
- }
- }
-
- static public class ecNR256
- extends SignatureSpi
- {
- public ecNR256()
- {
- super(new SHA256Digest(), new ECNRSigner(), new StdDSAEncoder());
- }
- }
-
- static public class ecNR384
- extends SignatureSpi
- {
- public ecNR384()
- {
- super(new SHA384Digest(), new ECNRSigner(), new StdDSAEncoder());
- }
- }
-
- static public class ecNR512
- extends SignatureSpi
- {
- public ecNR512()
- {
- super(new SHA512Digest(), new ECNRSigner(), new StdDSAEncoder());
- }
- }
-
- static public class ecCVCDSA
- extends SignatureSpi
- {
- public ecCVCDSA()
- {
- super(new SHA1Digest(), new ECDSASigner(), new CVCDSAEncoder());
- }
- }
-
- static public class ecCVCDSA224
- extends SignatureSpi
- {
- public ecCVCDSA224()
- {
- super(new SHA224Digest(), new ECDSASigner(), new CVCDSAEncoder());
- }
- }
-
- static public class ecCVCDSA256
- extends SignatureSpi
- {
- public ecCVCDSA256()
- {
- super(new SHA256Digest(), new ECDSASigner(), new CVCDSAEncoder());
- }
- }
-
- static public class ecCVCDSA384
- extends SignatureSpi
- {
- public ecCVCDSA384()
- {
- super(new SHA384Digest(), new ECDSASigner(), new CVCDSAEncoder());
- }
- }
-
- static public class ecCVCDSA512
- extends SignatureSpi
- {
- public ecCVCDSA512()
- {
- super(new SHA512Digest(), new ECDSASigner(), new CVCDSAEncoder());
- }
- }
+ // BEGIN android-changed
+ super(AndroidDigestFactory.getSHA512(), new ECDSASigner(), new StdDSAEncoder());
+ // END android-changed
+ }
+ }
+
+ // BEGIN android-removed
+ // static public class ecDetDSA512
+ // extends SignatureSpi
+ // {
+ // public ecDetDSA512()
+ // {
+ // super(new SHA512Digest(), new ECDSASigner(new HMacDSAKCalculator(new SHA512Digest())), new StdDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecDSARipeMD160
+ // extends SignatureSpi
+ // {
+ // public ecDSARipeMD160()
+ // {
+ // super(new RIPEMD160Digest(), new ECDSASigner(), new StdDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecNR
+ // extends SignatureSpi
+ // {
+ // public ecNR()
+ // {
+ // super(new SHA1Digest(), new ECNRSigner(), new StdDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecNR224
+ // extends SignatureSpi
+ // {
+ // public ecNR224()
+ // {
+ // super(new SHA224Digest(), new ECNRSigner(), new StdDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecNR256
+ // extends SignatureSpi
+ // {
+ // public ecNR256()
+ // {
+ // super(new SHA256Digest(), new ECNRSigner(), new StdDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecNR384
+ // extends SignatureSpi
+ // {
+ // public ecNR384()
+ // {
+ // super(new SHA384Digest(), new ECNRSigner(), new StdDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecNR512
+ // extends SignatureSpi
+ // {
+ // public ecNR512()
+ // {
+ // super(new SHA512Digest(), new ECNRSigner(), new StdDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecCVCDSA
+ // extends SignatureSpi
+ // {
+ // public ecCVCDSA()
+ // {
+ // super(new SHA1Digest(), new ECDSASigner(), new CVCDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecCVCDSA224
+ // extends SignatureSpi
+ // {
+ // public ecCVCDSA224()
+ // {
+ // super(new SHA224Digest(), new ECDSASigner(), new CVCDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecCVCDSA256
+ // extends SignatureSpi
+ // {
+ // public ecCVCDSA256()
+ // {
+ // super(new SHA256Digest(), new ECDSASigner(), new CVCDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecCVCDSA384
+ // extends SignatureSpi
+ // {
+ // public ecCVCDSA384()
+ // {
+ // super(new SHA384Digest(), new ECDSASigner(), new CVCDSAEncoder());
+ // }
+ // }
+ //
+ // static public class ecCVCDSA512
+ // extends SignatureSpi
+ // {
+ // public ecCVCDSA512()
+ // {
+ // super(new SHA512Digest(), new ECDSASigner(), new CVCDSAEncoder());
+ // }
+ // }
+ // END android-removed
private static class StdDSAEncoder
implements DSAEncoder
@@ -355,4 +382,4 @@
return sig;
}
}
-}
\ No newline at end of file
+}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java 2013-09-26 18:06:21.000000000 +0000
@@ -26,7 +26,9 @@
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.InvalidCipherTextException;
-import org.bouncycastle.crypto.encodings.ISO9796d1Encoding;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.encodings.ISO9796d1Encoding;
+// END android-removed
import org.bouncycastle.crypto.encodings.OAEPEncoding;
import org.bouncycastle.crypto.encodings.PKCS1Encoding;
import org.bouncycastle.crypto.engines.RSABlindedEngine;
@@ -197,10 +199,12 @@
{
cipher = new PKCS1Encoding(new RSABlindedEngine());
}
- else if (pad.equals("ISO9796-1PADDING"))
- {
- cipher = new ISO9796d1Encoding(new RSABlindedEngine());
- }
+ // BEGIN android-removed
+ // else if (pad.equals("ISO9796-1PADDING"))
+ // {
+ // cipher = new ISO9796d1Encoding(new RSABlindedEngine());
+ // }
+ // END android-removed
else if (pad.equals("OAEPWITHMD5ANDMGF1PADDING"))
{
initFromSpec(new OAEPParameterSpec("MD5", "MGF1", new MGF1ParameterSpec("MD5"), PSource.PSpecified.DEFAULT));
@@ -539,48 +543,50 @@
}
}
- static public class PKCS1v1_5Padding
- extends CipherSpi
- {
- public PKCS1v1_5Padding()
- {
- super(new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
-
- static public class PKCS1v1_5Padding_PrivateOnly
- extends CipherSpi
- {
- public PKCS1v1_5Padding_PrivateOnly()
- {
- super(false, true, new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
-
- static public class PKCS1v1_5Padding_PublicOnly
- extends CipherSpi
- {
- public PKCS1v1_5Padding_PublicOnly()
- {
- super(true, false, new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
-
- static public class OAEPPadding
- extends CipherSpi
- {
- public OAEPPadding()
- {
- super(OAEPParameterSpec.DEFAULT);
- }
- }
-
- static public class ISO9796d1Padding
- extends CipherSpi
- {
- public ISO9796d1Padding()
- {
- super(new ISO9796d1Encoding(new RSABlindedEngine()));
- }
- }
+ // BEGIN android-removed
+ // static public class PKCS1v1_5Padding
+ // extends CipherSpi
+ // {
+ // public PKCS1v1_5Padding()
+ // {
+ // super(new PKCS1Encoding(new RSABlindedEngine()));
+ // }
+ // }
+ //
+ // static public class PKCS1v1_5Padding_PrivateOnly
+ // extends CipherSpi
+ // {
+ // public PKCS1v1_5Padding_PrivateOnly()
+ // {
+ // super(false, true, new PKCS1Encoding(new RSABlindedEngine()));
+ // }
+ // }
+ //
+ // static public class PKCS1v1_5Padding_PublicOnly
+ // extends CipherSpi
+ // {
+ // public PKCS1v1_5Padding_PublicOnly()
+ // {
+ // super(true, false, new PKCS1Encoding(new RSABlindedEngine()));
+ // }
+ // }
+ //
+ // static public class OAEPPadding
+ // extends CipherSpi
+ // {
+ // public OAEPPadding()
+ // {
+ // super(OAEPParameterSpec.DEFAULT);
+ // }
+ // }
+ //
+ // static public class ISO9796d1Padding
+ // extends CipherSpi
+ // {
+ // public ISO9796d1Padding()
+ // {
+ // super(new ISO9796d1Encoding(new RSABlindedEngine()));
+ // }
+ // }
+ // END android-removed
}
diff -Naur bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java
--- bcprov-jdk15on-150.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java 2013-12-03 12:18:20.000000000 +0000
+++ bcprov-jdk15on-150/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java 2013-09-26 18:06:21.000000000 +0000
@@ -17,24 +17,31 @@
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
+// BEGIN android-removed
+// import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
+// END android-removed
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.DigestInfo;
import org.bouncycastle.crypto.AsymmetricBlockCipher;
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.MD2Digest;
-import org.bouncycastle.crypto.digests.MD4Digest;
-import org.bouncycastle.crypto.digests.MD5Digest;
-import org.bouncycastle.crypto.digests.NullDigest;
-import org.bouncycastle.crypto.digests.RIPEMD128Digest;
-import org.bouncycastle.crypto.digests.RIPEMD160Digest;
-import org.bouncycastle.crypto.digests.RIPEMD256Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.digests.SHA224Digest;
-import org.bouncycastle.crypto.digests.SHA256Digest;
-import org.bouncycastle.crypto.digests.SHA384Digest;
-import org.bouncycastle.crypto.digests.SHA512Digest;
+// BEGIN android-removed
+// import org.bouncycastle.crypto.digests.MD2Digest;
+// import org.bouncycastle.crypto.digests.MD4Digest;
+// import org.bouncycastle.crypto.digests.MD5Digest;
+// import org.bouncycastle.crypto.digests.NullDigest;
+// import org.bouncycastle.crypto.digests.RIPEMD128Digest;
+// import org.bouncycastle.crypto.digests.RIPEMD160Digest;
+// import org.bouncycastle.crypto.digests.RIPEMD256Digest;
+// import org.bouncycastle.crypto.digests.SHA1Digest;
+// import org.bouncycastle.crypto.digests.SHA224Digest;
+// import org.bouncycastle.crypto.digests.SHA256Digest;
+// import org.bouncycastle.crypto.digests.SHA384Digest;
+// import org.bouncycastle.crypto.digests.SHA512Digest;
+// END android-removed
+// BEGIN android-added
+import org.bouncycastle.crypto.digests.AndroidDigestFactory;
+// END android-added
import org.bouncycastle.crypto.encodings.PKCS1Encoding;
import org.bouncycastle.crypto.engines.RSABlindedEngine;
@@ -261,7 +268,9 @@
{
public SHA1()
{
- super(OIWObjectIdentifiers.idSHA1, new SHA1Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // BEGIN android-changed
+ super(OIWObjectIdentifiers.idSHA1, AndroidDigestFactory.getSHA1(), new PKCS1Encoding(new RSABlindedEngine()));
+ // END android-changed
}
}
@@ -270,7 +279,9 @@
{
public SHA224()
{
- super(NISTObjectIdentifiers.id_sha224, new SHA224Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // BEGIN android-changed
+ super(NISTObjectIdentifiers.id_sha224, AndroidDigestFactory.getSHA224(), new PKCS1Encoding(new RSABlindedEngine()));
+ // END android-changed
}
}
@@ -279,7 +290,9 @@
{
public SHA256()
{
- super(NISTObjectIdentifiers.id_sha256, new SHA256Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // BEGIN android-changed
+ super(NISTObjectIdentifiers.id_sha256, AndroidDigestFactory.getSHA256(), new PKCS1Encoding(new RSABlindedEngine()));
+ // END android-changed
}
}
@@ -288,7 +301,9 @@
{
public SHA384()
{
- super(NISTObjectIdentifiers.id_sha384, new SHA384Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // BEGIN android-changed
+ super(NISTObjectIdentifiers.id_sha384, AndroidDigestFactory.getSHA384(), new PKCS1Encoding(new RSABlindedEngine()));
+ // END android-changed
}
}
@@ -297,70 +312,78 @@
{
public SHA512()
{
- super(NISTObjectIdentifiers.id_sha512, new SHA512Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // BEGIN android-changed
+ super(NISTObjectIdentifiers.id_sha512, AndroidDigestFactory.getSHA512(), new PKCS1Encoding(new RSABlindedEngine()));
+ // END android-changed
}
}
- static public class MD2
- extends DigestSignatureSpi
- {
- public MD2()
- {
- super(PKCSObjectIdentifiers.md2, new MD2Digest(), new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
-
- static public class MD4
- extends DigestSignatureSpi
- {
- public MD4()
- {
- super(PKCSObjectIdentifiers.md4, new MD4Digest(), new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
+ // BEGIN android-removed
+ // static public class MD2
+ // extends DigestSignatureSpi
+ // {
+ // public MD2()
+ // {
+ // super(PKCSObjectIdentifiers.md2, new MD2Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // }
+ // }
+ //
+ // static public class MD4
+ // extends DigestSignatureSpi
+ // {
+ // public MD4()
+ // {
+ // super(PKCSObjectIdentifiers.md4, new MD4Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // }
+ // }
+ // END android-removed
static public class MD5
extends DigestSignatureSpi
{
public MD5()
{
- super(PKCSObjectIdentifiers.md5, new MD5Digest(), new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
-
- static public class RIPEMD160
- extends DigestSignatureSpi
- {
- public RIPEMD160()
- {
- super(TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // BEGIN android-changed
+ super(PKCSObjectIdentifiers.md5, AndroidDigestFactory.getMD5(), new PKCS1Encoding(new RSABlindedEngine()));
+ // END android-changed
}
}
- static public class RIPEMD128
- extends DigestSignatureSpi
- {
- public RIPEMD128()
- {
- super(TeleTrusTObjectIdentifiers.ripemd128, new RIPEMD128Digest(), new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
-
- static public class RIPEMD256
- extends DigestSignatureSpi
- {
- public RIPEMD256()
- {
- super(TeleTrusTObjectIdentifiers.ripemd256, new RIPEMD256Digest(), new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
-
- static public class noneRSA
- extends DigestSignatureSpi
- {
- public noneRSA()
- {
- super(new NullDigest(), new PKCS1Encoding(new RSABlindedEngine()));
- }
- }
+ // BEGIN android-removed
+ // static public class RIPEMD160
+ // extends DigestSignatureSpi
+ // {
+ // public RIPEMD160()
+ // {
+ // super(TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSABlindedEngine()));
+ // }