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
328 stars 99 forks source link

Ensure crypto refresh cleartext messages are parseable #170

Closed lubux closed 1 year ago

lubux commented 1 year ago

The crypto refresh introduces a new SaltedHash header in signed cleartext messages, which prevents a new message from being parsed by the library. This pull request updates the parsing function to accept the new header and ensures that a cleartext message containing multiple signatures with different versions can be verified.

For example, the following cleartext message with a v4 and a v6 signature can now be successfully verified with a v4 key.

-----BEGIN PGP SIGNED MESSAGE-----
SaltedHash: SHA512:MOvqfCOPw2ONdPPtEzWRHPrtHV7jge6f7/iBUI7FqQQ
Hash: SHA512

....

-----BEGIN PGP SIGNATURE-----
...
-----END PGP SIGNATURE-----
lubux commented 1 year ago

This pull request becomes obsolete with mr:313, which removes the salted hash header from the crypto refresh and makes the hash header optional.