Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using bouncycastle in refapp

Pepe
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2015

I've used bouncycastle in confluence with scope=provided. I believe that something like this is what I want since bouncycastle is provided by each app (and seemingly by refapp) but I'm not sure of how to declare the dep. Any advice?

 

<dependency>
    <groupId>bouncycastle</groupId>
    <artifactId>bcprov-jdk15</artifactId>
    <version>140</version>
    <scope>provided</scope>
</dependency>

I'm trying to reuse some of this code across apps using a refapp add-on but cannot get the magic all lined up. If I use scope=provided then I get the following error (suggesting that BC is not found)

[INFO] [talledLocalContainer] - Cannot init MyAddon: java.lang.NullPointerException

[INFO] [talledLocalContainer] java.lang.NullPointerException

[INFO] [talledLocalContainer] 	at org.bouncycastle.jce.provider.JCEBlockCipher.engineGetKeySize(Unknown Source)

if I don't use the scope parameter then I get this trust issue

[INFO] [talledLocalContainer] 15 [Spring executor 12] ERROR com.example.plugins.crypt.MyAddon - Cannot init MyAddon: java.lang.SecurityException: JCE cannot authenticate the provider BC

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
m@
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 18, 2015

It could be that you have a dependency on something else that is ending up being bundled that should be provided.  This can end up causing problems when classes are linked but not visible to the caller.

Check the maven dependency tree (mvn dependency:tree) and see if there are any other possibly provided dependencies.

On another note: why do you need to use the bouncy castle API directly?

TAGS
AUG Leaders

Atlassian Community Events