示例#1
0
        public void Write(ASN1BitString value)
        {
            WriteIdentifier(ASN1Class.Universal, false, ASN1UniversalTag.BitString);
            WriteLength(value.ByteLength);

            var array = value.Value;

            _writer.Write((byte)(array.Length % 8));
            for (var i = 0; i < array.Length; i += 8)
            {
                if (i + 8 >= array.Length)
                {
                    _writer.Write((byte)(array.GetByte(i) << (8 - (array.Length - i))));
                }
                else
                {
                    _writer.Write(array.GetByte(i));
                }
            }
        }
示例#2
0
        public void Write(ASN1BitString value)
        {
            WriteIdentifier(ASN1Class.Universal, false, ASN1UniversalTag.BitString);
            WriteLength(value.ByteLength);

            var array = value.Value;

            writer.Write((byte)(array.Length % 8));
            for (var i = 0; i < array.Length; i += 8)
            {
                if (i + 8 >= array.Length)
                {
                    writer.Write((byte)(array.GetByte(i) << (8 - (array.Length - i))));
                }
                else
                {
                    writer.Write(array.GetByte(i));
                }
            }
        }