.NET requires that the size of each RSA parameter be the exact size (the size of a response key pair).
Therefore, sometimes you need to delete the leading 0x00 byte (for example, if the data comes from ASN.1, which requires a positive number 0).
But in other cases, you need to add an extra 0x00 bytes, because bytes are a (huge) number that can correspond to fewer bytes (1 in reality). This happens when analyzing data from PEM encoded files (base64), where the leading 0 is usually deleted.
Final answer: make sure you are given the expected length (gasket or gasket removal).
source share