public int PadCount(byte[] input) //throws InvalidCipherTextException { int count = input[input.Length - 1] & 0xff; if (count > input.Length) { throw new InvalidCipherTextException("pad block corrupted"); } return count; } }