GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing gitlab.com — gitlab.com # encryption
Recover OpenPGP session keys, and assemble OpenPGP certificates, when the
private keys live somewhere this process cannot reach — a KMS, an HSM, a
smartcard.
## Two packages
```
gitlab.com/phpboyscout/go/encryption decryption
gitlab.com/phpboyscout/go/encryption/certificate assembly and reading
```
A consumer that only opens messages imports the first and sees exactly that
vocabulary — `SessionKey`, `ParsePacket`, `ParsePKESK`, `KDFParams`. Certificate
work is a separate import, because most callers never do it.
**Both are standard-library only**, and a test asserts it for each of them
rather than trusting anyone to remember.
Three modules:
- **`go/encryption`** — the format work. The RFC 6637 key derivation, the RFC
3394 key unwrap, packet framing, certificate assembly and fingerprints.
**Standard library only.**
- **`go/encryption-aws-kms`** — the AWS KMS provider. Two operations,
`DeriveSharedSecret` and `Sign`, and nothing else.
- **`sigillum`** — the command-line tool: message framing, body decryption and
the `decrypt` and `certificate` commands.
## Should you be here at all?
There is a maintained Go OpenPGP library — [go-crypto][gc] — and for most jobs
it is the right answer. This package exists for one case: **the private key is
somewhere your process cannot read it**.
If you can load the key from a file, use go-crypto. If it lives in a KMS, an
HSM or a smartcard, go-crypto currently has no seam for ECDH decryption, and
that is the gap this fills.
The full argument, including the part of it that turned out to be wrong, is in
[why this exists when go-crypto already does OpenPGP][why]. The short decision
table is in [when to use this][when].
[gc]: https://github.com/ProtonMail/go-crypto
[why]: explanation/concepts/why-not-go-crypto.md
[when]: explanation/concepts/when-to-use-this.md
## Why they are separate
Only two operations in this whole path need a private key. Everything else is
arithmetic over public data.
Keeping the arithmetic in a module with no cloud SDK means it can be tested
against fixed vectors with no credentials, and a consumer who only wants to read
a message does not inherit an AWS dependency to do it.
## Where to start
- **[Tutorials](tutorials/index.md)** — decrypt your first message, start to
finish.
- **[How-to guides](how-to/index.md)** — decrypt with KMS, assemble a
certificate, plug in your own key service.
- **[Explanation](explanation/index.md)** — why this exists at all, why ECDH
rather than RSA, and why assembly and decryption cannot be separated.
- **[Reference](reference/index.md)** — the IAM actions the AWS KMS provider
needs, and the environment the integration tests read.
- **Go API** — lives on
[pkg.go.dev](https://pkg.go.dev/gitlab.com/phpboyscout/go/encryption), which is
generated from the source and cannot drift from it.
## What this is not
It does **not** decrypt message bodies. It recovers the session key and stops;
opening the encrypted-data packet with that key is a full OpenPGP concern, and a
mature implementation already does it well. `sigillum` wires the two
together if you want a working command.
It does **not** implement X25519 or X448 (public-key algorithms 25 and 26).
Those use a different derivation, and this package is for algorithm 18 over the
NIST curves a KMS can hold.
## Further reading
The blog carries a curated route through this subject: **[Signing your releases](https://phpboyscout.uk/topics/signing/)** collects
everything written about it, ordered so you can start at the beginning rather
than newest-first.
!!! tip "Ask phpbotscout"
{ width="84" align=left style="border-radius:10px;margin-right:1rem" }
He answers questions about the projects over on the Discord, citing the docs
where they already cover it, and offering to raise an issue where they don't.
Bring a bug, an idea, or a questionable engineering decision.
[Join the Discord](https://discord.gg/mQzGbmGyzZ){ .md-button .md-button--primary }
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |