gnupg-for-java updated for GnuPG 2.x

Hans-Christoph Steiner hans at
Fri Mar 14 15:47:57 CET 2014

On 03/14/2014 01:27 AM, Robert J. Hansen wrote:
>> We have done a lot of work to it, including new features, many bug fixes, and
>> a port from GnuPG 1.4 to GnuPG 2.1.  I've finally split out our work from the
>> Android project into its own repository:
> Unfortunately, this does not build under Ubuntu 13.10 with the latest
> Oracle JDK.

I pushed a couple fixes, it should build now.  It does for me at least on
OpenJDK 1.6.

I've only used this code on Android so far, so there are probably a couple of
setup details that might need to be fixed for it to work on desktop platforms.
For example, I haven't used the included test suite before (we have written
tests in Android).  But
it would be good to have that test suite working.  That means fixing them for
the GnuPG batch mode changes and passphrase handling.  Also, it should be used
with gpgme 1.4.3 using GnuPG 2.x as the "engine".

With GnuPG 2.x, the old style of passphrase handling no longer works.  That's
why all the passphrase code was removed from gnupg-for-java.  With GnuPG 2.x,
gpg-agent will handle prompting the user for the passphrase, as well as
passphrase caching.

If you want to use GnuPG 1.4 with this, then you'll have to figure out how to
include that old code in a way that works with the GnuPG 2.x stuff.  I
recommend using GnuPG 2.x though. That means configuring gpgme to use `gpg2`
rather than `gpg`.  I think gpgme 1.4.3 defaults to gpg2.


PGP fingerprint: 5E61 C878 0F86 295C E17D  8677 9F0F E587 374B BE81

More information about the Gnupg-devel mailing list