This repository has been archived on 2026-11-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
unkin-agent a9c2b2e93b
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci / pre-commit (pull_request) Has been cancelled
ci / lint (pull_request) Has been cancelled
ci / test (pull_request) Has been cancelled
ci / build (pull_request) Has been cancelled
Add GitHub Actions CI and GoReleaser release
2026-11-19 21:55:16 +11:00
2026-11-17 23:12:37 +11:00
2026-07-15 21:25:41 +10:00
2026-07-15 21:25:41 +10:00
2026-07-15 21:25:41 +10:00
2026-11-17 23:12:37 +11:00
2026-07-15 21:25:41 +10:00
2026-07-15 21:25:41 +10:00
2026-07-15 21:25:41 +10:00
2026-11-17 23:12:37 +11:00
2026-11-17 23:12:37 +11:00
2026-11-17 23:12:37 +11:00
2026-07-15 21:25:41 +10:00

vault-plugin-secrets-gpg

A secrets engine for HashiCorp Vault and OpenBao that manages OpenPGP (GPG) keys and signs, verifies, encrypts and decrypts with them. Think of it as the transit engine, but the keys are OpenPGP keys.

Why use this plugin?

Private keys are generated and stored in Vault's barrier storage. They never leave Vault unless you mark a key exportable. The engine hands out a standard armored public key, so gpg, pass and other OpenPGP tools can encrypt to the key. Decryption goes back through Vault. Keys are versioned: when you rotate a key, older versions stay available, so old signatures still verify and old ciphertext still decrypts.

To manage the engine's mounts and keys from Terraform or OpenTofu, use terraform-provider-vault-secrets-gpg.

Requirements

  • HashiCorp Vault or OpenBao. The same binary works on both. The end-to-end tests run against Vault 1.18 and the latest OpenBao release.
  • Go 1.25+ (only if you build from source)

Installation

Install the x86_64 RPM (vault or openbao flavour) from the releases page, or build one:

make build   # -> dist/vault-plugin-secrets-gpg

Copy the binary into the server's plugin_directory, then register it in the plugin catalog and enable the engine. On OpenBao, run the same commands with bao in place of vault. The example assumes plugin_directory = "/etc/vault/plugins"; use the directory set in your server config.

SHA256=$(sha256sum /etc/vault/plugins/vault-plugin-secrets-gpg | cut -d' ' -f1)
vault plugin register -sha256="$SHA256" secret vault-plugin-secrets-gpg
vault secrets enable -path=gpg vault-plugin-secrets-gpg

Usage

The engine has no mount-level configuration. Each key holds its own settings (see keys).

All binary input and output is base64-encoded.

# create a key (repeating the write returns the existing key)
vault write gpg/keys/app algorithm=rsa-4096 identity="App <app@example.com>"
vault read gpg/keys/app

# sign / verify
sig=$(vault write -field=signature gpg/sign/app input=$(base64 <<<"ship it"))
vault write -field=valid gpg/verify/app input=$(base64 <<<"ship it") signature="$sig"

# encrypt / decrypt
ct=$(vault write -field=ciphertext gpg/encrypt/app plaintext=$(base64 <<<"secret"))
vault write -field=plaintext gpg/decrypt/app ciphertext="$ct" | base64 -d

# rotate; ciphertext from older versions still decrypts
vault write gpg/keys/app/rotate

With pass

pass needs only the public key to encrypt. Decryption goes through Vault.

vault read -field=public_key gpg/keys/app | gpg --import
pass init "$(vault read -field=fingerprint gpg/keys/app)"
pass insert email/example

vault write -field=plaintext gpg/decrypt/app \
  ciphertext=$(base64 -w0 ~/.password-store/email/example.gpg) | base64 -d

Documentation

Full path reference:

Development

make test   # unit tests, including gpg/pass interop when those binaries exist
make lint
make e2e    # full lifecycle against Vault and OpenBao in Docker

License

MIT

S
Description
HashiCorp Vault / OpenBao secrets engine for GPG/OpenPGP keys (sign/verify/encrypt/decrypt, transit-style versioned keys, pass-compatible)
Readme MIT 123 KiB
Languages
Go 87.7%
Shell 7.6%
Makefile 3.9%
HCL 0.8%