| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/asn1/ASN1Null.java bcprov-jdk15on-148/org/bouncycastle/asn1/ASN1Null.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/ASN1Null.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/asn1/DERBoolean.java bcprov-jdk15on-148/org/bouncycastle/asn1/DERBoolean.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/DERBoolean.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/DERBoolean.java 2013-01-31 02:26:40.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-148.orig/org/bouncycastle/asn1/DERNull.java bcprov-jdk15on-148/org/bouncycastle/asn1/DERNull.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/DERNull.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/asn1/DERObjectIdentifier.java bcprov-jdk15on-148/org/bouncycastle/asn1/DERObjectIdentifier.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/DERObjectIdentifier.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/DERObjectIdentifier.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -144,7 +144,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); |
| } |
| |
| @@ -156,7 +162,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 |
| } |
| |
| public String getId() |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/asn1/DERPrintableString.java bcprov-jdk15on-148/org/bouncycastle/asn1/DERPrintableString.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/DERPrintableString.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/asn1/DERT61String.java bcprov-jdk15on-148/org/bouncycastle/asn1/DERT61String.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/DERT61String.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/DERT61String.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -82,12 +82,16 @@ |
| public DERT61String( |
| String string) |
| { |
| - this.string = Strings.toUTF8ByteArray(string); |
| + // BEGIN android-changed |
| + this.string = Strings.toByteArray(string); |
| + // END android-changed |
| } |
| |
| public String getString() |
| { |
| - return Strings.fromUTF8ByteArray(string); |
| + // BEGIN android-changed |
| + return Strings.fromByteArray(string); |
| + // END android-changed |
| } |
| |
| public String toString() |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/asn1/cms/ContentInfo.java bcprov-jdk15on-148/org/bouncycastle/asn1/cms/ContentInfo.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/cms/ContentInfo.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/cms/ContentInfo.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -12,7 +12,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-148.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java bcprov-jdk15on-148/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -10,8 +10,10 @@ |
| // |
| static final ASN1ObjectIdentifier pkcs_1 = new ASN1ObjectIdentifier("1.2.840.113549.1.1"); |
| static final ASN1ObjectIdentifier rsaEncryption = pkcs_1.branch("1"); |
| - static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2"); |
| - static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3"); |
| + // BEGIN android-removed |
| + // static final ASN1ObjectIdentifier md2WithRSAEncryption = pkcs_1.branch("2"); |
| + // static final ASN1ObjectIdentifier md4WithRSAEncryption = pkcs_1.branch("3"); |
| + // END android-removed |
| static final ASN1ObjectIdentifier md5WithRSAEncryption = pkcs_1.branch("4"); |
| static final ASN1ObjectIdentifier sha1WithRSAEncryption = pkcs_1.branch("5"); |
| static final ASN1ObjectIdentifier srsaOAEPEncryptionSET = pkcs_1.branch("6"); |
| @@ -22,7 +24,9 @@ |
| static final ASN1ObjectIdentifier sha256WithRSAEncryption = pkcs_1.branch("11"); |
| static final ASN1ObjectIdentifier sha384WithRSAEncryption = pkcs_1.branch("12"); |
| static final ASN1ObjectIdentifier sha512WithRSAEncryption = pkcs_1.branch("13"); |
| - static final ASN1ObjectIdentifier sha224WithRSAEncryption = pkcs_1.branch("14"); |
| + // BEGIN android-removed |
| + // static final ASN1ObjectIdentifier sha224WithRSAEncryption = pkcs_1.branch("14"); |
| + // END android-removed |
| |
| // |
| // pkcs-3 OBJECT IDENTIFIER ::= { |
| @@ -66,13 +70,17 @@ |
| // md2 OBJECT IDENTIFIER ::= |
| // {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 2} |
| // |
| - static final ASN1ObjectIdentifier md2 = digestAlgorithm.branch("2"); |
| + // BEGIN android-removed |
| + // 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} |
| // |
| - static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4"); |
| + // BEGIN android-removed |
| + // static final ASN1ObjectIdentifier md4 = digestAlgorithm.branch("4"); |
| + // END android-removed |
| |
| // |
| // md5 OBJECT IDENTIFIER ::= |
| @@ -81,7 +89,9 @@ |
| static final ASN1ObjectIdentifier md5 = digestAlgorithm.branch("5"); |
| |
| static final ASN1ObjectIdentifier id_hmacWithSHA1 = digestAlgorithm.branch("7"); |
| - static final ASN1ObjectIdentifier id_hmacWithSHA224 = digestAlgorithm.branch("8"); |
| + // BEGIN android-removed |
| + // static final ASN1ObjectIdentifier id_hmacWithSHA224 = digestAlgorithm.branch("8"); |
| + // END android-removed |
| static final ASN1ObjectIdentifier id_hmacWithSHA256 = digestAlgorithm.branch("9"); |
| static final ASN1ObjectIdentifier id_hmacWithSHA384 = digestAlgorithm.branch("10"); |
| static final ASN1ObjectIdentifier id_hmacWithSHA512 = digestAlgorithm.branch("11"); |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java bcprov-jdk15on-148/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java 2013-01-31 02:26:40.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-148.orig/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java bcprov-jdk15on-148/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/asn1/x509/X509Name.java bcprov-jdk15on-148/org/bouncycastle/asn1/x509/X509Name.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/x509/X509Name.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/x509/X509Name.java 2013-01-31 02:26:40.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 |
| { |
| @@ -445,7 +447,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-148.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java bcprov-jdk15on-148/org/bouncycastle/asn1/x509/X509NameTokenizer.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/asn1/x509/X509NameTokenizer.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -96,6 +96,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-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactory.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 1970-01-01 00:00:00.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -0,0 +1,78 @@ |
| +/* |
| + * 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); |
| + } catch (ClassNotFoundException e1) { |
| + try { |
| + factoryImplementationClass = Class.forName(BouncyCastleFactoryClassName); |
| + } catch (ClassNotFoundException e2) { |
| + throw new AssertionError("Failed to find AndroidDigestFactoryInterface " |
| + + "implementation. Looked for " |
| + + OpenSSLFactoryClassName + " and " |
| + + BouncyCastleFactoryClassName); |
| + } |
| + } |
| + 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 getSHA256() { |
| + return FACTORY.getSHA256(); |
| + } |
| + |
| + public static Digest getSHA384() { |
| + return FACTORY.getSHA384(); |
| + } |
| + |
| + public static Digest getSHA512() { |
| + return FACTORY.getSHA512(); |
| + } |
| +} |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java 1970-01-01 00:00:00.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -0,0 +1,37 @@ |
| +/* |
| + * 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 getSHA256() { |
| + return new SHA256Digest(); |
| + } |
| + public Digest getSHA384() { |
| + return new SHA384Digest(); |
| + } |
| + public Digest getSHA512() { |
| + return new SHA512Digest(); |
| + } |
| +} |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java 1970-01-01 00:00:00.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactoryInterface.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -0,0 +1,27 @@ |
| +/* |
| + * 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 getSHA256(); |
| + public Digest getSHA384(); |
| + public Digest getSHA512(); |
| +} |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java 1970-01-01 00:00:00.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -0,0 +1,37 @@ |
| +/* |
| + * 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 getSHA256() { |
| + return new OpenSSLDigest.SHA256(); |
| + } |
| + public Digest getSHA384() { |
| + return new OpenSSLDigest.SHA384(); |
| + } |
| + public Digest getSHA512() { |
| + return new OpenSSLDigest.SHA512(); |
| + } |
| +} |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java bcprov-jdk15on-148/org/bouncycastle/crypto/digests/OpenSSLDigest.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/digests/OpenSSLDigest.java 1970-01-01 00:00:00.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/digests/OpenSSLDigest.java 2013-04-24 05:37:59.000000000 +0000 |
| @@ -0,0 +1,159 @@ |
| +/* |
| + * 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 com.android.org.conscrypt.NativeCrypto; |
| +import org.bouncycastle.crypto.ExtendedDigest; |
| + |
| +/** |
| + * Implements the BouncyCastle Digest interface using OpenSSL's EVP API. |
| + */ |
| +public class OpenSSLDigest implements ExtendedDigest { |
| + |
| + /** |
| + * Holds the standard name of the hashing algorithm, e.g. "SHA-1"; |
| + */ |
| + private final String algorithm; |
| + |
| + /** |
| + * Holds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1"); |
| + */ |
| + private final long evp_md; |
| + |
| + /** |
| + * Holds the output size of the message digest. |
| + */ |
| + private final int size; |
| + |
| + /** |
| + * Holds the block size of the message digest. |
| + */ |
| + private final int blockSize; |
| + |
| + /** |
| + * Holds a pointer to the native message digest context. It is |
| + * lazily initialized to avoid having to reallocate on reset when |
| + * its unlikely to be reused. |
| + */ |
| + private long ctx; |
| + |
| + /** |
| + * Holds a dummy buffer for writing single bytes to the digest. |
| + */ |
| + private final byte[] singleByte = new byte[1]; |
| + |
| + /** |
| + * Creates a new OpenSSLMessageDigest instance for the given algorithm |
| + * name. |
| + */ |
| + private OpenSSLDigest(String algorithm, long evp_md, int size, int blockSize) { |
| + this.algorithm = algorithm; |
| + this.evp_md = evp_md; |
| + this.size = size; |
| + this.blockSize = blockSize; |
| + } |
| + |
| + public String getAlgorithmName() { |
| + return algorithm; |
| + } |
| + |
| + public int getDigestSize() { |
| + return size; |
| + } |
| + |
| + public int getByteLength() { |
| + return blockSize; |
| + } |
| + |
| + public void reset() { |
| + free(); |
| + } |
| + |
| + public void update(byte in) { |
| + singleByte[0] = in; |
| + update(singleByte, 0, 1); |
| + } |
| + |
| + public void update(byte[] in, int inOff, int len) { |
| + NativeCrypto.EVP_DigestUpdate(getCtx(), in, inOff, len); |
| + } |
| + |
| + public int doFinal(byte[] out, int outOff) { |
| + int i = NativeCrypto.EVP_DigestFinal(getCtx(), out, outOff); |
| + ctx = 0; // EVP_DigestFinal frees the context as a side effect |
| + reset(); |
| + return i; |
| + } |
| + |
| + private long getCtx() { |
| + if (ctx == 0) { |
| + ctx = NativeCrypto.EVP_DigestInit(evp_md); |
| + } |
| + return ctx; |
| + } |
| + |
| + private void free() { |
| + if (ctx != 0) { |
| + NativeCrypto.EVP_MD_CTX_destroy(ctx); |
| + ctx = 0; |
| + } |
| + } |
| + |
| + @Override |
| + protected void finalize() throws Throwable { |
| + try { |
| + free(); |
| + } finally { |
| + super.finalize(); |
| + } |
| + } |
| + |
| + public static class MD5 extends OpenSSLDigest { |
| + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("md5"); |
| + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); |
| + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); |
| + public MD5() { super("MD5", EVP_MD, SIZE, BLOCK_SIZE); } |
| + } |
| + |
| + public static class SHA1 extends OpenSSLDigest { |
| + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha1"); |
| + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); |
| + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); |
| + public SHA1() { super("SHA-1", EVP_MD, SIZE, BLOCK_SIZE); } |
| + } |
| + |
| + public static class SHA256 extends OpenSSLDigest { |
| + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha256"); |
| + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); |
| + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); |
| + public SHA256() { super("SHA-256", EVP_MD, SIZE, BLOCK_SIZE); } |
| + } |
| + |
| + public static class SHA384 extends OpenSSLDigest { |
| + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha384"); |
| + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); |
| + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); |
| + public SHA384() { super("SHA-384", EVP_MD, SIZE, BLOCK_SIZE); } |
| + } |
| + |
| + public static class SHA512 extends OpenSSLDigest { |
| + private static final long EVP_MD = NativeCrypto.EVP_get_digestbyname("sha512"); |
| + private static final int SIZE = NativeCrypto.EVP_MD_size(EVP_MD); |
| + private static final int BLOCK_SIZE = NativeCrypto.EVP_MD_block_size(EVP_MD); |
| + public SHA512() { super("SHA-512", EVP_MD, SIZE, BLOCK_SIZE); } |
| + } |
| +} |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/encodings/OAEPEncoding.java bcprov-jdk15on-148/org/bouncycastle/crypto/encodings/OAEPEncoding.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/encodings/OAEPEncoding.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/encodings/OAEPEncoding.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -4,7 +4,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; |
| |
| import java.security.SecureRandom; |
| @@ -26,7 +28,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-148.orig/org/bouncycastle/crypto/encodings/PKCS1Encoding.java bcprov-jdk15on-148/org/bouncycastle/crypto/encodings/PKCS1Encoding.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/encodings/PKCS1Encoding.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/crypto/engines/AESFastEngine.java bcprov-jdk15on-148/org/bouncycastle/crypto/engines/AESFastEngine.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/engines/AESFastEngine.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/engines/AESFastEngine.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -3,6 +3,9 @@ |
| import org.bouncycastle.crypto.BlockCipher; |
| import org.bouncycastle.crypto.CipherParameters; |
| import org.bouncycastle.crypto.DataLengthException; |
| +// BEGIN android-added |
| +import org.bouncycastle.crypto.OutputLengthException; |
| +// END android-added |
| import org.bouncycastle.crypto.params.KeyParameter; |
| |
| /** |
| @@ -723,7 +726,9 @@ |
| |
| if ((outOff + (32 / 2)) > out.length) |
| { |
| - throw new DataLengthException("output buffer too short"); |
| + // BEGIN android-changed |
| + throw new OutputLengthException("output buffer too short"); |
| + // END android-changed |
| } |
| |
| if (forEncryption) |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/engines/DESedeEngine.java bcprov-jdk15on-148/org/bouncycastle/crypto/engines/DESedeEngine.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/engines/DESedeEngine.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/engines/DESedeEngine.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -2,6 +2,9 @@ |
| |
| import org.bouncycastle.crypto.CipherParameters; |
| import org.bouncycastle.crypto.DataLengthException; |
| +// BEGIN android-added |
| +import org.bouncycastle.crypto.OutputLengthException; |
| +// END android-added |
| import org.bouncycastle.crypto.params.KeyParameter; |
| |
| /** |
| @@ -99,7 +102,9 @@ |
| |
| if ((outOff + BLOCK_SIZE) > out.length) |
| { |
| - throw new DataLengthException("output buffer too short"); |
| + // BEGIN android-changed |
| + throw new OutputLengthException("output buffer too short"); |
| + // END android-changed |
| } |
| |
| byte[] temp = new byte[BLOCK_SIZE]; |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/engines/DESedeWrapEngine.java bcprov-jdk15on-148/org/bouncycastle/crypto/engines/DESedeWrapEngine.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/engines/DESedeWrapEngine.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java bcprov-jdk15on-148/org/bouncycastle/crypto/generators/DHParametersHelper.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/generators/DHParametersHelper.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/crypto/generators/DSAParametersGenerator.java bcprov-jdk15on-148/org/bouncycastle/crypto/generators/DSAParametersGenerator.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/generators/DSAParametersGenerator.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/generators/DSAParametersGenerator.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -1,8 +1,9 @@ |
| package org.bouncycastle.crypto.generators; |
| |
| import org.bouncycastle.crypto.Digest; |
| -import org.bouncycastle.crypto.digests.SHA1Digest; |
| -import org.bouncycastle.crypto.digests.SHA256Digest; |
| +// BEGIN android-changed |
| +import org.bouncycastle.crypto.digests.AndroidDigestFactory; |
| +// END android-changed |
| import org.bouncycastle.crypto.params.DSAParameters; |
| import org.bouncycastle.crypto.params.DSAValidationParameters; |
| import org.bouncycastle.util.Arrays; |
| @@ -75,7 +76,9 @@ |
| byte[] part1 = new byte[20]; |
| byte[] part2 = new byte[20]; |
| byte[] u = new byte[20]; |
| - SHA1Digest sha1 = new SHA1Digest(); |
| + // BEGIN android-changed |
| + Digest sha1 = AndroidDigestFactory.getSHA1(); |
| + // END android-changed |
| int n = (L - 1) / 160; |
| byte[] w = new byte[L / 8]; |
| |
| @@ -166,7 +169,9 @@ |
| { |
| // A.1.1.2 Generation of the Probable Primes p and q Using an Approved Hash Function |
| // FIXME This should be configurable (digest size in bits must be >= N) |
| - Digest d = new SHA256Digest(); |
| + // BEGIN android-changed |
| + Digest d = AndroidDigestFactory.getSHA256(); |
| + // END android-changed |
| int outlen = d.getDigestSize() * 8; |
| |
| // 1. Check that the (L, N) pair is in the list of acceptable (L, N pairs) (see Section 4.2). If |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java bcprov-jdk15on-148/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java bcprov-jdk15on-148/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/generators/PKCS5S2ParametersGenerator.java 2012-09-17 23:04:47.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; |
| @@ -27,7 +29,9 @@ |
| */ |
| public PKCS5S2ParametersGenerator() |
| { |
| - this(new SHA1Digest()); |
| + // BEGIN android-changed |
| + this(AndroidDigestFactory.getSHA1()); |
| + // END android-changed |
| } |
| |
| public PKCS5S2ParametersGenerator(Digest digest) |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/macs/HMac.java bcprov-jdk15on-148/org/bouncycastle/crypto/macs/HMac.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/macs/HMac.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/macs/HMac.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -33,23 +33,31 @@ |
| { |
| 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)); |
| + // BEGIN android-removed |
| + // blockLengths.put("SHA-224", Integers.valueOf(64)); |
| + // END android-removed |
| blockLengths.put("SHA-256", Integers.valueOf(64)); |
| 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-148.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java bcprov-jdk15on-148/org/bouncycastle/crypto/signers/RSADigestSigner.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/signers/RSADigestSigner.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/signers/RSADigestSigner.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -39,18 +39,24 @@ |
| */ |
| 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); |
| + // BEGIN android-removed |
| + // oidMap.put("SHA-224", NISTObjectIdentifiers.id_sha224); |
| + // END android-removed |
| oidMap.put("SHA-256", NISTObjectIdentifiers.id_sha256); |
| 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-148.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java bcprov-jdk15on-148/org/bouncycastle/crypto/util/PrivateKeyFactory.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/util/PrivateKeyFactory.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -11,7 +11,9 @@ |
| import org.bouncycastle.asn1.ASN1Primitive; |
| import org.bouncycastle.asn1.ASN1Sequence; |
| import org.bouncycastle.asn1.nist.NISTNamedCurves; |
| -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; |
| @@ -19,7 +21,9 @@ |
| import org.bouncycastle.asn1.pkcs.RSAPrivateKey; |
| import org.bouncycastle.asn1.sec.ECPrivateKey; |
| import org.bouncycastle.asn1.sec.SECNamedCurves; |
| -import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; |
| +// BEGIN android-removed |
| +// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; |
| +// END android-removed |
| import org.bouncycastle.asn1.x509.AlgorithmIdentifier; |
| import org.bouncycastle.asn1.x509.DSAParameter; |
| import org.bouncycastle.asn1.x9.X962NamedCurves; |
| @@ -33,8 +37,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; |
| |
| /** |
| @@ -100,14 +106,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(); |
| @@ -140,10 +148,12 @@ |
| { |
| x9 = NISTNamedCurves.getByOID(oid); |
| |
| - if (x9 == null) |
| - { |
| - x9 = TeleTrusTNamedCurves.getByOID(oid); |
| - } |
| + // BEGIN android-removed |
| + // if (x9 == null) |
| + // { |
| + // x9 = TeleTrusTNamedCurves.getByOID(oid); |
| + // } |
| + // END android-removed |
| } |
| } |
| } |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java bcprov-jdk15on-148/org/bouncycastle/crypto/util/PublicKeyFactory.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/crypto/util/PublicKeyFactory.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/crypto/util/PublicKeyFactory.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -13,13 +13,17 @@ |
| import org.bouncycastle.asn1.ASN1Sequence; |
| import org.bouncycastle.asn1.DEROctetString; |
| import org.bouncycastle.asn1.nist.NISTNamedCurves; |
| -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; |
| import org.bouncycastle.asn1.pkcs.RSAPublicKey; |
| import org.bouncycastle.asn1.sec.SECNamedCurves; |
| -import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; |
| +// BEGIN android-removed |
| +// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; |
| +// END android-removed |
| import org.bouncycastle.asn1.x509.AlgorithmIdentifier; |
| import org.bouncycastle.asn1.x509.DSAParameter; |
| import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; |
| @@ -40,8 +44,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; |
| |
| /** |
| @@ -135,14 +141,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)) |
| { |
| @@ -177,10 +185,12 @@ |
| { |
| x9 = NISTNamedCurves.getByOID(oid); |
| |
| - if (x9 == null) |
| - { |
| - x9 = TeleTrusTNamedCurves.getByOID(oid); |
| - } |
| + // BEGIN android-removed |
| + // if (x9 == null) |
| + // { |
| + // x9 = TeleTrusTNamedCurves.getByOID(oid); |
| + // } |
| + // END android-removed |
| } |
| } |
| } |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/DH.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/DH.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/DH.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/DH.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -32,11 +32,13 @@ |
| |
| 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"); |
| - provider.addAlgorithm("KeyPairGenerator.IES", PREFIX + "KeyPairGeneratorSpi"); |
| + // 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"); |
| + // provider.addAlgorithm("KeyPairGenerator.IES", PREFIX + "KeyPairGeneratorSpi"); |
| + // END android-removed |
| } |
| } |
| } |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/DSA.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/DSA.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/DSA.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/DSA.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -27,33 +27,43 @@ |
| 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"); |
| |
| - 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); |
| - |
| - 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"); |
| + // BEGIN 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); |
| + // 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.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.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-148.orig/org/bouncycastle/jcajce/provider/asymmetric/EC.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/EC.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/EC.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/EC.java 2013-01-31 02:26:40.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,23 +77,29 @@ |
| 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"); |
| - |
| - addSignatureAlgorithm(provider, "SHA224", "ECDSA", PREFIX + "SignatureSpi$ecDSA224", X9ObjectIdentifiers.ecdsa_with_SHA224); |
| + // BEGIN android-removed |
| + // provider.addAlgorithm("Alg.Alias.Signature." + TeleTrusTObjectIdentifiers.ecSignWithSha1, "ECDSA"); |
| + // END android-removed |
| + |
| + // BEGIN android-removed |
| + // addSignatureAlgorithm(provider, "SHA224", "ECDSA", PREFIX + "SignatureSpi$ecDSA224", X9ObjectIdentifiers.ecdsa_with_SHA224); |
| + // END android-removed |
| 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); |
| + // 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); |
| + // END android-removed |
| } |
| } |
| } |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/RSA.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/RSA.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/RSA.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/RSA.java 2013-01-31 02:26:40.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,101 +78,113 @@ |
| 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"); |
| } |
| |
| - addDigestSignature(provider, "SHA224", PREFIX + "DigestSignatureSpi$SHA224", PKCSObjectIdentifiers.sha224WithRSAEncryption); |
| + // BEGIN android-removed |
| + // addDigestSignature(provider, "SHA224", PREFIX + "DigestSignatureSpi$SHA224", PKCSObjectIdentifiers.sha224WithRSAEncryption); |
| + // END android-removed |
| addDigestSignature(provider, "SHA256", PREFIX + "DigestSignatureSpi$SHA256", PKCSObjectIdentifiers.sha256WithRSAEncryption); |
| 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-148.orig/org/bouncycastle/jcajce/provider/asymmetric/X509.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/X509.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/X509.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/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-148.orig/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/dsa/DSASigner.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -23,11 +23,16 @@ |
| 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; |
| |
| public class DSASigner |
| @@ -228,45 +233,49 @@ |
| { |
| 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 dsa224 |
| - extends DSASigner |
| - { |
| - public dsa224() |
| - { |
| - super(new SHA224Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| - } |
| - } |
| - |
| - static public class dsa256 |
| - extends DSASigner |
| - { |
| - public dsa256() |
| - { |
| - super(new SHA256Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| - } |
| - } |
| - |
| - static public class dsa384 |
| - extends DSASigner |
| - { |
| - public dsa384() |
| - { |
| - super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| - } |
| - } |
| - |
| - static public class dsa512 |
| - extends DSASigner |
| - { |
| - public dsa512() |
| - { |
| - super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| - } |
| - } |
| + // BEGIN android-removed |
| + // static public class dsa224 |
| + // extends DSASigner |
| + // { |
| + // public dsa224() |
| + // { |
| + // super(new SHA224Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| + // } |
| + // } |
| + // |
| + // static public class dsa256 |
| + // extends DSASigner |
| + // { |
| + // public dsa256() |
| + // { |
| + // super(new SHA256Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| + // } |
| + // } |
| + // |
| + // static public class dsa384 |
| + // extends DSASigner |
| + // { |
| + // public dsa384() |
| + // { |
| + // super(new SHA384Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| + // } |
| + // } |
| + // |
| + // static public class dsa512 |
| + // extends DSASigner |
| + // { |
| + // public dsa512() |
| + // { |
| + // super(new SHA512Digest(), new org.bouncycastle.crypto.signers.DSASigner()); |
| + // } |
| + // } |
| + // END android-removed |
| |
| static public class noneDSA |
| extends DSASigner |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPrivateKey.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -19,8 +19,10 @@ |
| import org.bouncycastle.asn1.DERInteger; |
| import org.bouncycastle.asn1.DERNull; |
| import org.bouncycastle.asn1.DERObjectIdentifier; |
| -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; |
| -import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; |
| +// BEGIN android-removed |
| +// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; |
| +// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; |
| +// END android-removed |
| import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; |
| import org.bouncycastle.asn1.x509.AlgorithmIdentifier; |
| import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; |
| @@ -222,21 +224,23 @@ |
| ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(params.getParameters()); |
| X9ECParameters ecP = ECUtil.getNamedCurveByOid(oid); |
| |
| - if (ecP == null) // GOST Curve |
| - { |
| - ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); |
| - EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); |
| - |
| - ecSpec = new ECNamedCurveSpec( |
| - ECGOST3410NamedCurves.getName(oid), |
| - ellipticCurve, |
| - new ECPoint( |
| - gParam.getG().getX().toBigInteger(), |
| - gParam.getG().getY().toBigInteger()), |
| - gParam.getN(), |
| - gParam.getH()); |
| - } |
| - else |
| + // BEGIN android-removed |
| + // if (ecP == null) // GOST Curve |
| + // { |
| + // ECDomainParameters gParam = ECGOST3410NamedCurves.getByOID(oid); |
| + // EllipticCurve ellipticCurve = EC5Util.convertCurve(gParam.getCurve(), gParam.getSeed()); |
| + // |
| + // ecSpec = new ECNamedCurveSpec( |
| + // ECGOST3410NamedCurves.getName(oid), |
| + // ellipticCurve, |
| + // new ECPoint( |
| + // gParam.getG().getX().toBigInteger(), |
| + // gParam.getG().getY().toBigInteger()), |
| + // gParam.getN(), |
| + // gParam.getH()); |
| + // } |
| + // else |
| + // END android-removed |
| { |
| EllipticCurve ellipticCurve = EC5Util.convertCurve(ecP.getCurve(), ecP.getSeed()); |
| |
| @@ -350,11 +354,13 @@ |
| |
| try |
| { |
| - if (algorithm.equals("ECGOST3410")) |
| - { |
| - info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.toASN1Primitive()), keyStructure.toASN1Primitive()); |
| - } |
| - else |
| + // BEGIN android-removed |
| + // if (algorithm.equals("ECGOST3410")) |
| + // { |
| + // info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.toASN1Primitive()), keyStructure.toASN1Primitive()); |
| + // } |
| + // else |
| + // END android-removed |
| { |
| |
| info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.toASN1Primitive()), keyStructure.toASN1Primitive()); |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/ECUtil.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/ECUtil.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/ECUtil.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/ECUtil.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -5,11 +5,15 @@ |
| import java.security.PublicKey; |
| |
| import org.bouncycastle.asn1.ASN1ObjectIdentifier; |
| -import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; |
| +// BEGIN android-removed |
| +// import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; |
| +// END android-removed |
| import org.bouncycastle.asn1.nist.NISTNamedCurves; |
| import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; |
| import org.bouncycastle.asn1.sec.SECNamedCurves; |
| -import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; |
| +// BEGIN android-removed |
| +// import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; |
| +// END android-removed |
| import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; |
| import org.bouncycastle.asn1.x9.X962NamedCurves; |
| import org.bouncycastle.asn1.x9.X9ECParameters; |
| @@ -224,14 +228,16 @@ |
| { |
| oid = NISTNamedCurves.getOID(name); |
| } |
| - if (oid == null) |
| - { |
| - oid = TeleTrusTNamedCurves.getOID(name); |
| - } |
| - if (oid == null) |
| - { |
| - oid = ECGOST3410NamedCurves.getOID(name); |
| - } |
| + // BEGIN android-removed |
| + // if (oid == null) |
| + // { |
| + // oid = TeleTrusTNamedCurves.getOID(name); |
| + // } |
| + // if (oid == null) |
| + // { |
| + // oid = ECGOST3410NamedCurves.getOID(name); |
| + // } |
| + // END android-removed |
| } |
| |
| return oid; |
| @@ -249,10 +255,12 @@ |
| { |
| params = NISTNamedCurves.getByOID(oid); |
| } |
| - if (params == null) |
| - { |
| - params = TeleTrusTNamedCurves.getByOID(oid); |
| - } |
| + // BEGIN android-removed |
| + // if (params == null) |
| + // { |
| + // params = TeleTrusTNamedCurves.getByOID(oid); |
| + // } |
| + // END android-removed |
| } |
| |
| return params; |
| @@ -270,14 +278,16 @@ |
| { |
| name = NISTNamedCurves.getName(oid); |
| } |
| - if (name == null) |
| - { |
| - name = TeleTrusTNamedCurves.getName(oid); |
| - } |
| - if (name == null) |
| - { |
| - name = ECGOST3410NamedCurves.getName(oid); |
| - } |
| + // BEGIN android-removed |
| + // if (name == null) |
| + // { |
| + // name = TeleTrusTNamedCurves.getName(oid); |
| + // } |
| + // if (name == null) |
| + // { |
| + // name = ECGOST3410NamedCurves.getName(oid); |
| + // } |
| + // END android-removed |
| } |
| |
| return name; |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java 2013-03-19 19:26:57.000000000 +0000 |
| @@ -23,20 +23,26 @@ |
| 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.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; |
| |
| /** |
| @@ -70,7 +76,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) |
| @@ -85,7 +93,9 @@ |
| { |
| this.kaAlgorithm = kaAlgorithm; |
| this.agreement = agreement; |
| - this.kdf = kdf; |
| + // BEGIN android-removed |
| + // this.kdf = kdf; |
| + // END android-removed |
| } |
| |
| protected Key engineDoPhase( |
| @@ -104,25 +114,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)) |
| { |
| @@ -143,11 +155,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); |
| } |
| @@ -175,23 +189,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 DERObjectIdentifier(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 DERObjectIdentifier(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? |
| } |
| @@ -205,6 +221,12 @@ |
| SecureRandom random) |
| throws InvalidKeyException, InvalidAlgorithmParameterException |
| { |
| + // BEGIN android-added |
| + if (params != null) |
| + { |
| + throw new InvalidAlgorithmParameterException("No algorithm parameters supported"); |
| + } |
| + // END android-added |
| initFromKey(key); |
| } |
| |
| @@ -219,35 +241,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)) |
| { |
| @@ -278,39 +302,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-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyFactorySpi.java 2012-09-17 23:04:47.000000000 +0000 |
| @@ -200,14 +200,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-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyPairGeneratorSpi.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -12,7 +12,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 |
| import org.bouncycastle.asn1.x9.X962NamedCurves; |
| import org.bouncycastle.asn1.x9.X9ECParameters; |
| import org.bouncycastle.crypto.AsymmetricCipherKeyPair; |
| @@ -86,7 +88,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) |
| @@ -111,6 +119,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; |
| @@ -155,10 +168,12 @@ |
| { |
| ecP = NISTNamedCurves.getByName(curveName); |
| } |
| - if (ecP == null) |
| - { |
| - ecP = TeleTrusTNamedCurves.getByName(curveName); |
| - } |
| + // BEGIN android-removed |
| + // if (ecP == null) |
| + // { |
| + // ecP = TeleTrusTNamedCurves.getByName(curveName); |
| + // } |
| + // END android-removed |
| if (ecP == null) |
| { |
| // See if it's actually an OID string (SunJSSE ServerHandshaker setupEphemeralECDHKeys bug) |
| @@ -174,10 +189,12 @@ |
| { |
| ecP = NISTNamedCurves.getByOID(oid); |
| } |
| - if (ecP == null) |
| - { |
| - ecP = TeleTrusTNamedCurves.getByOID(oid); |
| - } |
| + // BEGIN android-removed |
| + // if (ecP == null) |
| + // { |
| + // ecP = TeleTrusTNamedCurves.getByOID(oid); |
| + // } |
| + // END android-removed |
| if (ecP == null) |
| { |
| throw new InvalidAlgorithmParameterException("unknown curve OID: " + curveName); |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java 2013-01-31 02:26:40.000000000 +0000 |
| @@ -16,15 +16,22 @@ |
| 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; |
| +// BEGIN android-removed |
| +// import org.bouncycastle.crypto.signers.ECNRSigner; |
| +// END android-removed |
| import org.bouncycastle.jcajce.provider.asymmetric.util.DSABase; |
| import org.bouncycastle.jcajce.provider.asymmetric.util.DSAEncoder; |
| |
| @@ -68,7 +75,9 @@ |
| { |
| public ecDSA() |
| { |
| - super(new SHA1Digest(), new ECDSASigner(), new StdDSAEncoder()); |
| + // BEGIN android-changed |
| + super(AndroidDigestFactory.getSHA1(), new ECDSASigner(), new StdDSAEncoder()); |
| + // END android-changed |
| } |
| } |
| |
| @@ -81,21 +90,25 @@ |
| } |
| } |
| |
| - static public class ecDSA224 |
| - extends SignatureSpi |
| - { |
| - public ecDSA224() |
| - { |
| - super(new SHA224Digest(), new ECDSASigner(), new StdDSAEncoder()); |
| - } |
| - } |
| + // BEGIN android-removed |
| + // static public class ecDSA224 |
| + // extends SignatureSpi |
| + // { |
| + // public ecDSA224() |
| + // { |
| + // super(new SHA224Digest(), new ECDSASigner(), 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 |
| } |
| } |
| |
| @@ -104,7 +117,9 @@ |
| { |
| public ecDSA384() |
| { |
| - super(new SHA384Digest(), new ECDSASigner(), new StdDSAEncoder()); |
| + // BEGIN android-changed |
| + super(AndroidDigestFactory.getSHA384(), new ECDSASigner(), new StdDSAEncoder()); |
| + // END android-changed |
| } |
| } |
| |
| @@ -113,90 +128,94 @@ |
| { |
| public ecDSA512() |
| { |
| - super(new SHA512Digest(), new ECDSASigner(), 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()); |
| - } |
| - } |
| + // BEGIN android-changed |
| + super(AndroidDigestFactory.getSHA512(), new ECDSASigner(), new StdDSAEncoder()); |
| + // END android-changed |
| + } |
| + } |
| + |
| + // BEGIN android-removed |
| + // 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()); |
| + // } |
| + // } |
| + // END android-removed |
| |
| private static class StdDSAEncoder |
| implements DSAEncoder |
| @@ -290,4 +309,4 @@ |
| return sig; |
| } |
| } |
| -} |
| \ No newline at end of file |
| +} |
| diff -Naur bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java 2013-01-31 02:26:40.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)); |
| @@ -213,10 +217,12 @@ |
| { |
| initFromSpec(OAEPParameterSpec.DEFAULT); |
| } |
| - else if (pad.equals("OAEPWITHSHA224ANDMGF1PADDING") || pad.equals("OAEPWITHSHA-224ANDMGF1PADDING")) |
| - { |
| - initFromSpec(new OAEPParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), PSource.PSpecified.DEFAULT)); |
| - } |
| + // BEGIN android-removed |
| + // else if (pad.equals("OAEPWITHSHA224ANDMGF1PADDING") || pad.equals("OAEPWITHSHA-224ANDMGF1PADDING")) |
| + // { |
| + // initFromSpec(new OAEPParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), PSource.PSpecified.DEFAULT)); |
| + // } |
| + // END android-removed |
| else if (pad.equals("OAEPWITHSHA256ANDMGF1PADDING") || pad.equals("OAEPWITHSHA-256ANDMGF1PADDING")) |
| { |
| initFromSpec(new OAEPParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT)); |
| @@ -539,48 +545,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-148.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java |
| --- bcprov-jdk15on-148.orig/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java 2013-02-10 00:37:58.000000000 +0000 |
| +++ bcprov-jdk15on-148/org/bouncycastle/jcajce/provider/asymmetric/rsa/DigestSignatureSpi.java 2012-09-17 23:04:47.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,25 +268,31 @@ |
| { |
| 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 |
| } |
| } |
| |
| - static public class SHA224 |
| - extends DigestSignatureSpi |
| - { |
| - public SHA224() |
| - { |
| - super(NISTObjectIdentifiers.id_sha224, new SHA224Digest(), new PKCS1Encoding(new RSABlindedEngine())); |
| - } |
| - } |
| + // BEGIN android-removed |
| + // static public class SHA224 |
| + // extends DigestSignatureSpi |
| + // { |
| + // public SHA224() |
| + // { |
| + // super(NISTObjectIdentifiers.id_sha224, new SHA224Digest(), new PKCS1Encoding(new RSABlindedEngine())); |
| + // } |
| + // } |
| + // END android-removed |
| |
| static public class SHA256 |
| extends DigestSignatureSpi |
| { |
| 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())); |
| - } |
| - } |
| - |
| - static public class MD2 |
| - extends DigestSignatureSpi |
| - { |
| - public MD2() |
| - { |
| - super(PKCSObjectIdentifiers.md2, new MD2Digest(), new PKCS1Encoding(new RSABlindedEngine())); |
| + // BEGIN android-changed |
| + super(NISTObjectIdentifiers.id_sha512, AndroidDigestFactory.getSHA512(), new PKCS1Encoding(new RSABlindedEngine())); |
| + // END android-changed |
| } |
| } |
| |
| - 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())); |
| + // BEGIN android-changed |
| + super(PKCSObjectIdentifiers.md5, AndroidDigestFactory.getMD5(), new PKCS1Encoding(new RSABlindedEngine())); |
| + // END android-changed |
| } |
| } |
| |
| - static public class RIPEMD160 |
| - extends DigestSignatureSpi |
| - { |
| - public RIPEMD160() |
| - { |
| - super(TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSABlindedEngine())); |
| - } |
| - } |
| - |
| - 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())); |
| + // } |
| + // } |
| + // |
| + // 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() |
| + // { |
|