ProtonMail / go-crypto

Fork of go/x/crypto, providing an up-to-date OpenPGP implementation
https://pkg.go.dev/github.com/ProtonMail/go-crypto
BSD 3-Clause "New" or "Revised" License
330 stars 100 forks source link

Use defaults in encryption preferences if intersection is empty #137

Closed wussler closed 1 year ago

wussler commented 1 year ago

Use algorithms labelled as MUST in the specification if the intersection of Symmetric ciphers, Hash algos, or AEAD modes is empty instead of throwing cannot encrypt because recipient set shares no common algorithms.

This also fixes a bug, when trying to encrypt to multiple recipients, and one supports only non-EAX modes.

twiss commented 1 year ago

In general this looks good, apart from the nit above. There's probably other things we should do here, such as using the configured AEAD algorithm if it's supported by everyone, similarly to what's done for the cipher, but we can add that later.