public override void EncodeBitString(byte[] value, int numbits, bool explicitTagging, Asn1Tag tag) { if ((((numbits + 7) / 8) + 1) <= 0x3e8) { base.EncodeBitString(value, numbits, explicitTagging, tag); } else { if (explicitTagging) { EncodeTagAndIndefLen(Asn1BitString.Tag.Class, 0x20, Asn1BitString.Tag.IdCode); } else { OutputStream.WriteByte(0x80); } var num = (numbits + 7) / 8; var num2 = numbits % 8; if (num2 != 0) { num2 = 8 - num2; value[num - 1] = (byte)(value[num - 1] & ((byte)~((1 << num2) - 1))); } for (var i = 0; i < num; i += 0x3e8) { var len = num - i; if (len > 0x3e8) { len = 0x3e8; EncodeTagAndLength(Asn1BitString.Tag, len); } else { EncodeTagAndLength(Asn1BitString.Tag, len + 1); OutputStream.WriteByte((byte)num2); } if (len > 0) { OutputStream.Write(value, i, len); } } EncodeEoc(); } }