public static void WriteTaggedValue(this BinaryWriter writer, DERTagType tag_type, bool constructed, int tag, byte[] data)
        {
            if (data is null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            int id = ((int)tag_type << 6);

            if (constructed)
            {
                id |= 0x20;
            }
            if (tag < 0x1F)
            {
                writer.WriteByte(id | tag);
            }
            else
            {
                writer.WriteByte(id | 0x1F);
                writer.WriteEncodedInt(tag);
            }
            writer.WriteLength(data.Length);
            writer.Write(data);
        }
Exemplo n.º 2
0
 public bool Check(bool constructed, DERTagType type, int tag)
 {
     return(Constructed == constructed && Type == type && Tag == tag);
 }