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 873069c6bd
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
Add MIT license, rewrite README and add path reference docs
2026-11-16 23:12:28 +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
```