Looking at https://crypto.stackexchange.com/a/30616/16548 and all the ways I generate RSA keys (code, SSL) the MSB is always 1 and so when DER encoded has 0x00
prefix.
I think it is always so when the RSA key length is a power of two (e.g. 2048 or 4096).
But the question I'm wondering now before going to bed: is it so?
Quoting from the link
We typically select RSA modulus sizes which are powers of two or small multiples thereof (1024, 1536, 2048, 3072, etc), and so this typically happens there.
since I now I'm wondering how to prove or somehow this really is so.
It looks to me the modulus length is set like that and the MSB is set due to modulus construction and these being unsigned integer. So 0x00 will always be there and there is no need to check if MSB is set.
So the answer to the question is in short: yes
or no
. I am also thinking of a convincing argument that I cannot at the moment produce but if someone has at hand would of course be very interesting.