Beispiel #1
0
 internal Asn1OctetString(
     Asn1Encodable obj)
 {
     try
     {
         this.str = obj.GetEncoded(Asn1Encodable.Der);
     }
     catch (IOException e)
     {
         throw new ArgumentException("Error processing object : " + e.ToString());
     }
 }
Beispiel #2
0
        protected internal void Sort()
        {
            if (_set.Count < 2)
            {
                return;
            }

#if PORTABLE || NETFX_CORE
            var sorted = _set.Cast <Asn1Encodable>()
                         .Select(a => new { Item = a, Key = a.GetEncoded(Asn1Encodable.Der) })
                         .OrderBy(t => t.Key, new DerComparer())
                         .Select(t => t.Item)
                         .ToList();

            for (int i = 0; i < _set.Count; ++i)
            {
                _set[i] = sorted[i];
            }
#else
            Asn1Encodable[] items = new Asn1Encodable[_set.Count];
            byte[][]        keys  = new byte[_set.Count][];

            for (int i = 0; i < _set.Count; ++i)
            {
                Asn1Encodable item = (Asn1Encodable)_set[i];
                items[i] = item;
                keys[i]  = item.GetEncoded(Asn1Encodable.Der);
            }

            Array.Sort(keys, items, new DerComparer());

            for (int i = 0; i < _set.Count; ++i)
            {
                _set[i] = items[i];
            }
#endif
        }
Beispiel #3
0
 public DerOctetString(Asn1Encodable obj)
     : base(obj.GetEncoded(Asn1Encodable.Der))
 {
 }