boulder/ca
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
..
config Update pkcs11key to v4 (#4602) 2019-12-09 10:03:33 -08:00
proto Upgrade to latest protoc and protoc-gen-go (#4794) 2020-04-23 18:54:44 -07:00
testdata CA: Test that the CT poison extension in CSRs is ignored. (#2915) 2017-07-28 10:51:46 -07:00
ca.go Revert "Remove StoreIssuerInfo flag in CA (#4850)" (#4868) 2020-06-12 12:50:24 -07:00
ca_test.go Fix error types emitted by good_key.go (#4932) 2020-07-06 10:06:10 -07:00