Reputation: 1397
I can see bcprov-jdk15 as well as bcprov-jdk16 on my project path. Can there be a scenario where we need both ?
Upvotes: 4
Views: 11250
Reputation: 94058
The 15 and 16 point to JRE 1.5 and 1.6 for compatibility. Your version is 1.46 at most because that's the latest version where the JDK 1.5 and 1.6 were targeted separately. The 1.46 version was created on February 2011. The current version is 1.60, July 2018.
So you do not need nor should want either of those jars. You probably want the latest, otherwise you may be behind with regard to security fixes. Note that you should do some testing to see if the latest version runs with your code and change your code if it doesn't. Generally Bouncy Castle libs are backwards compatible, but some components such as its own ASN.1 API have gone through some serious changes.
So you'd better use this one from the Maven repository or download the latest from the Bouncy Castle site itself. You should use the one with 15on, which is for all versions of Java equal or greater than 1.5 (on = onwards).
Storing these jars without their version number is of course ludicrous. If you need to rename .jar files just to make your code run then there are some issues that you need to address.
Upvotes: 9
Reputation: 722
The java version is relevant to Bouncy Castle. What you have are jars for Java 1.5 and Java 1.6
You should have only 1 in your classpath and use the Bouncy Castle jar closest to your Java runtime environment version. When you have more than one, you dont know which version of the code is being run. Class loading orders are not guaranteed and typically differs across environments, java versions, etc.
You are more likely to have bugs that are difficult to reproduce when you have two versions of the same jar.
Upvotes: 1
Reputation: 44970
What is important is the last 3 digits in the version e.g. 149
in bcprov-jdk15on-149.jar
. This is the actual version of Bouncy Castle. Pick whichever is the newer one.
You should analyze your classpath dependencies (e.g. mvn dependency:tree
) to understand which versions are you actually using. In principle the newer version should be backward compatible but this is not guranteed and there could be bugs.
Upvotes: 0