URGENT: Bug encountered INSIDE BC code

Arnold Morein <[email protected]> Mon, 18 Mar 2019 14:58:52 GMT
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <[email protected]>
I am attempting to retrofit an example from the BC PG cookbook to generate a new Private Key.

I am using the following library versions:

bc-fips-1.0.1.jar
bcmail-fips-1.0.1.jar
bcmail-jdk15on-1.61.jar
bcpg-fips-1.0.3.jar
bcpg-jdk15on-1.50.jar
bcpkix-fips-1.0.3.jar
bcpkix-jdk15on-1.61.jar
bcpqc-addon-fips-1.0.0.jar
bcprov-jdk15on-1.61.jar
bctls-fips-1.0.7.jar

I have tried both the BouncyCastleProvider and BouncyCastleFipsProviders.

I get the same error at the same place, from INSIDE the BC code:

Caused by: java.lang.NoSuchMethodError: org.bouncycastle.util.BigIntegers.createRandomPrime(IILjava/security/SecureRandom;)Ljava/math/BigInteger;
    at org.bouncycastle.crypto.generators.RSAKeyPairGenerator.chooseRandomPrime(Unknown Source)
    at org.bouncycastle.crypto.generators.RSAKeyPairGenerator.generateKeyPair(Unknown Source)

Mar 18, 2019 9:46:40 AM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
SEVERE: java.lang.NoSuchMethodError: org.bouncycastle.util.BigIntegers.createRandomPrime(IILjava/security/SecureRandom;)Ljava/math/BigInteger;
    at org.bouncycastle.crypto.generators.RSAKeyPairGenerator.chooseRandomPrime(Unknown Source)
    at org.bouncycastle.crypto.generators.RSAKeyPairGenerator.generateKeyPair(Unknown Source)

The javadoc of bcprov-jdk15on-1.61 shows the signature of createRandomPrime to be:

public static java.math.BigInteger createRandomPrime(int bitLength,
                                                     int certainty,
                                                     java.security.SecureRandom random)

                                                    
So how is it that RSAKeyPairGenerator is compiled with a method that doesn't exist?