Skip to content
This repository has been archived by the owner. It is now read-only.
Using GnuPG from Java. This is a JNI binding to the gpgme lib.
Java C Shell
Branch: master
Clone or download
#1 Compare This branch is 90 commits ahead of smartrevolution:master.
daniele-athome and eighthave Remove debugging log
Signed-off-by: Daniele Ricci <>
Latest commit f5b4d5b Jan 23, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples add run script to examples/ Mar 21, 2014
src/com/freiheit/gnupg Implement GnuPGKey.getTimestamp Jan 27, 2015
.classpath include JUnit from Eclipse and set the location of the native libs Mar 25, 2014
.gitignore Simple Maven script Jan 27, 2015
.project add Eclipse project to make it easier to get started Mar 14, 2014
COPYING clean up build system to use variables and run the test suite Mar 25, 2014
TODO initial rev Apr 15, 2010 update build version to 0.2-pre Mar 17, 2014
pom.xml Simple Maven script Jan 27, 2015

GnuPG for Java

GnuPG for Java is a Java wrapper for the gpgme (GnuPG Made Easy) library for working with the GnuPG encryption suite. It is a native binding to the gpgme using JNI. It requires gpgme 1.4.3 or newer, and expects to work with GnuPG 2.x as the "engine" in gpgme. With GnuPG 2.x, gpg-agent will handle prompting the user for the passphrase, as well as passphrase caching.

gpgpme is the standard library for developing third-party apps on top of GnuPG.

Stefan Richter originally wrote it for 32-Bit Intel GNU/Linux platforms. Some of his colleagues added 64-Bit Intel GNU/Linux support. It should build and run on other UNIX platforms too, but that has not been tested. The Guardian Project then ported it to GnuPG 2.x and Android as the basis of Gnu Privacy Guard for Android, and added lots of features and fixed lots of bugs in the process.

It should be easy to add Windows support by compiling a DLL, adding this to the jar and extend the loading mechanism to load a DLL on a Windows platform instead of loading a .so lib.

Setup for Building

You will need a JUnit jar to run the tests. If your system does not provide one already, you can download the jar and put it into the build/ directory of this project.


sudo apt-get install default-jdk make ant build-essential \
    libgpgme11-dev libgpg-error-dev


Mac OS X

You need to install GnuPG2 from one of a couple sources. You can get it from Homebrew, MacPorts, or Fink. Or you can install "GPGTools": and then build gpgme from source.


To build the gnupg-for-java.jar and in build/, run this:

ant clean release

You can run the test suite using ant also:

ant test

If you want the optional javadoc in build/docs/, run:

ant javadoc

Hacking Notes

Please conform to our code format standard. For C files use ./ For Java files, use Eclipse with the Android mode from the Android project. The default Eclipse formatting is usually close enough.

You can’t perform that action at this time.