How do you configure this to not use BouncyCastle?
Describe the bug
This isn't really a bug, just a request for an example.
Expected behavior
I am interested in using this library in the absence of bouncy castle. The README states it can be configured to be used with JCE or BouncyCastle, but I can't seem to find any documentation on this, and perusing the source of both sop and core, bouncy castle seems to be pretty embedded.
Additional context
Thanks in advance!
Hey! Bouncycastles bcpg provides two different implementations of the OpenPGP protocol, one based on BCs lightweight crypto implementation and one relying on JCE instead.
Currently, BCs lightweight OpenPGP implementation is the default in PGPainless. However, you can at runtime swap the use of these classes out for their JCA/JCE counterparts by calling:
ImplementationFactory.setFactoryImplementation(new JceImplementationFactory());
This will result in JCE classes to be used instead. Note though, that this does not mean that you can use PGPainless without having Bouncycastle in your classpath, as BC is providing the classes which use JCE in the first place. PGPainless still depends on bcpg (BCs OpenPGP implementation).
It is also possible to replace BouncyCastleProvider (from bcprov) with a different SecurityProvider by calling
ProviderFactory.factory = new MySecurityProviderFactory(); // extends ProviderFactory
but I still haven't found a suitable alternative SecurityProvider that provides all the necessary algorithms and ciphers needed for OpenPGP.
Hope that helps you :)
Bouncy Castle seems to be the only game in town for PGP in Java, and while it's great it exists, it's just nice to know if alternatives exist, thank you for the thorough answer!