GPGUtils
is a simple wrapper for ProcessBuilder
to make shell out to gpg
easier in Java.
It provides a simple interface for encrypting/decrypting String
, File
and InputStream
.
There's also generic method to run other gpg
command.
Existing solutions for using gpg
in Java have mostly involved BouncyCastle
. It works, but, its API isn't the nicest to use, to say the least.
Using ProcessBuilder
is much simpler compared with BouncyCastle
. But it's not easy to get IO buffering right for external processes.
GPGUtils
tries to provide a simple interface while hiding away the complexity of IO buffer handling.
Refer to the Unit Tests for now.
mvn verify
Need to set environment variables first:
GPG_KEYNAME
OSSRH_USERNAME
OSSRH_PASSWORD
mvn -s settings.xml -P ossrh clean deploy