Example #1
0
        public static AsnAttributeTypeAndValue Decode(byte[] source, ref int pos)
        {
            AsnAttributeTypeAndValue instance = new AsnAttributeTypeAndValue();

            // skip the 0x30 (SEQUENCE)
            pos++;

            long length = instance.GetLength(source, ref pos);

            instance.elements.Add(AsnOid.Decode(source, ref pos));
            instance.elements.Add(AsnString.Decode(source, ref pos));

            return(instance);
        }
Example #2
0
        public static AsnString Decode(byte[] source, ref int pos)
        {
            AsnString instance = new AsnString()
            {
                tag = (AsnType.UniversalTag)source[pos]
            };

            pos++;

            // length and value in subsequent bytes
            int length = instance.GetLength(source, ref pos);

            byte[] raw = new byte[length];
            Array.Copy(source, pos, raw, 0, length);
            instance.value = System.Text.Encoding.UTF8.GetString(raw);
            pos           += (int)length;

            return(instance);
        }
Example #3
0
 public AsnAttributeTypeAndValue(AsnOid oid, AsnString newValue)
 {
     elements.Add(oid);
     elements.Add(newValue);
 }