URGENT: Bug encountered INSIDE BC code

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

URGENT: Bug encountered INSIDE BC code

Arnold Morein
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?
                                                    
Reply | Threaded
Open this post in threaded view
|

Re: URGENT: Bug encountered INSIDE BC code

David Hook-3

If you check the packages in the different jars you will see that you're
combining multiple versions of the same packages. That will not work.

Please start by settling on a single version of BC and then work from there.

Regards,

David

On 19/3/19 1:58 am, Arnold Morein wrote:

> 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?
>