JCE cannot authenticate the provider BC

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

JCE cannot authenticate the provider BC

Nidhi Aggarwal

  Hi,

 

I have downloaded the bouncycastle provider (bcprov-jdk15on-162.jar) latest builds from maven, bouncycastle website and added them to classpath and on execution I get the following stack trace. Can someone please help in resolving this. In earlier versions, we never faced any authentication issues.

 

 

    [junit] Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC

    [junit]       at javax.crypto.JceSecurity.getInstance(JceSecurity.java:101)

    [junit]       at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:249)

    [junit]       at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createKeyGenerator(Unknown Source)

    [junit]       ... 92 more

    [junit] Caused by: java.util.jar.JarException: file:bundles/bcprov_1.62.jar has unsigned entries - org/bouncycastle/LICENSE.class

    [junit]       at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:462)

    [junit]       at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:322)

    [junit]       at javax.crypto.JarVerifier.verify(JarVerifier.java:250)

    [junit]       at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:161)

    [junit]       at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:187)

    [junit]       at javax.crypto.JceSecurity.getInstance(JceSecurity.java:98)

    [junit]       at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:249)

    [junit]       at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createKeyGenerator(Unknown Source)

    [junit]       at org.bouncycastle.cms.jcajce.EnvelopedDataHelper.createKeyGenerator(Unknown Source)

    [junit]       at org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder$CMSOutputEncryptor.<ini

 

Regards,

Nidhi

Reply | Threaded
Open this post in threaded view
|

JCE cannot authenticate the provider BC

Nidhi Aggarwal

  Hi,

 

I have downloaded the bouncycastle provider (bcprov-jdk15on-162.jar) latest builds from maven, bouncycastle website and added them to classpath and on execution I get the following stack trace. Can someone please help in resolving this. In earlier versions, we never faced any authentication issues.

 

 

    [junit] Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC

    [junit]       at javax.crypto.JceSecurity.getInstance(JceSecurity.java:101)

    [junit]       at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:249)

    [junit]       at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createKeyGenerator(Unknown Source)

    [junit]       ... 92 more

    [junit] Caused by: java.util.jar.JarException: file:bundles/bcprov_1.62.jar has unsigned entries - org/bouncycastle/LICENSE.class

    [junit]       at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:462)

    [junit]       at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:322)

    [junit]       at javax.crypto.JarVerifier.verify(JarVerifier.java:250)

    [junit]       at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:161)

    [junit]       at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:187)

    [junit]       at javax.crypto.JceSecurity.getInstance(JceSecurity.java:98)

    [junit]       at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:249)

    [junit]       at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createKeyGenerator(Unknown Source)

    [junit]       at org.bouncycastle.cms.jcajce.EnvelopedDataHelper.createKeyGenerator(Unknown Source)

    [junit]       at org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder$CMSOutputEncryptor.<ini

 

Regards,

Nidhi

Reply | Threaded
Open this post in threaded view
|

Re: JCE cannot authenticate the provider BC

Lothar Kimmeringer-4
Hi,

Am 26.06.2019 um 08:33 schrieb Nidhi Aggarwal:

> I have downloaded the bouncycastle provider (bcprov-jdk15on-162.jar <https://www.bouncycastle.org/download/bcprov-jdk15on-162.jar>) latest builds from maven, bouncycastle website and added them to classpath and on execution I get the following stack trace. Can someone please help in resolving this. In earlier versions, we never faced any authentication issues.
[...]
>      [junit] Caused by: java.util.jar.JarException: file:bundles/bcprov_1.62.jar has unsigned entries - org/bouncycastle/LICENSE.class

Works Here[TM]

Make sure that you don't have any org.bouncycastle.LICENSE class in any other Jar that is
in your classpath as well. That's what I have each and every time I got this kind of
error-message. Sometimes it was the old jars still in the classpath or somebody created
a jar containing all bc-classses to have everything in one jar.

If you can't find the duplicate class immediately, use ClassLoader.getResource(...)
to find the occurrence of the LICENSE-class. When called Here[TM]:

         System.out.println(new BouncyCastleProvider().getVersion());
         System.out.println(getClass().getClassLoader().getResource("org/bouncycastle/LICENSE.class"));

1.62
jar:file:/D:/eclipse/eclipse-jee-2018/workspace/MyProject/lib/jars/base/bcprov.jar!/org/bouncycastle/LICENSE.class


Cheers, Lothar