-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
The key returned by openpgp.NewEntity (https://godoc.org/golang.org/x/crypto/openpgp#NewEntity) does not express hash algorithm preferences, and by default openpgp.Encrypt (and perhaps others) default to using the RIPEMD160 algorithm (https://github.com/golang/crypto/blob/173ce04bfaf66c7bb0fa9d5c0bfd93e773909dbd/openpgp/write.go#L205), which is not compiled in unless one explicitly requests it. This means that the "obvious" way to generate keys and encrypt to them fails with the largely-inscrutible error message openpgp: invalid argument: cannot encrypt because no candidate hash functions are compiled in. (Wanted RIPEMD160 in this case.)
There are more than a few ways around this (populating PreferredHash being one obvious option, and defaulting to e.g., SHA-256 being another), but this seems like an awfully sharp edge to leave lying around.