From the perspective of the consumer of this API it tells you the message is too long in both cases, it just uses slightly different language (but still `ValueError`).

It is possible to calculate the maximum length without asking OpenSSL at all. For PKCS1v15 that is `modulus_size - 11`, for OAEP it is `modulus_size - 2 - 2*hash_length` (and OpenSSL only supports SHA1 so `hash_length` is 20 thus collapsing the whole thing to `modulus_size - 42`. There's a little uncertainty around the non-full-byte moduli but it wouldn't be too hard to test those scenarios.

If we make this change then getting coverage on the public key error case will also be difficult since I am not sure how to trigger another error.