Environment
Bouncy Castle version: 1.85
Modules: bcprov-jdk15to18 and bcutil-jdk15to18
Build tool: Android Gradle (AGP 8.x, but also reproducible with pure Gradle)
Problem
When both bcprov-jdk15to18 and bcutil-jdk15to18 (or bcpkix-jdk15to18, which transitively pulls in both) are present on the classpath, the Android build fails with:
Duplicate class org.bouncycastle.asn1.iana.IANAObjectIdentifiers found in modules
bcprov-jdk15to18-1.85.jar and bcutil-jdk15to18-1.85.jar
The class org.bouncycastle.asn1.iana.IANAObjectIdentifiers is present in both artifacts, which should not happen. This prevents using standard bcprov together with any module that depends on bcutil (like bcpkix).
Steps to reproduce
Create an Android project with the following dependencies:
implementation 'org.bouncycastle:bcprov-jdk15to18:1.85'
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.85' // brings bcutil
Build the project (e.g., ./gradlew assembleDebug).
See the duplicate class error.
Expected behavior
No duplicate classes between bcprov-jdk15to18 and bcutil-jdk15to18. Users should be able to combine bcprov and bcpkix without class conflicts.
Actual behavior
IANAObjectIdentifiers (and possibly other ASN.1 OID classes) are duplicated in both JARs, causing build failures.
Workaround
Upgrade to a newer version (≥1.86) where the duplication has been resolved.
Additional notes
This issue is likely due to a packaging mistake in the 1.85 release artifacts.
Similar problems have been observed by multiple users (e.g., Android developers combining BC modules).
Would be great to either backport a fix to a 1.85.x patch or ensure future releases avoid such overlaps.
Environment
Bouncy Castle version: 1.85
Modules: bcprov-jdk15to18 and bcutil-jdk15to18
Build tool: Android Gradle (AGP 8.x, but also reproducible with pure Gradle)
Problem
When both bcprov-jdk15to18 and bcutil-jdk15to18 (or bcpkix-jdk15to18, which transitively pulls in both) are present on the classpath, the Android build fails with:
Steps to reproduce
Create an Android project with the following dependencies:
Build the project (e.g., ./gradlew assembleDebug).
See the duplicate class error.
Expected behavior
No duplicate classes between bcprov-jdk15to18 and bcutil-jdk15to18. Users should be able to combine bcprov and bcpkix without class conflicts.
Actual behavior
IANAObjectIdentifiers (and possibly other ASN.1 OID classes) are duplicated in both JARs, causing build failures.
Workaround
Upgrade to a newer version (≥1.86) where the duplication has been resolved.
Additional notes
This issue is likely due to a packaging mistake in the 1.85 release artifacts.
Similar problems have been observed by multiple users (e.g., Android developers combining BC modules).
Would be great to either backport a fix to a 1.85.x patch or ensure future releases avoid such overlaps.