summaryrefslogtreecommitdiff
path: root/bcpkix
diff options
context:
space:
mode:
authorAdam Vartanian <flooey@google.com>2017-07-11 10:17:24 +0100
committerAdam Vartanian <flooey@google.com>2017-07-20 08:55:12 +0100
commit4936950820c68699a4ace55a2a8e5f7f677a913d (patch)
tree60fd944d4a3dcd27d8a5308e7b7598afa18d2025 /bcpkix
parent6ec33a667cad9a33e8049206a0507fcece28fd9c (diff)
downloadbouncycastle-4936950820c68699a4ace55a2a8e5f7f677a913d.tar.gz
Update change markers in external/bouncycastle.
For the most part, this is just changing markers that had no explanatory text and adding an explanation. Some more detail on two of the common explanations: "Unsupported algorithms": We choose not to ship a whole lot of the various crypto algorithms that Bouncy Castle supports. Justfying each individual choice to disable a given algorithm is out of place in the code and also doesn't have a natural home (since each algorithm is disabled in upwards of a dozen places), so just mark where algorithms are disabled due to being unsupported. "Unknown reason": I looked in the history and couldn't find any justification for the change. Generally these changes were made in commits with descriptions like "bouncycastle 1.49 upgrade" from multiple years ago. I don't want to change behavior in this change, so I left these changes as they were; these can be revisited in the future if desired. This change also reverts some diffs from upstream, both inside disabled blocks of code (which is irrelevant) and ones that are active but have no behavioral change (for example, an added package-visible constructor that isn't called by any class in the package). There're also a number of whitespace-only changes that revert diffs from upstream. Bug: 63092064 Test: cts -m CtsLibcoreTestCases Change-Id: I27c61063eda849455bc93edaf180acefb5eed217
Diffstat (limited to 'bcpkix')
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java204
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedGenerator.java67
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedHelper.java107
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/CMSUtils.java74
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureAlgorithmNameGenerator.java23
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureEncryptionAlgorithmFinder.java14
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/operator/DefaultDigestAlgorithmIdentifierFinder.java129
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/operator/DefaultSignatureAlgorithmIdentifierFinder.java90
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/operator/bc/BcDefaultDigestProvider.java172
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/operator/jcajce/OperatorHelper.java11
10 files changed, 451 insertions, 440 deletions
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java
index 31197159..b3a39a92 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java
@@ -320,20 +320,22 @@ public class CMSSignedData
return HELPER.getAttributeCertificates(signedData.getCertificates());
}
- // BEGIN android-removed
- // /**
- // * Return any OtherRevocationInfo OtherRevInfo objects of the type indicated by otherRevocationInfoFormat in
- // * this SignedData structure.
- // *
- // * @param otherRevocationInfoFormat OID of the format type been looked for.
- // *
- // * @return a Store of ASN1Encodable objects representing any objects of otherRevocationInfoFormat found.
- // */
- // public Store getOtherRevocationInfo(ASN1ObjectIdentifier otherRevocationInfoFormat)
- // {
- // return HELPER.getOtherRevocationInfo(otherRevocationInfoFormat, signedData.getCRLs());
- // }
- // END android-removed
+ // BEGIN Android-removed: OtherRevocationInfoFormat isn't supported
+ /*
+ /**
+ * Return any OtherRevocationInfo OtherRevInfo objects of the type indicated by otherRevocationInfoFormat in
+ * this SignedData structure.
+ *
+ * @param otherRevocationInfoFormat OID of the format type been looked for.
+ *
+ * @return a Store of ASN1Encodable objects representing any objects of otherRevocationInfoFormat found.
+ *
+ public Store getOtherRevocationInfo(ASN1ObjectIdentifier otherRevocationInfoFormat)
+ {
+ return HELPER.getOtherRevocationInfo(otherRevocationInfoFormat, signedData.getCRLs());
+ }
+ */
+ // END Android-removed: OtherRevocationInfoFormat isn't supported
/**
* Return the digest algorithm identifiers for the SignedData object
@@ -385,92 +387,94 @@ public class CMSSignedData
return contentInfo.getEncoded();
}
- // BEGIN android-removed
- // /**
- // * Verify all the SignerInformation objects and their associated counter signatures attached
- // * to this CMS SignedData object.
- // *
- // * @param verifierProvider a provider of SignerInformationVerifier objects.
- // * @return true if all verify, false otherwise.
- // * @throws CMSException if an exception occurs during the verification process.
- // */
- // public boolean verifySignatures(SignerInformationVerifierProvider verifierProvider)
- // throws CMSException
- // {
- // return verifySignatures(verifierProvider, false);
- // }
- //
- // /**
- // * Verify all the SignerInformation objects and optionally their associated counter signatures attached
- // * to this CMS SignedData object.
- // *
- // * @param verifierProvider a provider of SignerInformationVerifier objects.
- // * @param ignoreCounterSignatures if true don't check counter signatures. If false check counter signatures as well.
- // * @return true if all verify, false otherwise.
- // * @throws CMSException if an exception occurs during the verification process.
- // */
- // public boolean verifySignatures(SignerInformationVerifierProvider verifierProvider, boolean ignoreCounterSignatures)
- // throws CMSException
- // {
- // Collection signers = this.getSignerInfos().getSigners();
- //
- // for (Iterator it = signers.iterator(); it.hasNext();)
- // {
- // SignerInformation signer = (SignerInformation)it.next();
- //
- // try
- // {
- // SignerInformationVerifier verifier = verifierProvider.get(signer.getSID());
- //
- // if (!signer.verify(verifier))
- // {
- // return false;
- // }
- //
- // if (!ignoreCounterSignatures)
- // {
- // Collection counterSigners = signer.getCounterSignatures().getSigners();
- //
- // for (Iterator cIt = counterSigners.iterator(); cIt.hasNext();)
- // {
- // if (!verifyCounterSignature((SignerInformation)cIt.next(), verifierProvider))
- // {
- // return false;
- // }
- // }
- // }
- // }
- // catch (OperatorCreationException e)
- // {
- // throw new CMSException("failure in verifier provider: " + e.getMessage(), e);
- // }
- // }
- //
- // return true;
- // }
- //
- // private boolean verifyCounterSignature(SignerInformation counterSigner, SignerInformationVerifierProvider verifierProvider)
- // throws OperatorCreationException, CMSException
- // {
- // SignerInformationVerifier counterVerifier = verifierProvider.get(counterSigner.getSID());
- //
- // if (!counterSigner.verify(counterVerifier))
- // {
- // return false;
- // }
- //
- // Collection counterSigners = counterSigner.getCounterSignatures().getSigners();
- // for (Iterator cIt = counterSigners.iterator(); cIt.hasNext();)
- // {
- // if (!verifyCounterSignature((SignerInformation)cIt.next(), verifierProvider))
- // {
- // return false;
- // }
- // }
- //
- // return true;
- // }
- // END android-removed
+ // BEGIN Android-removed: Unknown reason
+ /*
+ /**
+ * Verify all the SignerInformation objects and their associated counter signatures attached
+ * to this CMS SignedData object.
+ *
+ * @param verifierProvider a provider of SignerInformationVerifier objects.
+ * @return true if all verify, false otherwise.
+ * @throws CMSException if an exception occurs during the verification process.
+ *
+ public boolean verifySignatures(SignerInformationVerifierProvider verifierProvider)
+ throws CMSException
+ {
+ return verifySignatures(verifierProvider, false);
+ }
+
+ /**
+ * Verify all the SignerInformation objects and optionally their associated counter signatures attached
+ * to this CMS SignedData object.
+ *
+ * @param verifierProvider a provider of SignerInformationVerifier objects.
+ * @param ignoreCounterSignatures if true don't check counter signatures. If false check counter signatures as well.
+ * @return true if all verify, false otherwise.
+ * @throws CMSException if an exception occurs during the verification process.
+ *
+ public boolean verifySignatures(SignerInformationVerifierProvider verifierProvider, boolean ignoreCounterSignatures)
+ throws CMSException
+ {
+ Collection signers = this.getSignerInfos().getSigners();
+
+ for (Iterator it = signers.iterator(); it.hasNext();)
+ {
+ SignerInformation signer = (SignerInformation)it.next();
+
+ try
+ {
+ SignerInformationVerifier verifier = verifierProvider.get(signer.getSID());
+
+ if (!signer.verify(verifier))
+ {
+ return false;
+ }
+
+ if (!ignoreCounterSignatures)
+ {
+ Collection counterSigners = signer.getCounterSignatures().getSigners();
+
+ for (Iterator cIt = counterSigners.iterator(); cIt.hasNext();)
+ {
+ if (!verifyCounterSignature((SignerInformation)cIt.next(), verifierProvider))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ catch (OperatorCreationException e)
+ {
+ throw new CMSException("failure in verifier provider: " + e.getMessage(), e);
+ }
+ }
+
+ return true;
+ }
+
+ private boolean verifyCounterSignature(SignerInformation counterSigner, SignerInformationVerifierProvider verifierProvider)
+ throws OperatorCreationException, CMSException
+ {
+ SignerInformationVerifier counterVerifier = verifierProvider.get(counterSigner.getSID());
+
+ if (!counterSigner.verify(counterVerifier))
+ {
+ return false;
+ }
+
+ Collection counterSigners = counterSigner.getCounterSignatures().getSigners();
+ for (Iterator cIt = counterSigners.iterator(); cIt.hasNext();)
+ {
+ if (!verifyCounterSignature((SignerInformation)cIt.next(), verifierProvider))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ */
+ // END Android-removed: Unknown reason
/**
* Replace the SignerInformation store associated with this
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedGenerator.java b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedGenerator.java
index f180c097..86d4321d 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedGenerator.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedGenerator.java
@@ -12,10 +12,9 @@ import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.cms.OtherRevocationInfoFormat;
// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
@@ -41,21 +40,21 @@ public class CMSSignedGenerator
public static final String DIGEST_SHA384 = NISTObjectIdentifiers.id_sha384.getId();
public static final String DIGEST_SHA512 = NISTObjectIdentifiers.id_sha512.getId();
public static final String DIGEST_MD5 = PKCSObjectIdentifiers.md5.getId();
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// public static final String DIGEST_GOST3411 = CryptoProObjectIdentifiers.gostR3411.getId();
// public static final String DIGEST_RIPEMD128 = TeleTrusTObjectIdentifiers.ripemd128.getId();
// public static final String DIGEST_RIPEMD160 = TeleTrusTObjectIdentifiers.ripemd160.getId();
// public static final String DIGEST_RIPEMD256 = TeleTrusTObjectIdentifiers.ripemd256.getId();
- // END android-removed
+ // END Android-removed: Unsupported algorithms
public static final String ENCRYPTION_RSA = PKCSObjectIdentifiers.rsaEncryption.getId();
public static final String ENCRYPTION_DSA = X9ObjectIdentifiers.id_dsa_with_sha1.getId();
public static final String ENCRYPTION_ECDSA = X9ObjectIdentifiers.ecdsa_with_SHA1.getId();
public static final String ENCRYPTION_RSA_PSS = PKCSObjectIdentifiers.id_RSASSA_PSS.getId();
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// public static final String ENCRYPTION_GOST3410 = CryptoProObjectIdentifiers.gostR3410_94.getId();
// public static final String ENCRYPTION_ECGOST3410 = CryptoProObjectIdentifiers.gostR3410_2001.getId();
- // END android-removed
+ // END Android-removed: Unsupported algorithms
private static final String ENCRYPTION_ECDSA_WITH_SHA1 = X9ObjectIdentifiers.ecdsa_with_SHA1.getId();
private static final String ENCRYPTION_ECDSA_WITH_SHA224 = X9ObjectIdentifiers.ecdsa_with_SHA224.getId();
@@ -180,33 +179,35 @@ public class CMSSignedGenerator
certs.addAll(CMSUtils.getAttributeCertificatesFromStore(attrStore));
}
- // BEGIN android-removed
- // /**
- // * Add a single instance of otherRevocationData to the CRL set to be included with the generated SignedData message.
- // *
- // * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data.
- // * @param otherRevocationInfo the otherRevocationInfo ASN.1 structure.
- // */
- // public void addOtherRevocationInfo(
- // ASN1ObjectIdentifier otherRevocationInfoFormat,
- // ASN1Encodable otherRevocationInfo)
- // {
- // crls.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, otherRevocationInfo)));
- // }
- //
- // /**
- // * Add a Store of otherRevocationData to the CRL set to be included with the generated SignedData message.
- // *
- // * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data.
- // * @param otherRevocationInfos a Store of otherRevocationInfo data to add.
- // */
- // public void addOtherRevocationInfo(
- // ASN1ObjectIdentifier otherRevocationInfoFormat,
- // Store otherRevocationInfos)
- // {
- // crls.addAll(CMSUtils.getOthersFromStore(otherRevocationInfoFormat, otherRevocationInfos));
- // }
- // END android-removed
+ // BEGIN Android-removed: OtherRevocationInfoFormat isn't supported
+ /*
+ /**
+ * Add a single instance of otherRevocationData to the CRL set to be included with the generated SignedData message.
+ *
+ * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data.
+ * @param otherRevocationInfo the otherRevocationInfo ASN.1 structure.
+ *
+ public void addOtherRevocationInfo(
+ ASN1ObjectIdentifier otherRevocationInfoFormat,
+ ASN1Encodable otherRevocationInfo)
+ {
+ crls.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, otherRevocationInfo)));
+ }
+
+ /**
+ * Add a Store of otherRevocationData to the CRL set to be included with the generated SignedData message.
+ *
+ * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data.
+ * @param otherRevocationInfos a Store of otherRevocationInfo data to add.
+ *
+ public void addOtherRevocationInfo(
+ ASN1ObjectIdentifier otherRevocationInfoFormat,
+ Store otherRevocationInfos)
+ {
+ crls.addAll(CMSUtils.getOthersFromStore(otherRevocationInfoFormat, otherRevocationInfos));
+ }
+ */
+ // END Android-removed: OtherRevocationInfoFormat isn't supported
/**
* Add a store of pre-calculated signers to the generator.
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedHelper.java b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedHelper.java
index 11a927c5..34a5e5ba 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedHelper.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedHelper.java
@@ -13,10 +13,9 @@ import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1Set;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERNull;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.cms.OtherRevocationInfoFormat;
// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.eac.EACObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
@@ -55,16 +54,16 @@ class CMSSignedHelper
addEntries(NISTObjectIdentifiers.dsa_with_sha384, "SHA384", "DSA");
addEntries(NISTObjectIdentifiers.dsa_with_sha512, "SHA512", "DSA");
addEntries(OIWObjectIdentifiers.dsaWithSHA1, "SHA1", "DSA");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// addEntries(OIWObjectIdentifiers.md4WithRSA, "MD4", "RSA");
// addEntries(OIWObjectIdentifiers.md4WithRSAEncryption, "MD4", "RSA");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
addEntries(OIWObjectIdentifiers.md5WithRSA, "MD5", "RSA");
addEntries(OIWObjectIdentifiers.sha1WithRSA, "SHA1", "RSA");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// addEntries(PKCSObjectIdentifiers.md2WithRSAEncryption, "MD2", "RSA");
// addEntries(PKCSObjectIdentifiers.md4WithRSAEncryption, "MD4", "RSA");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
addEntries(PKCSObjectIdentifiers.md5WithRSAEncryption, "MD5", "RSA");
addEntries(PKCSObjectIdentifiers.sha1WithRSAEncryption, "SHA1", "RSA");
addEntries(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224", "RSA");
@@ -91,31 +90,33 @@ class CMSSignedHelper
encryptionAlgs.put(PKCSObjectIdentifiers.rsaEncryption.getId(), "RSA");
encryptionAlgs.put(TeleTrusTObjectIdentifiers.teleTrusTRSAsignatureAlgorithm, "RSA");
encryptionAlgs.put(X509ObjectIdentifiers.id_ea_rsa.getId(), "RSA");
- // BEGIN android-removed
- // encryptionAlgs.put(CMSSignedDataGenerator.ENCRYPTION_RSA_PSS, "RSAandMGF1");
- // encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_94.getId(), "GOST3410");
- // encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_2001.getId(), "ECGOST3410");
- // encryptionAlgs.put("1.3.6.1.4.1.5849.1.6.2", "ECGOST3410");
- // encryptionAlgs.put("1.3.6.1.4.1.5849.1.1.5", "GOST3410");
- // encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001.getId(), "ECGOST3410");
- // encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94.getId(), "GOST3410");
- //
- // digestAlgs.put(PKCSObjectIdentifiers.md2.getId(), "MD2");
- // digestAlgs.put(PKCSObjectIdentifiers.md4.getId(), "MD4");
- // END android-removed
+ // BEGIN Android-removed: Unsupported algorithms
+ /*
+ encryptionAlgs.put(CMSSignedDataGenerator.ENCRYPTION_RSA_PSS, "RSAandMGF1");
+ encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_94.getId(), "GOST3410");
+ encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_2001.getId(), "ECGOST3410");
+ encryptionAlgs.put("1.3.6.1.4.1.5849.1.6.2", "ECGOST3410");
+ encryptionAlgs.put("1.3.6.1.4.1.5849.1.1.5", "GOST3410");
+ encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001.getId(), "ECGOST3410");
+ encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94.getId(), "GOST3410");
+
+ digestAlgs.put(PKCSObjectIdentifiers.md2.getId(), "MD2");
+ digestAlgs.put(PKCSObjectIdentifiers.md4.getId(), "MD4");
+ */
+ // END Android-removed: Unsupported algorithms
digestAlgs.put(PKCSObjectIdentifiers.md5.getId(), "MD5");
digestAlgs.put(OIWObjectIdentifiers.idSHA1.getId(), "SHA1");
digestAlgs.put(NISTObjectIdentifiers.id_sha224.getId(), "SHA224");
digestAlgs.put(NISTObjectIdentifiers.id_sha256.getId(), "SHA256");
digestAlgs.put(NISTObjectIdentifiers.id_sha384.getId(), "SHA384");
digestAlgs.put(NISTObjectIdentifiers.id_sha512.getId(), "SHA512");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd128.getId(), "RIPEMD128");
// digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd160.getId(), "RIPEMD160");
// digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd256.getId(), "RIPEMD256");
// digestAlgs.put(CryptoProObjectIdentifiers.gostR3411.getId(), "GOST3411");
// digestAlgs.put("1.3.6.1.4.1.5849.1.2.1", "GOST3411");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
digestAliases.put("SHA1", new String[] { "SHA-1" });
digestAliases.put("SHA224", new String[] { "SHA-224" });
@@ -229,35 +230,39 @@ class CMSSignedHelper
return new CollectionStore(new ArrayList());
}
- // Store getOtherRevocationInfo(ASN1ObjectIdentifier otherRevocationInfoFormat, ASN1Set crlSet)
- // {
- // if (crlSet != null)
- // {
- // List crlList = new ArrayList(crlSet.size());
- //
- // for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();)
- // {
- // ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
- //
- // if (obj instanceof ASN1TaggedObject)
- // {
- // ASN1TaggedObject tObj = ASN1TaggedObject.getInstance(obj);
- //
- // if (tObj.getTagNo() == 1)
- // {
- // OtherRevocationInfoFormat other = OtherRevocationInfoFormat.getInstance(tObj, false);
- //
- // if (otherRevocationInfoFormat.equals(other.getInfoFormat()))
- // {
- // crlList.add(other.getInfo());
- // }
- // }
- // }
- // }
- //
- // return new CollectionStore(crlList);
- // }
- //
- // return new CollectionStore(new ArrayList());
- // }
+ // BEGIN Android-removed: OtherRevocationInfoFormat isn't supported
+ /*
+ Store getOtherRevocationInfo(ASN1ObjectIdentifier otherRevocationInfoFormat, ASN1Set crlSet)
+ {
+ if (crlSet != null)
+ {
+ List crlList = new ArrayList(crlSet.size());
+
+ for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();)
+ {
+ ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
+
+ if (obj instanceof ASN1TaggedObject)
+ {
+ ASN1TaggedObject tObj = ASN1TaggedObject.getInstance(obj);
+
+ if (tObj.getTagNo() == 1)
+ {
+ OtherRevocationInfoFormat other = OtherRevocationInfoFormat.getInstance(tObj, false);
+
+ if (otherRevocationInfoFormat.equals(other.getInfoFormat()))
+ {
+ crlList.add(other.getInfo());
+ }
+ }
+ }
+ }
+
+ return new CollectionStore(crlList);
+ }
+
+ return new CollectionStore(new ArrayList());
+ }
+ */
+ // END Android-removed: OtherRevocationInfoFormat isn't supported
}
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/CMSUtils.java b/bcpkix/src/main/java/org/bouncycastle/cms/CMSUtils.java
index 0cd1f5f6..11c58b70 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/CMSUtils.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/CMSUtils.java
@@ -23,13 +23,12 @@ import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
import org.bouncycastle.asn1.cms.ContentInfo;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.cms.OtherRevocationInfoFormat;
// import org.bouncycastle.asn1.ocsp.OCSPResponse;
// import org.bouncycastle.asn1.ocsp.OCSPResponseStatus;
// import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
// import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.X509AttributeCertificateHolder;
import org.bouncycastle.cert.X509CRLHolder;
@@ -49,12 +48,12 @@ class CMSUtils
{
des.add("DES");
des.add("DESEDE");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// des.add(OIWObjectIdentifiers.desCBC.getId());
// des.add(PKCSObjectIdentifiers.des_EDE3_CBC.getId());
// des.add(PKCSObjectIdentifiers.des_EDE3_CBC.getId());
// des.add(PKCSObjectIdentifiers.id_alg_CMS3DESwrap.getId());
- // END android-removed
+ // END Android-removed: Unsupported algorithms
}
static boolean isDES(String algorithmID)
@@ -164,7 +163,7 @@ class CMSUtils
crls.add(c.toASN1Structure());
}
- // BEGIN android-removed
+ // BEGIN Android-removed: OtherRevocationInfoFormat isn't supported
// else if (rev instanceof OtherRevocationInfoFormat)
// {
// OtherRevocationInfoFormat infoFormat = OtherRevocationInfoFormat.getInstance(rev);
@@ -173,7 +172,7 @@ class CMSUtils
//
// crls.add(new DERTaggedObject(false, 1, infoFormat));
// }
- // END android-removed
+ // END Android-removed: OtherRevocationInfoFormat isn't supported
else if (rev instanceof ASN1TaggedObject)
{
crls.add(rev);
@@ -188,36 +187,39 @@ class CMSUtils
}
}
- // BEGIN android-removed
- // private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat)
- // {
- // if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat()))
- // {
- // OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo());
- //
- // if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
- // {
- // throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
- // }
- // }
- // }
- //
- // static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
- // {
- // List others = new ArrayList();
- //
- // for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
- // {
- // ASN1Encodable info = (ASN1Encodable)it.next();
- // OtherRevocationInfoFormat infoFormat = new OtherRevocationInfoFormat(otherRevocationInfoFormat, info);
- // validateInfoFormat(infoFormat);
- //
- // others.add(new DERTaggedObject(false, 1, infoFormat));
- // }
- //
- // return others;
- // }
- // END android-removed
+ // BEGIN Android-removed: OtherRevocationInfoFormat isn't supported
+ /*
+ private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat)
+ {
+ if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat()))
+ {
+ OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo());
+
+ if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
+ {
+ throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
+ }
+ }
+ }
+
+ static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
+ {
+ List others = new ArrayList();
+
+ for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
+ {
+ ASN1Encodable info = (ASN1Encodable)it.next();
+ OtherRevocationInfoFormat infoFormat = new OtherRevocationInfoFormat(otherRevocationInfoFormat, info);
+
+ validateInfoFormat(infoFormat);
+
+ others.add(new DERTaggedObject(false, 1, infoFormat));
+ }
+
+ return others;
+ }
+ */
+ // END Android-removed: OtherRevocationInfoFormat isn't supported
static ASN1Set createBerSetFromList(List derObjects)
{
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureAlgorithmNameGenerator.java b/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureAlgorithmNameGenerator.java
index 2230c780..255efa53 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureAlgorithmNameGenerator.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureAlgorithmNameGenerator.java
@@ -4,10 +4,9 @@ import java.util.HashMap;
import java.util.Map;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.bsi.BSIObjectIdentifiers;
// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.eac.EACObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
@@ -36,16 +35,16 @@ public class DefaultCMSSignatureAlgorithmNameGenerator
addEntries(NISTObjectIdentifiers.dsa_with_sha384, "SHA384", "DSA");
addEntries(NISTObjectIdentifiers.dsa_with_sha512, "SHA512", "DSA");
addEntries(OIWObjectIdentifiers.dsaWithSHA1, "SHA1", "DSA");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// addEntries(OIWObjectIdentifiers.md4WithRSA, "MD4", "RSA");
// addEntries(OIWObjectIdentifiers.md4WithRSAEncryption, "MD4", "RSA");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
addEntries(OIWObjectIdentifiers.md5WithRSA, "MD5", "RSA");
addEntries(OIWObjectIdentifiers.sha1WithRSA, "SHA1", "RSA");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// addEntries(PKCSObjectIdentifiers.md2WithRSAEncryption, "MD2", "RSA");
// addEntries(PKCSObjectIdentifiers.md4WithRSAEncryption, "MD4", "RSA");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
addEntries(PKCSObjectIdentifiers.md5WithRSAEncryption, "MD5", "RSA");
addEntries(PKCSObjectIdentifiers.sha1WithRSAEncryption, "SHA1", "RSA");
addEntries(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224", "RSA");
@@ -72,21 +71,21 @@ public class DefaultCMSSignatureAlgorithmNameGenerator
addEntries(EACObjectIdentifiers.id_TA_RSA_v1_5_SHA_256, "SHA256", "RSA");
addEntries(EACObjectIdentifiers.id_TA_RSA_PSS_SHA_1, "SHA1", "RSAandMGF1");
addEntries(EACObjectIdentifiers.id_TA_RSA_PSS_SHA_256, "SHA256", "RSAandMGF1");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// addEntries(BSIObjectIdentifiers.ecdsa_plain_SHA1, "SHA1", "PLAIN-ECDSA");
// addEntries(BSIObjectIdentifiers.ecdsa_plain_SHA224, "SHA224", "PLAIN-ECDSA");
// addEntries(BSIObjectIdentifiers.ecdsa_plain_SHA256, "SHA256", "PLAIN-ECDSA");
// addEntries(BSIObjectIdentifiers.ecdsa_plain_SHA384, "SHA384", "PLAIN-ECDSA");
// addEntries(BSIObjectIdentifiers.ecdsa_plain_SHA512, "SHA512", "PLAIN-ECDSA");
// addEntries(BSIObjectIdentifiers.ecdsa_plain_RIPEMD160, "RIPEMD160", "PLAIN-ECDSA");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
encryptionAlgs.put(X9ObjectIdentifiers.id_dsa, "DSA");
encryptionAlgs.put(PKCSObjectIdentifiers.rsaEncryption, "RSA");
encryptionAlgs.put(TeleTrusTObjectIdentifiers.teleTrusTRSAsignatureAlgorithm, "RSA");
encryptionAlgs.put(X509ObjectIdentifiers.id_ea_rsa, "RSA");
encryptionAlgs.put(PKCSObjectIdentifiers.id_RSASSA_PSS, "RSAandMGF1");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_94, "GOST3410");
// encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_2001, "ECGOST3410");
// encryptionAlgs.put(new ASN1ObjectIdentifier("1.3.6.1.4.1.5849.1.6.2"), "ECGOST3410");
@@ -96,20 +95,20 @@ public class DefaultCMSSignatureAlgorithmNameGenerator
//
// digestAlgs.put(PKCSObjectIdentifiers.md2, "MD2");
// digestAlgs.put(PKCSObjectIdentifiers.md4, "MD4");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
digestAlgs.put(PKCSObjectIdentifiers.md5, "MD5");
digestAlgs.put(OIWObjectIdentifiers.idSHA1, "SHA1");
digestAlgs.put(NISTObjectIdentifiers.id_sha224, "SHA224");
digestAlgs.put(NISTObjectIdentifiers.id_sha256, "SHA256");
digestAlgs.put(NISTObjectIdentifiers.id_sha384, "SHA384");
digestAlgs.put(NISTObjectIdentifiers.id_sha512, "SHA512");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd128, "RIPEMD128");
// digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd160, "RIPEMD160");
// digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd256, "RIPEMD256");
// digestAlgs.put(CryptoProObjectIdentifiers.gostR3411, "GOST3411");
// digestAlgs.put(new ASN1ObjectIdentifier("1.3.6.1.4.1.5849.1.2.1"), "GOST3411");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
}
/**
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureEncryptionAlgorithmFinder.java b/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureEncryptionAlgorithmFinder.java
index 780d4660..fb537438 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureEncryptionAlgorithmFinder.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureEncryptionAlgorithmFinder.java
@@ -16,27 +16,29 @@ public class DefaultCMSSignatureEncryptionAlgorithmFinder
static
{
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// RSA_PKCS1d5.add(PKCSObjectIdentifiers.md2WithRSAEncryption);
// RSA_PKCS1d5.add(PKCSObjectIdentifiers.md4WithRSAEncryption);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
RSA_PKCS1d5.add(PKCSObjectIdentifiers.md5WithRSAEncryption);
RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha1WithRSAEncryption);
+ // BEGIN Android-added: Add support for SHA-2 family signatures
RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha224WithRSAEncryption);
RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha256WithRSAEncryption);
RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha384WithRSAEncryption);
RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha512WithRSAEncryption);
- // BEGIN android-removed
+ // END Android-added: Add support for SHA-2 family signatures
+ // BEGIN Android-removed: Unsupported algorithms
// RSA_PKCS1d5.add(OIWObjectIdentifiers.md4WithRSAEncryption);
// RSA_PKCS1d5.add(OIWObjectIdentifiers.md4WithRSA);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
RSA_PKCS1d5.add(OIWObjectIdentifiers.md5WithRSA);
RSA_PKCS1d5.add(OIWObjectIdentifiers.sha1WithRSA);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// RSA_PKCS1d5.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
// RSA_PKCS1d5.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
// RSA_PKCS1d5.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
}
public AlgorithmIdentifier findEncryptionAlgorithm(AlgorithmIdentifier signatureAlgorithm)
diff --git a/bcpkix/src/main/java/org/bouncycastle/operator/DefaultDigestAlgorithmIdentifierFinder.java b/bcpkix/src/main/java/org/bouncycastle/operator/DefaultDigestAlgorithmIdentifierFinder.java
index e369185c..3607c9b9 100644
--- a/bcpkix/src/main/java/org/bouncycastle/operator/DefaultDigestAlgorithmIdentifierFinder.java
+++ b/bcpkix/src/main/java/org/bouncycastle/operator/DefaultDigestAlgorithmIdentifierFinder.java
@@ -5,11 +5,10 @@ import java.util.Map;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DERNull;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.bc.BCObjectIdentifiers;
// import org.bouncycastle.asn1.bsi.BSIObjectIdentifiers;
// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
@@ -29,20 +28,20 @@ public class DefaultDigestAlgorithmIdentifierFinder
//
// digests
//
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestOids.put(OIWObjectIdentifiers.md4WithRSAEncryption, PKCSObjectIdentifiers.md4);
// digestOids.put(OIWObjectIdentifiers.md4WithRSA, PKCSObjectIdentifiers.md4);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
digestOids.put(OIWObjectIdentifiers.sha1WithRSA, OIWObjectIdentifiers.idSHA1);
digestOids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, NISTObjectIdentifiers.id_sha224);
digestOids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, NISTObjectIdentifiers.id_sha256);
digestOids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, NISTObjectIdentifiers.id_sha384);
digestOids.put(PKCSObjectIdentifiers.sha512WithRSAEncryption, NISTObjectIdentifiers.id_sha512);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestOids.put(PKCSObjectIdentifiers.md2WithRSAEncryption, PKCSObjectIdentifiers.md2);
// digestOids.put(PKCSObjectIdentifiers.md4WithRSAEncryption, PKCSObjectIdentifiers.md4);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
digestOids.put(PKCSObjectIdentifiers.md5WithRSAEncryption, PKCSObjectIdentifiers.md5);
digestOids.put(PKCSObjectIdentifiers.sha1WithRSAEncryption, OIWObjectIdentifiers.idSHA1);
@@ -53,49 +52,45 @@ public class DefaultDigestAlgorithmIdentifierFinder
digestOids.put(X9ObjectIdentifiers.ecdsa_with_SHA512, NISTObjectIdentifiers.id_sha512);
digestOids.put(X9ObjectIdentifiers.id_dsa_with_sha1, OIWObjectIdentifiers.idSHA1);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestOids.put(BSIObjectIdentifiers.ecdsa_plain_SHA1, OIWObjectIdentifiers.idSHA1);
// digestOids.put(BSIObjectIdentifiers.ecdsa_plain_SHA224, NISTObjectIdentifiers.id_sha224);
// digestOids.put(BSIObjectIdentifiers.ecdsa_plain_SHA256, NISTObjectIdentifiers.id_sha256);
// digestOids.put(BSIObjectIdentifiers.ecdsa_plain_SHA384, NISTObjectIdentifiers.id_sha384);
// digestOids.put(BSIObjectIdentifiers.ecdsa_plain_SHA512, NISTObjectIdentifiers.id_sha512);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
digestOids.put(NISTObjectIdentifiers.dsa_with_sha224, NISTObjectIdentifiers.id_sha224);
digestOids.put(NISTObjectIdentifiers.dsa_with_sha256, NISTObjectIdentifiers.id_sha256);
digestOids.put(NISTObjectIdentifiers.dsa_with_sha384, NISTObjectIdentifiers.id_sha384);
digestOids.put(NISTObjectIdentifiers.dsa_with_sha512, NISTObjectIdentifiers.id_sha512);
- // BEGIN android-removed
- // digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128, TeleTrusTObjectIdentifiers.ripemd128);
- // digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160, TeleTrusTObjectIdentifiers.ripemd160);
- // digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256, TeleTrusTObjectIdentifiers.ripemd256);
- //
- // digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, CryptoProObjectIdentifiers.gostR3411);
- // digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, CryptoProObjectIdentifiers.gostR3411);
- // digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_224, NISTObjectIdentifiers.id_sha3_224);
- // digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_256, NISTObjectIdentifiers.id_sha3_256);
- // digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_384, NISTObjectIdentifiers.id_sha3_384);
- // digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_512, NISTObjectIdentifiers.id_sha3_512);
- // digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_224, NISTObjectIdentifiers.id_sha3_224);
- // digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_256, NISTObjectIdentifiers.id_sha3_256);
- // digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_384, NISTObjectIdentifiers.id_sha3_384);
- // digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_512, NISTObjectIdentifiers.id_sha3_512);
- // digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_224, NISTObjectIdentifiers.id_sha3_224);
- // digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_256, NISTObjectIdentifiers.id_sha3_256);
- // digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_384, NISTObjectIdentifiers.id_sha3_384);
- // digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_512, NISTObjectIdentifiers.id_sha3_512);
- //
- // digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128, TeleTrusTObjectIdentifiers.ripemd128);
- // digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160, TeleTrusTObjectIdentifiers.ripemd160);
- // digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256, TeleTrusTObjectIdentifiers.ripemd256);
- //
- // digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, CryptoProObjectIdentifiers.gostR3411);
- // digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, CryptoProObjectIdentifiers.gostR3411);
- //
- // digestOids.put(BCObjectIdentifiers.sphincs256_with_SHA3_512, NISTObjectIdentifiers.id_sha3_512);
- // digestOids.put(BCObjectIdentifiers.sphincs256_with_SHA512, NISTObjectIdentifiers.id_sha512);
- // END android-removed
+ // BEGIN Android-removed: Unsupported algorithms
+ /*
+ digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_224, NISTObjectIdentifiers.id_sha3_224);
+ digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_256, NISTObjectIdentifiers.id_sha3_256);
+ digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_384, NISTObjectIdentifiers.id_sha3_384);
+ digestOids.put(NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_512, NISTObjectIdentifiers.id_sha3_512);
+ digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_224, NISTObjectIdentifiers.id_sha3_224);
+ digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_256, NISTObjectIdentifiers.id_sha3_256);
+ digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_384, NISTObjectIdentifiers.id_sha3_384);
+ digestOids.put(NISTObjectIdentifiers.id_dsa_with_sha3_512, NISTObjectIdentifiers.id_sha3_512);
+ digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_224, NISTObjectIdentifiers.id_sha3_224);
+ digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_256, NISTObjectIdentifiers.id_sha3_256);
+ digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_384, NISTObjectIdentifiers.id_sha3_384);
+ digestOids.put(NISTObjectIdentifiers.id_ecdsa_with_sha3_512, NISTObjectIdentifiers.id_sha3_512);
+
+ digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128, TeleTrusTObjectIdentifiers.ripemd128);
+ digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160, TeleTrusTObjectIdentifiers.ripemd160);
+ digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256, TeleTrusTObjectIdentifiers.ripemd256);
+
+ digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, CryptoProObjectIdentifiers.gostR3411);
+ digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, CryptoProObjectIdentifiers.gostR3411);
+
+ digestOids.put(BCObjectIdentifiers.sphincs256_with_SHA3_512, NISTObjectIdentifiers.id_sha3_512);
+ digestOids.put(BCObjectIdentifiers.sphincs256_with_SHA512, NISTObjectIdentifiers.id_sha512);
+ */
+ // END Android-removed: Unsupported algorithms
digestNameToOids.put("SHA-1", OIWObjectIdentifiers.idSHA1);
@@ -103,38 +98,40 @@ public class DefaultDigestAlgorithmIdentifierFinder
digestNameToOids.put("SHA-256", NISTObjectIdentifiers.id_sha256);
digestNameToOids.put("SHA-384", NISTObjectIdentifiers.id_sha384);
digestNameToOids.put("SHA-512", NISTObjectIdentifiers.id_sha512);
- // BEGIN android-removed
- // digestNameToOids.put("SHA-512-224", NISTObjectIdentifiers.id_sha512_224);
- // digestNameToOids.put("SHA-512-256", NISTObjectIdentifiers.id_sha512_256);
- //
- // digestNameToOids.put("SHA1", OIWObjectIdentifiers.idSHA1);
- // digestNameToOids.put("SHA224", NISTObjectIdentifiers.id_sha224);
- // digestNameToOids.put("SHA256", NISTObjectIdentifiers.id_sha256);
- // digestNameToOids.put("SHA384", NISTObjectIdentifiers.id_sha384);
- // digestNameToOids.put("SHA512", NISTObjectIdentifiers.id_sha512);
- // digestNameToOids.put("SHA512-224", NISTObjectIdentifiers.id_sha512_224);
- // digestNameToOids.put("SHA512-256", NISTObjectIdentifiers.id_sha512_256);
-
- // digestNameToOids.put("SHA3-224", NISTObjectIdentifiers.id_sha3_224);
- // digestNameToOids.put("SHA3-256", NISTObjectIdentifiers.id_sha3_256);
- // digestNameToOids.put("SHA3-384", NISTObjectIdentifiers.id_sha3_384);
- // digestNameToOids.put("SHA3-512", NISTObjectIdentifiers.id_sha3_512);
- //
- // digestNameToOids.put("SHAKE-128", NISTObjectIdentifiers.id_shake128);
- // digestNameToOids.put("SHAKE-256", NISTObjectIdentifiers.id_shake256);
- //
- // digestNameToOids.put("GOST3411", CryptoProObjectIdentifiers.gostR3411);
- //
- // digestNameToOids.put("MD2", PKCSObjectIdentifiers.md2);
- // digestNameToOids.put("MD4", PKCSObjectIdentifiers.md4);
- // END android-removed
+ // BEGIN Android-removed: Unsupported algorithms
+ /*
+ digestNameToOids.put("SHA-512-224", NISTObjectIdentifiers.id_sha512_224);
+ digestNameToOids.put("SHA-512-256", NISTObjectIdentifiers.id_sha512_256);
+
+ digestNameToOids.put("SHA1", OIWObjectIdentifiers.idSHA1);
+ digestNameToOids.put("SHA224", NISTObjectIdentifiers.id_sha224);
+ digestNameToOids.put("SHA256", NISTObjectIdentifiers.id_sha256);
+ digestNameToOids.put("SHA384", NISTObjectIdentifiers.id_sha384);
+ digestNameToOids.put("SHA512", NISTObjectIdentifiers.id_sha512);
+ digestNameToOids.put("SHA512-224", NISTObjectIdentifiers.id_sha512_224);
+ digestNameToOids.put("SHA512-256", NISTObjectIdentifiers.id_sha512_256);
+
+ digestNameToOids.put("SHA3-224", NISTObjectIdentifiers.id_sha3_224);
+ digestNameToOids.put("SHA3-256", NISTObjectIdentifiers.id_sha3_256);
+ digestNameToOids.put("SHA3-384", NISTObjectIdentifiers.id_sha3_384);
+ digestNameToOids.put("SHA3-512", NISTObjectIdentifiers.id_sha3_512);
+
+ digestNameToOids.put("SHAKE-128", NISTObjectIdentifiers.id_shake128);
+ digestNameToOids.put("SHAKE-256", NISTObjectIdentifiers.id_shake256);
+
+ digestNameToOids.put("GOST3411", CryptoProObjectIdentifiers.gostR3411);
+
+ digestNameToOids.put("MD2", PKCSObjectIdentifiers.md2);
+ digestNameToOids.put("MD4", PKCSObjectIdentifiers.md4);
+ */
+ // END Android-removed: Unsupported algorithms
digestNameToOids.put("MD5", PKCSObjectIdentifiers.md5);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestNameToOids.put("RIPEMD128", TeleTrusTObjectIdentifiers.ripemd128);
// digestNameToOids.put("RIPEMD160", TeleTrusTObjectIdentifiers.ripemd160);
// digestNameToOids.put("RIPEMD256", TeleTrusTObjectIdentifiers.ripemd256);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
}
public AlgorithmIdentifier find(AlgorithmIdentifier sigAlgId)
@@ -157,4 +154,4 @@ public class DefaultDigestAlgorithmIdentifierFinder
{
return new AlgorithmIdentifier((ASN1ObjectIdentifier)digestNameToOids.get(digAlgName), DERNull.INSTANCE);
}
-}
+} \ No newline at end of file
diff --git a/bcpkix/src/main/java/org/bouncycastle/operator/DefaultSignatureAlgorithmIdentifierFinder.java b/bcpkix/src/main/java/org/bouncycastle/operator/DefaultSignatureAlgorithmIdentifierFinder.java
index d1976afb..1c80fb49 100644
--- a/bcpkix/src/main/java/org/bouncycastle/operator/DefaultSignatureAlgorithmIdentifierFinder.java
+++ b/bcpkix/src/main/java/org/bouncycastle/operator/DefaultSignatureAlgorithmIdentifierFinder.java
@@ -9,13 +9,12 @@ import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DERNull;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.bc.BCObjectIdentifiers;
// import org.bouncycastle.asn1.bsi.BSIObjectIdentifiers;
// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
// import org.bouncycastle.asn1.eac.EACObjectIdentifiers;
// import org.bouncycastle.asn1.gm.GMObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
@@ -38,17 +37,17 @@ public class DefaultSignatureAlgorithmIdentifierFinder
private static final ASN1ObjectIdentifier ENCRYPTION_DSA = X9ObjectIdentifiers.id_dsa_with_sha1;
private static final ASN1ObjectIdentifier ENCRYPTION_ECDSA = X9ObjectIdentifiers.ecdsa_with_SHA1;
private static final ASN1ObjectIdentifier ENCRYPTION_RSA_PSS = PKCSObjectIdentifiers.id_RSASSA_PSS;
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// private static final ASN1ObjectIdentifier ENCRYPTION_GOST3410 = CryptoProObjectIdentifiers.gostR3410_94;
// private static final ASN1ObjectIdentifier ENCRYPTION_ECGOST3410 = CryptoProObjectIdentifiers.gostR3410_2001;
- // END android-removed
+ // END Android-removed: Unsupported algorithms
static
{
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// algorithms.put("MD2WITHRSAENCRYPTION", PKCSObjectIdentifiers.md2WithRSAEncryption);
// algorithms.put("MD2WITHRSA", PKCSObjectIdentifiers.md2WithRSAEncryption);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
algorithms.put("MD5WITHRSAENCRYPTION", PKCSObjectIdentifiers.md5WithRSAEncryption);
algorithms.put("MD5WITHRSA", PKCSObjectIdentifiers.md5WithRSAEncryption);
algorithms.put("SHA1WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha1WithRSAEncryption);
@@ -66,14 +65,14 @@ public class DefaultSignatureAlgorithmIdentifierFinder
algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
// algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
// algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
// algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
// algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
// algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
algorithms.put("SHA1WITHDSA", X9ObjectIdentifiers.id_dsa_with_sha1);
algorithms.put("DSAWITHSHA1", X9ObjectIdentifiers.id_dsa_with_sha1);
algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224);
@@ -87,27 +86,29 @@ public class DefaultSignatureAlgorithmIdentifierFinder
algorithms.put("SHA384WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384);
algorithms.put("SHA512WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512);
- // BEGIN android-removed
- // algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
- // algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
- // algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
- // algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
- // algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
- // algorithms.put("SHA1WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA1);
- // algorithms.put("SHA224WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA224);
- // algorithms.put("SHA256WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA256);
- // algorithms.put("SHA384WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA384);
- // algorithms.put("SHA512WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA512);
- // algorithms.put("RIPEMD160WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_RIPEMD160);
- // algorithms.put("SHA1WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1);
- // algorithms.put("SHA224WITHPCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_224);
- // algorithms.put("SHA256WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_256);
- // algorithms.put("SHA384WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_384);
- // algorithms.put("SHA512WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_512);
- // algorithms.put("SHA3-512WITHSPHINCS256", BCObjectIdentifiers.sphincs256_with_SHA3_512);
- // algorithms.put("SHA512WITHSPHINCS256", BCObjectIdentifiers.sphincs256_with_SHA512);
- // algorithms.put("SM3WITHSM2", GMObjectIdentifiers.sm2sign_with_sm3);
- // END android-removed
+ // BEGIN Android-removed: Unsupported algorithms
+ /*
+ algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
+ algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
+ algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
+ algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
+ algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
+ algorithms.put("SHA1WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA1);
+ algorithms.put("SHA224WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA224);
+ algorithms.put("SHA256WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA256);
+ algorithms.put("SHA384WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA384);
+ algorithms.put("SHA512WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_SHA512);
+ algorithms.put("RIPEMD160WITHPLAIN-ECDSA", BSIObjectIdentifiers.ecdsa_plain_RIPEMD160);
+ algorithms.put("SHA1WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_1);
+ algorithms.put("SHA224WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_224);
+ algorithms.put("SHA256WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_256);
+ algorithms.put("SHA384WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_384);
+ algorithms.put("SHA512WITHCVC-ECDSA", EACObjectIdentifiers.id_TA_ECDSA_SHA_512);
+ algorithms.put("SHA3-512WITHSPHINCS256", BCObjectIdentifiers.sphincs256_with_SHA3_512);
+ algorithms.put("SHA512WITHSPHINCS256", BCObjectIdentifiers.sphincs256_with_SHA512);
+ algorithms.put("SM3WITHSM2", GMObjectIdentifiers.sm2sign_with_sm3);
+ */
+ // END Android-removed: Unsupported algorithms
//
// According to RFC 3279, the ASN.1 encoding SHALL (id-dsa-with-sha1) or MUST (ecdsa-with-SHA*) omit the parameters field.
@@ -124,23 +125,26 @@ public class DefaultSignatureAlgorithmIdentifierFinder
noParams.add(NISTObjectIdentifiers.dsa_with_sha384);
noParams.add(NISTObjectIdentifiers.dsa_with_sha512);
- // BEGIN Android-removed
+ // BEGIN Android-removed: Unsupported algorithms
+ /*
//
// RFC 4491
//
- // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
- // noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
+ noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
+ noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
+
//
// SPHINCS-256
//
- // noParams.add(BCObjectIdentifiers.sphincs256_with_SHA512);
- // noParams.add(BCObjectIdentifiers.sphincs256_with_SHA3_512);
+ noParams.add(BCObjectIdentifiers.sphincs256_with_SHA512);
+ noParams.add(BCObjectIdentifiers.sphincs256_with_SHA3_512);
//
// SM2
//
- // noParams.add(GMObjectIdentifiers.sm2sign_with_sm3);
- // END android-removed
+ noParams.add(GMObjectIdentifiers.sm2sign_with_sm3);
+ */
+ // END Android-removed: Unsupported algorithms
//
// PKCS 1.5 encrypted algorithms
@@ -150,11 +154,11 @@ public class DefaultSignatureAlgorithmIdentifierFinder
pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha256WithRSAEncryption);
pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha384WithRSAEncryption);
pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha512WithRSAEncryption);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// pkcs15RsaEncryption.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
// pkcs15RsaEncryption.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
// pkcs15RsaEncryption.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
//
// explicit params
@@ -181,19 +185,19 @@ public class DefaultSignatureAlgorithmIdentifierFinder
digestOids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, NISTObjectIdentifiers.id_sha256);
digestOids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, NISTObjectIdentifiers.id_sha384);
digestOids.put(PKCSObjectIdentifiers.sha512WithRSAEncryption, NISTObjectIdentifiers.id_sha512);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestOids.put(PKCSObjectIdentifiers.md2WithRSAEncryption, PKCSObjectIdentifiers.md2);
// digestOids.put(PKCSObjectIdentifiers.md4WithRSAEncryption, PKCSObjectIdentifiers.md4);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
digestOids.put(PKCSObjectIdentifiers.md5WithRSAEncryption, PKCSObjectIdentifiers.md5);
digestOids.put(PKCSObjectIdentifiers.sha1WithRSAEncryption, OIWObjectIdentifiers.idSHA1);
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128, TeleTrusTObjectIdentifiers.ripemd128);
// digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160, TeleTrusTObjectIdentifiers.ripemd160);
// digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256, TeleTrusTObjectIdentifiers.ripemd256);
// digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, CryptoProObjectIdentifiers.gostR3411);
// digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, CryptoProObjectIdentifiers.gostR3411);
- // END android-removed
+ // END Android-removed: Unsupported algorithms
}
private static AlgorithmIdentifier generate(String signatureAlgorithm)
@@ -256,4 +260,4 @@ public class DefaultSignatureAlgorithmIdentifierFinder
{
return generate(sigAlgName);
}
-}
+} \ No newline at end of file
diff --git a/bcpkix/src/main/java/org/bouncycastle/operator/bc/BcDefaultDigestProvider.java b/bcpkix/src/main/java/org/bouncycastle/operator/bc/BcDefaultDigestProvider.java
index 74c0aa29..30d6e6f2 100644
--- a/bcpkix/src/main/java/org/bouncycastle/operator/bc/BcDefaultDigestProvider.java
+++ b/bcpkix/src/main/java/org/bouncycastle/operator/bc/BcDefaultDigestProvider.java
@@ -4,33 +4,29 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.crypto.ExtendedDigest;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.crypto.digests.GOST3411Digest;
// import org.bouncycastle.crypto.digests.MD2Digest;
// import org.bouncycastle.crypto.digests.MD4Digest;
-// END android-removed
import org.bouncycastle.crypto.digests.MD5Digest;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.crypto.digests.RIPEMD128Digest;
// import org.bouncycastle.crypto.digests.RIPEMD160Digest;
// import org.bouncycastle.crypto.digests.RIPEMD256Digest;
-// END 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;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.crypto.digests.SHA3Digest;
-// END android-removed
import org.bouncycastle.crypto.digests.SHA512Digest;
import org.bouncycastle.operator.OperatorCreationException;
@@ -78,85 +74,87 @@ public class BcDefaultDigestProvider
return new SHA512Digest();
}
});
- // BEGIN android-removed
- // table.put(NISTObjectIdentifiers.id_sha3_224, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new SHA3Digest(224);
- // }
- // });
- // table.put(NISTObjectIdentifiers.id_sha3_256, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new SHA3Digest(256);
- // }
- // });
- // table.put(NISTObjectIdentifiers.id_sha3_384, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new SHA3Digest(384);
- // }
- // });
- // table.put(NISTObjectIdentifiers.id_sha3_512, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new SHA3Digest(512);
- // }
- // });
- // table.put(PKCSObjectIdentifiers.md5, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new MD5Digest();
- // }
- // });
- // table.put(PKCSObjectIdentifiers.md4, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new MD4Digest();
- // }
- // });
- // table.put(PKCSObjectIdentifiers.md2, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new MD2Digest();
- // }
- // });
- // table.put(CryptoProObjectIdentifiers.gostR3411, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new GOST3411Digest();
- // }
- // });
- // table.put(TeleTrusTObjectIdentifiers.ripemd128, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new RIPEMD128Digest();
- // }
- // });
- // table.put(TeleTrusTObjectIdentifiers.ripemd160, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new RIPEMD160Digest();
- // }
- // });
- // table.put(TeleTrusTObjectIdentifiers.ripemd256, new BcDigestProvider()
- // {
- // public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
- // {
- // return new RIPEMD256Digest();
- // }
- // });
- // END android-removed
+ // BEGIN Android-removed: Unsupported algorithms
+ /*
+ table.put(NISTObjectIdentifiers.id_sha3_224, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new SHA3Digest(224);
+ }
+ });
+ table.put(NISTObjectIdentifiers.id_sha3_256, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new SHA3Digest(256);
+ }
+ });
+ table.put(NISTObjectIdentifiers.id_sha3_384, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new SHA3Digest(384);
+ }
+ });
+ table.put(NISTObjectIdentifiers.id_sha3_512, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new SHA3Digest(512);
+ }
+ });
+ table.put(PKCSObjectIdentifiers.md5, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new MD5Digest();
+ }
+ });
+ table.put(PKCSObjectIdentifiers.md4, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new MD4Digest();
+ }
+ });
+ table.put(PKCSObjectIdentifiers.md2, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new MD2Digest();
+ }
+ });
+ table.put(CryptoProObjectIdentifiers.gostR3411, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new GOST3411Digest();
+ }
+ });
+ table.put(TeleTrusTObjectIdentifiers.ripemd128, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new RIPEMD128Digest();
+ }
+ });
+ table.put(TeleTrusTObjectIdentifiers.ripemd160, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new RIPEMD160Digest();
+ }
+ });
+ table.put(TeleTrusTObjectIdentifiers.ripemd256, new BcDigestProvider()
+ {
+ public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
+ {
+ return new RIPEMD256Digest();
+ }
+ });
+ */
+ // END Android-removed: Unsupported algorithms
return Collections.unmodifiableMap(table);
}
diff --git a/bcpkix/src/main/java/org/bouncycastle/operator/jcajce/OperatorHelper.java b/bcpkix/src/main/java/org/bouncycastle/operator/jcajce/OperatorHelper.java
index 8ac72ea6..a06792b4 100644
--- a/bcpkix/src/main/java/org/bouncycastle/operator/jcajce/OperatorHelper.java
+++ b/bcpkix/src/main/java/org/bouncycastle/operator/jcajce/OperatorHelper.java
@@ -25,11 +25,10 @@ import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERNull;
-// BEGIN android-removed
+// Android-removed: Unsupported algorithms
// import org.bouncycastle.asn1.bsi.BSIObjectIdentifiers;
// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
// import org.bouncycastle.asn1.eac.EACObjectIdentifiers;
-// END android-removed
import org.bouncycastle.asn1.kisa.KISAObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.ntt.NTTObjectIdentifiers;
@@ -65,7 +64,7 @@ class OperatorHelper
oids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256WITHRSA");
oids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384WITHRSA");
oids.put(PKCSObjectIdentifiers.sha512WithRSAEncryption, "SHA512WITHRSA");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3411WITHGOST3410");
// oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "GOST3411WITHECGOST3410");
// oids.put(BSIObjectIdentifiers.ecdsa_plain_SHA1, "SHA1WITHPLAIN-ECDSA");
@@ -79,12 +78,12 @@ class OperatorHelper
// oids.put(EACObjectIdentifiers.id_TA_ECDSA_SHA_256, "SHA256WITHCVC-ECDSA");
// oids.put(EACObjectIdentifiers.id_TA_ECDSA_SHA_384, "SHA384WITHCVC-ECDSA");
// oids.put(EACObjectIdentifiers.id_TA_ECDSA_SHA_512, "SHA512WITHCVC-ECDSA");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA");
- // BEGIN android-removed
+ // BEGIN Android-removed: Unsupported algorithms
// oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA");
- // END android-removed
+ // END Android-removed: Unsupported algorithms
oids.put(new ASN1ObjectIdentifier("1.2.840.10040.4.3"), "SHA1WITHDSA");
oids.put(X9ObjectIdentifiers.ecdsa_with_SHA1, "SHA1WITHECDSA");
oids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224WITHECDSA");