Exemplo n.º 1
0
        public virtual void StartElement(Asn1Tag tag, int len, byte[] tagLenBytes)
        {
            PrintOffset();

            new StringBuilder(40);             // WTF?

            var index = 0;

            while (index < tagLenBytes.Length)
            {
                _printStream.Write(Asn1Util.ToHexString(tagLenBytes[index]));
                _printStream.Write(' ');
                index++;
            }

            while (index < MaxBytesPerLine)
            {
                _printStream.Write("   ");
                index++;
            }

            _printStream.Write(": ");
            _printStream.Write(tag.Constructed ? "C " : "P ");
            _printStream.Write(tag + " ");
            _printStream.WriteLine(Convert.ToString(len));
            _offset += tagLenBytes.Length;
        }
Exemplo n.º 2
0
        public virtual string ToHexString()
        {
            var str = new StringBuilder("").ToString();

            foreach (var b in Value)
            {
                str = str + Asn1Util.ToHexString(b);
            }

            return(str);
        }
Exemplo n.º 3
0
        public override string ToString()
        {
            var num  = ByteIndex + 1;
            var num2 = Data.Length - num;
            var str  = new StringBuilder("").ToString();

            for (var i = 0; i < num2; ++i)
            {
                str = str + Asn1Util.ToHexString(Data[i + num]);
            }

            return(str);
        }
Exemplo n.º 4
0
        public override string ToString()
        {
            var str = new StringBuilder("").ToString();

            if (Value != null)
            {
                foreach (var b in Value)
                {
                    str = str + Asn1Util.ToHexString(b);
                }
            }

            return(str);
        }
Exemplo n.º 5
0
        public virtual void Contents(byte[] data)
        {
            if (data.Length != 0)
            {
                PrintOffset();

                var flag     = true;
                var builder  = new StringBuilder(100);
                var builder2 = new StringBuilder(100);

                for (var i = 0; i < data.Length; ++i)
                {
                    builder.Append(Asn1Util.ToHexString(data[i]));
                    builder.Append(' ');

                    int num2 = data[i];

                    if ((num2 >= 0x20) && (num2 <= 0x7f))
                    {
                        builder2.Append((char)num2);
                    }
                    else
                    {
                        builder2.Append('.');
                    }

                    if (((i + 1) % MaxBytesPerLine) == 0)
                    {
                        if (!flag)
                        {
                            _printStream.Write("     : ");
                        }
                        else
                        {
                            flag = false;
                        }

                        _printStream.WriteLine(builder + ": " + builder2);

                        builder.Length  = 0;
                        builder2.Length = 0;
                    }
                }

                if (builder.Length > 0)
                {
                    while (builder.Length < 0x24)
                    {
                        builder.Append(' ');
                    }

                    if (!flag)
                    {
                        _printStream.Write("     : ");
                    }

                    _printStream.WriteLine(builder + ": " + builder2);
                }

                _offset += data.Length;
            }
        }