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.
Files
vault-plugin-secrets-gpg/docs/encrypt-decrypt.md
T
unkin-agent 53227f9126 Prepare for public release (#5)
The engine is being published as github.com/IUCLabs/vault-plugin-secrets-gpg, so the module path, docs and examples must stand alone without private infrastructure references.

- move the Go module to github.com/IUCLabs/vault-plugin-secrets-gpg
- replace private identities in examples and tests with example.com
- add MIT LICENSE
- rewrite README: overview, install for Vault and OpenBao, usage, link to terraform-provider-vault-secrets-gpg
- add per-path reference docs under docs/
- correct min_decryption_version description (decryption only)

Reviewed-on: #5
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-17 23:12:37 +11:00

44 lines
1.3 KiB
Markdown

# Encrypt and decrypt
Messages are standard OpenPGP messages. Anything encrypted to the key's public
key, whether by this engine, `gpg` or `pass`, can be decrypted here.
## Encrypt
`POST /gpg/encrypt/:name`
Encrypts to the latest key version.
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `plaintext` | string | required | Base64-encoded plaintext. |
| `format` | string | `base64` | `base64` (base64-encoded binary OpenPGP), or `ascii-armor`. |
The response has `ciphertext` and `key_version`.
```sh
vault write -field=ciphertext gpg/encrypt/app plaintext=$(base64 <<<"secret")
vault write -field=ciphertext gpg/encrypt/app plaintext=$(base64 <<<"secret") format=ascii-armor
```
## Decrypt
`POST /gpg/decrypt/:name`
Tries every key version at or above `min_decryption_version`. The engine
detects whether the input is armored or binary.
| Parameter | Type | Description |
|-----------|------|-------------|
| `ciphertext` | string | ASCII-armored message, or base64-encoded binary (the format `gpg`/`pass` write by default). |
The response has `plaintext` (base64).
```sh
vault write -field=plaintext gpg/decrypt/app ciphertext="$ct" | base64 -d
# decrypt a file written by gpg or pass
vault write -field=plaintext gpg/decrypt/app \
ciphertext=$(base64 -w0 ~/.password-store/email/example.gpg) | base64 -d
```