PGP missing references

Enonic version: 7.6

I’m trying to use the bouncycastle lib but I keep getting this error:

java.lang.NoSuchMethodError: ‘org.bouncycastle.util.StringList org.bouncycastle.util.Strings.newList()’
at org.bouncycastle.bcpg.ArmoredInputStream.(ArmoredInputStream.java:132)
at org.bouncycastle.bcpg.ArmoredInputStream.(ArmoredInputStream.java:146)
at org.bouncycastle.openpgp.PGPUtil.getDecoderStream(PGPUtil.java:391)

I’m referencing it was I’ve found in another topic:

include ‘org.bouncycastle:bcpg-fips:1.0.3’
compile “org.bouncycastle:bcprov-jdk15on:1.67”
include(“org.bouncycastle:bcpg-jdk15on:1.67”) {
exclude group: “org.bouncycastle”, module: “bcprov-jdk15on”
}

Any ideas?

Why do you exclude the group “org.bouncycastle”, module “bdprov-jdk15on” ?

Just followed from here: PGP encryption in Enonic - #2 by bhj
I’ve tried to change it but so far getting the same error.

The xp runtime is now using 1.68 is seems: org.bouncycastle:bcprov-jdk15on:1.68
Maybe upgrade your dependency to that version will help?

1 Like

I tried to reproduce your error but without success.
I put the following line: new ArmoredInputStream( null, false ); (That should be enough to reproduce your error I think) in an app but it executed without problem on Enonic XP 7.6

I first thought that maybe it is linked to the fact that you have both “fips” and “jdk15on”. Because they are not supposed to be used together. Do you have a requirement to use fips?

But even with the dependencies you copied, it still run without problem. Any chance the code of your application is public? Or do you have a minimal way to reproduce your issue?

1 Like

After running through other third-party libs I’ve found out that one of them had an old version of bouncycastle in it and after excluding it from there everything started to work as intended.

Sorry for the trouble and thanks for the help.

2 Likes