Skip to Content
Oct 07, 2010 at 10:09 PM

PGP encryption using Bouncycastle



We have been attempted to use the bouncycastler pgp and jce provider jar files in AS Java stack.

There were no problems using the bouncycastle pgp library which is a client of the standard java security apis.

Attempting to use the bouncycastle jce provider apis directly in the ear file


-as source

-As a shared library


-as a bundled library

all resulted in exceptions of the following form

java.lang.IllegalStateException: Usage of an unregistered loader. This loader has been unregistered and is not supposed to be used anymore. All the references to it had to be removed before unregistering

Loader name -

Loader hash code - 529bfb12


at java.lang.ClassLoader.loadClassInternal(

at org.bouncycastle.jce.provider.JDKDigestSignature.engineInitSign(Unknown Source)
 (These are the bouncycastle jce provider apis)


 (These are the java security apis)

at org.bouncycastle.openpgp.PGPSignatureGenerator.initSign(
 (These are the bouncycastle PGP library)

at org.bouncycastle.openpgp.PGPSignatureGenerator.initSign(

at nz.govt.aucklandcouncil.pgp.ClearSignStreamProcessor.signContent(

at nz.govt.aucklandcouncil.pgp.ClearSignStreamProcessor.signContent(

at ac.key.KeyAccessBean.sign(

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(

at sun.reflect.DelegatingMethodAccessorImpl.invoke(

Thre is a description here of the classloading mechanism in SAP with a specific reference to this exception.

We have been able to use the bouncycastle jce provider jar by including it on the bootclasspath of the jvm.

However this solution is problematic as it is impacts the whole jvm rather than being isolated to a single application/library/service.

The question we want answered ideally is what steps are required to use a third party jce provider in AS Java stack.???

If there is no mechanism other than the bootclasspath approach we have determined does work, is this solution supported by SAP.???