예제 #1
0
 internal DerAsnSet(Queue <byte> rawData)
     : base(DerAsnTypeTag.Set)
 {
     if (rawData == null)
     {
         throw new ArgumentNullException(nameof(rawData));
     }
     while (rawData.Any())
     {
         _items.Add(DerAsnType.Parse(rawData));
     }
 }
        public virtual IEnumerable <byte> Encode(DerAsnType asnType)
        {
            if (asnType == null)
            {
                throw new ArgumentNullException(nameof(asnType));
            }

            foreach (var data in asnType.Identifier.Encode())
            {
                yield return(data);
            }

            var valueData = asnType.Encode(this).ToArray();

            foreach (var data in new DerAsnLength(valueData.Length).Encode())
            {
                yield return(data);
            }

            foreach (var data in valueData)
            {
                yield return(data);
            }
        }