https://github.com/lyang/gpg-utils
Simple Wrapper for shelling out to gpg
https://github.com/lyang/gpg-utils
cryptography gnupg gpg java processbuilder
Last synced: 12 days ago
JSON representation
Simple Wrapper for shelling out to gpg
- Host: GitHub
- URL: https://github.com/lyang/gpg-utils
- Owner: lyang
- License: mit
- Created: 2020-05-24T20:43:30.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2026-01-25T08:10:43.000Z (19 days ago)
- Last Synced: 2026-01-26T19:30:18.922Z (18 days ago)
- Topics: cryptography, gnupg, gpg, java, processbuilder
- Language: Java
- Homepage:
- Size: 165 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gpg-utils
[](https://github.com/lyang/gpg-utils/actions/workflows/build.yml)
[](https://sonarcloud.io/summary/new_code?id=io.github.lyang%3Agpg-utils)
[](https://codecov.io/gh/lyang/gpg-utils)
[](https://search.maven.org/search?q=g:%22io.github.lyang%22%20AND%20a:%22gpg-utils%22)
[](https://javadoc.io/doc/io.github.lyang/gpg-utils)
`GPGUtils` is a simple wrapper for `ProcessBuilder` to make shell out to `gpg` easier in Java.
## What
It provides a simple interface for encrypting/decrypting `String`, `File` and `InputStream`.
There's also generic method to run other `gpg` command.
## Why
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.
## How to use
Refer to the [Unit Tests](src/test/java/io/github/lyang/gpgutils/GPGUtilsTest.java) for now.
## Running Tests
```bash
mvn verify
```
## Deploy
Need to set environment variables first:
* `GPG_KEYNAME`
* `OSSRH_USERNAME`
* `OSSRH_PASSWORD`
```bash
mvn -s settings.xml -P ossrh clean deploy
```