by kyrra · 6y ago · 0 comments
For server-to-server, I continue to prefer PGP to provide my encryption. While Google Payments[0] supports PGP and JWE for encrypting payloads, PGP is well tested and most of the bugs have been worked out. JWS/JWE continues to have implementation bugs (likely due to being too flexible).
[0] https://developers.google.com/standard-payments/reference/be...
Better options for PGP use cases:
- AWS Encryption SDK: https://docs.aws.amazon.com/encryption-sdk/latest/developer-...
- age https://age-encryption.org
- Magic Wormhole https://github.com/warner/magic-wormhole
- NaCl/libsodium (and/or usability wrappers) https://libsodium.gitbook.io/doc/
Better options for JWE use cases:
- PASETO: https://paseto.io
- Branca: https://branca.io
Based on my brief reading of both, it seems like the main differences are:
* Branca has no signing mode, just authenticated encryption (eg. only "local" mode)
* Branca's payload is just arbitrary bytes, whereas PASETO has a defined payload format
* Seems like the same ciphers are used for Branca and PASETO v2/local.
Is that a fair assessment?
If you want ultra-simplicity and don't need clearsigned tokens (i.e. signed by a third party), you can get away with just using Branca. PASETO covers both use cases.
Branca notes checking the timestamp as optional - I couldn't tell what paseto does by default - other than a reference to a timestamp in the implentor's readme (and then only as an example parameter to the php code).
Paseto does helpfully state that there's no replay protection - so don't use it for stateless (serveless) session tokens.
But to both/either default to some kind of timeout?
I don't really see any use cases where I'd want infinite validity - so in addition to sane algorithms, sane/required exipery seems like it should be part of such things?
I think I might want a serial and a black-list too.. But maybe there are cases where invalidation aren't ever needed? I can't think of one right now.
It looks like Google's security team prefers the use of Tink[0] when having to encrypt things.
(googler opinions are my own)
Most of them.
You're either using gnupg or you're using some custom PGP implementation.
A custom PGP implementation has far more footguns than a restricted JWT implementation.
Gnupg is a deeply terrifying codebase- for example, did you know you're not supposed to use the exit code of gpg --verify? You must parse statusfd, too, or many bugs will let you spoof signatures. (Bugs found as recently as this year).
I'd encourage anybody considering using gnupg for anything to read mainproc.c and see if they understand what's going on.
These are real, exploitable, and many of the fixes probably won't be backported.