boulder/wfe
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
..
test Use X.509 AIA Issuer URL in rel="up" link header (#2545) 2017-02-07 11:19:22 -08:00
jose.go Switch away from old style statsd metrics wrappers (#4606) 2019-12-18 11:08:25 -05:00
jose_test.go wfe/wfe2: make JWS signature alg error msgs match reality (#4519) 2019-10-31 09:55:11 -04:00
wfe.go Fix error types emitted by good_key.go (#4932) 2020-07-06 10:06:10 -07:00
wfe_test.go Update test/config. (#4923) 2020-07-01 17:59:14 -07:00