x/crypto/openpgp: ReadEntity does not initialize preferred hash and cipher functions for Entity's Identities' Signatures #42310
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/XFv3i4jyLco
What did you expect to see?
Encrypt function to try the passed in config first OR the Entity created by ReadEntity to contain its preferred hash and cipher functions.
What did you see instead?
Encrypt function uses its default hash and cipher functions regardless of passed in config or entity.
Possible Solutions
In order from most probable/possible to least probable/possible solution:
[1] Change ReadEntity so that it initializes preferred hash and cipher functions for its Identities' Signatures since that data isn't serialized (openpgp/keys.go:417)
[1.5] Change Signature.parse so that it can infer hash and cipher prefferences (openpgp/packet/signature.go:108)
[2] Change Encrypt so it checks what the actual hash and cipher functions of the passed in entity are rather than just guessing (openpgp/write.go:295)
[3] Change Signature.Serialize so that it includes hash and cipher preferences (openpgp/packet/signature.go:599)
Edit: Added solution 1.5
The text was updated successfully, but these errors were encountered: