boulder/goodkey
Aaron Gable 4a85abf25a
Fix error types emitted by good_key.go (#4932)
The `KeyPolicy.GoodKey` method is used to validate both public keys
used to sign JWK messages, and public keys contained inside CSR
messages.

According to RFC8555 section 6.7, validation failure in the former
case should result in `badPublicKey`, while validation failure in
the latter case should result in `badCSR`. In either case, a failure
due to reasons other than the key itself should result in
`serverInternal`.

However, the GoodKey method returns a variety of different errors
which are not all applicable depending on the context in which it is
called. In addition, the `csr.VerifyCSR` method passes these errors
through verbatim, resulting in ACME clients receiving confusing and
incorrect error message types.

This change causes the GoodKey method to always return either a
generic error or a KeyError. Calling methods should treat a `KeyError`
as either a `badPublicKey` or a `badCSR` depending on their context,
and may treat a generic error however they choose (though likely as a
serverInternal error).

Fixes #4930
2020-07-06 10:06:10 -07:00
..
blocked.go Block keys using hex(sha256(spki)). (#4745) 2020-04-09 09:41:33 -07:00
blocked_test.go Fix error types emitted by good_key.go (#4932) 2020-07-06 10:06:10 -07:00
good_key.go Fix error types emitted by good_key.go (#4932) 2020-07-06 10:06:10 -07:00
good_key_test.go Fix error types emitted by good_key.go (#4932) 2020-07-06 10:06:10 -07:00
weak.go Add tool to search for certificates containing debian weak keys (#3077) 2017-09-13 10:59:58 -07:00
weak_test.go Add tool to search for certificates containing debian weak keys (#3077) 2017-09-13 10:59:58 -07:00