Re: Re: Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jcajce/util/JcaJceHelper

Russell Haley <[email protected]>
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <CABx9NuRPyNPRkG31RzOAyEuZWjXuYrw8K4835XHXWZU3NiJtog@mail.gmail.com>
On Thu, Jun 14, 2018 at 4:53 AM, David Hook <dgh-rTAZ0PM/[email protected]> wrote:

>
> Sounds like the provider is not set up.
>
> Links for instructions on installation of the provider, as well as other
> documentation, are available at:
>
> https://www.bouncycastle.org/documentation.html
>
> Regards,
>
> David
>
Thanks, I had missed Security.addProvider line in the main() function in
the example:

Russ



>
> On 14/06/18 10:40, Russell Haley wrote:
>
>
>
> On Wed, Jun 13, 2018 at 4:53 PM, Russell Haley <[email protected]>
> wrote:
>
>> Hi,
>>
>> I'm relatively new to Java so I'm unsure if this is a mistake on my part
>> or not. I have been using the example code to build out a utility that
>> signs files and puts the signature in a ZipEntry comment for validation. At
>> this point I'm just trying to generate a keypair and I'm getting the
>> following error:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/bouncycastle/jcajce/util/JcaJceHelper
>> at com.telarraydiagnostics.ova.alpha.scripts.BatchScriptManager
>> .exportKeyPair(BatchScriptManager.java:228)
>> at com.telarraydiagnostics.ova.alpha.scripts.BatchScriptManager
>> .doOpts(BatchScriptManager.java:167)
>> at com.telarraydiagnostics.ova.alpha.scripts.BatchScriptManager
>> .main(BatchScriptManager.java:131)
>> Caused by: java.lang.ClassNotFoundException:
>> org.bouncycastle.jcajce.util.JcaJceHelper
>> at java.net.URLClassLoader.findClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> ... 3 more
>>
>>
>> My function is a copy/paste of the RSAKeyPairGenerator.exportKeyPair
>> function. The troubled code is in RSAKeyPairGenerator.java on line 53. I
>> downloaded the sources for bcpg-jdk15on-159.jar and there doesn't seem to
>> be any jcajce or util folder and no sign of a JcaJceHelper class at all?
>>
>> Any input would be great.
>>
> Okay, more digging shows that the jcajce stuff is in the bcprov jar file.
> I have since added bcprov-jdk15on-159.jar and bcprov-ext-jdk15on-159.jar to
> my classpath. However, I am getting an error "cannot create cipher: No such
> provider: BC" from the following code:
>
>              PGPSecretKey        secretKey = new PGPSecretKey(PGPSignature.DEFAULT_CERTIFICATION,
> keyPair, identity, sha1Digest, null, null,
>             new JcaPGPContentSignerBuilder(keyPair.getPublicKey().getAlgorithm(),
> HashAlgorithmTags.SHA1),
>             new JcePBESecretKeyEncryptorBuilder(PGPEncryptedData.CAST5,
> sha1Digest).setProvider("BC").build(pas
>
> I'll have another look at this in the morning, but any help would still be
> grand.
>
> Thanks again,
> Russ
>
>>
>> Thanks for the wonderful library. I look forward to putting it to great
>> use.
>>
>> Russ
>>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.