I want to subclass some BC classes, in my Java project, but I faced issue with import of CMSUtils class. In order to reproduce issue in a simple project, I created quick-start Maven project (Eclipse 2024-06 IDE). Here are some details:
in pom.xml:
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcutil-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
In .java file:
package cmstest;
import org.bouncycastle.cms.CMSTypedStream;
import org.bouncycastle.cms.CMSUtils;
public class App {
public static void main( String[] args ) {
System.out.println( "Hello World!" );
}
}
So, on CMSUtils import, IDE reports: “The type org.bouncycastle.cms.CMSUtils is not visible“. On the other hand, it does not complain on other import, which is here only to show that other class from same .jar is visible.
I looked at content of bcpkix-jdk18on-1.78.1.jar file, and can see both classes. Therefore, it is strange that import of CMSTils is not possible.
Any idea what’s wrong here?