Is there a good GnuPG encryption library for Java/Scala? [closed]

I would like to be able to encrypt files on disk and/or data in memory using GnuPG from a Java application. If possible I’d like to avoid having to make system calls out to the GPG command line tools.

Is there a recommended library, or can you recommend the best approach to GPG encrypting from Java (or Scala)?

I’m developing and intend to run the application in a Linux environment, although a cross-platform solution would be preferred.

Answer

You can try to call the JAVA API of BouncyCastle.org.

Its documentation mentions:

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms.

You have here an example of openpgp ByteArrayHandler.

There might be some incompatibility between BouncyCastle encryption and GnuGP encryption though, since BouncyCastle does not use GnuPG, but rather implements OpenPGP (RFC2440) in Java.

Leave a Reply

Your email address will not be published. Required fields are marked *