Note: this assumes that the last block of plain text is always passed to it inside in. i.e. if inOff is zero, indicating the entire block is to be overwritten with padding the value of in should be the same as the last block of plain text. The reason for this is that some modes such as "trailing bit compliment" base the padding on the last byte of plain text.
org.bouncycastle.crypto.InvalidCipherTextExceptionif the padding is badly formed or invalid.