GetEncoded() public method

public GetEncoded ( ) : byte[]
return byte[]
		public void AddExtension(
			string			oid,
			bool			critical,
			Asn1Encodable	value)
		{
			this.AddExtension(oid, critical, value.GetEncoded());
		}
		/**
		 * add a given extension field for the standard extensions tag (tag 3)
		 * @throws IOException
		 */
		public virtual void AddExtension(
			DerObjectIdentifier	oid,
			bool				critical,
			Asn1Encodable 		extValue)
		{
			this.AddExtension(oid, critical, extValue.GetEncoded());
		}
Esempio n. 3
0
 internal Asn1OctetString(Asn1Encodable obj)
 {
     try
     {
         this.str = obj.GetEncoded("DER");
     }
     catch (IOException ex)
     {
         throw new ArgumentException("Error processing object : " + ex.ToString());
     }
 }
Esempio n. 4
0
        internal Asn1OctetString(
            Asn1Encodable obj)
        {
            try
            {
				this.str = obj.GetEncoded(Asn1Encodable.Der);
            }
            catch (IOException e)
            {
                throw new ArgumentException("Error processing object : " + e.ToString());
            }
        }
Esempio n. 5
0
 internal Asn1OctetString(Asn1Encodable obj)
 {
     //IL_001a: Expected O, but got Unknown
     //IL_002a: Unknown result type (might be due to invalid IL or missing references)
     try
     {
         str = obj.GetEncoded("DER");
     }
     catch (IOException val)
     {
         IOException val2 = val;
         throw new ArgumentException("Error processing object : " + ((global::System.Exception)(object) val2).ToString());
     }
 }
Esempio n. 6
0
 protected internal void Sort()
 {
     if (this._set.Count >= 2)
     {
         Asn1Encodable[] items = new Asn1Encodable[this._set.Count];
         byte[][]        keys  = new byte[this._set.Count][];
         for (int i = 0; i < this._set.Count; i++)
         {
             Asn1Encodable encodable = (Asn1Encodable)this._set[i];
             items[i] = encodable;
             keys[i]  = encodable.GetEncoded("DER");
         }
         Array.Sort(keys, items, new DerComparer());
         for (int j = 0; j < this._set.Count; j++)
         {
             this._set[j] = items[j];
         }
     }
 }
Esempio n. 7
0
 protected internal void Sort()
 {
     if (this._set.Count < 2)
     {
         return;
     }
     Asn1Encodable[] array  = new Asn1Encodable[this._set.Count];
     byte[][]        array2 = new byte[this._set.Count][];
     for (int i = 0; i < this._set.Count; i++)
     {
         Asn1Encodable asn1Encodable = (Asn1Encodable)this._set[i];
         array[i]  = asn1Encodable;
         array2[i] = asn1Encodable.GetEncoded("DER");
     }
     Array.Sort(array2, array, new Asn1Set.DerComparer());
     for (int j = 0; j < this._set.Count; j++)
     {
         this._set[j] = array[j];
     }
 }
Esempio n. 8
0
        protected internal void Sort()
        {
            if (_set.Count < 2)
            {
                return;
            }

#if PORTABLE
            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
        }
Esempio n. 9
0
        protected internal void Sort()
        {
            if (_set.Count < 2)
            {
                return;
            }

            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];
            }
        }
			private static void WriteToGenerator(
				Asn1Generator	ag,
				Asn1Encodable	ae)
			{
				byte[] encoded = ae.GetEncoded();
				ag.GetRawOutputStream().Write(encoded, 0, encoded.Length);
			}
Esempio n. 11
0
		private byte[] ToDerEncoded(Asn1Encodable obj)
		{
			try
			{
				return obj.GetEncoded(Asn1Encodable.Der);
			}
			catch (IOException e)
			{
				throw new CertificateEncodingException("Exception thrown", e);
			}
		}
Esempio n. 12
0
 public DerOctetString(Asn1Encodable obj)
     : base(obj.GetEncoded(Asn1Encodable.Der))
 {
 }