Exemple #1
0
 internal override void Encode(DerOutputStream derOut)
 {
     if (derOut is Asn1OutputStream || derOut is BerOutputStream)
     {
         derOut.WriteByte(49);
         derOut.WriteByte(128);
         {
             IEnumerator enumerator = GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     Asn1Encodable obj = (Asn1Encodable)enumerator.Current;
                     derOut.WriteObject(obj);
                 }
             }
             finally
             {
                 IDisposable disposable = enumerator as IDisposable;
                 if (disposable != null)
                 {
                     disposable.Dispose();
                 }
             }
         }
         derOut.WriteByte(0);
         derOut.WriteByte(0);
     }
     else
     {
         base.Encode(derOut);
     }
 }
Exemple #2
0
 internal override void Encode(DerOutputStream derOut)
 {
     if (derOut is Asn1OutputStream || derOut is BerOutputStream)
     {
         derOut.WriteTag(160, tagNo);
         derOut.WriteByte(128);
         if (!IsEmpty())
         {
             if (!explicitly)
             {
                 IEnumerable enumerable;
                 if (base.obj is Asn1OctetString)
                 {
                     if (base.obj is BerOctetString)
                     {
                         enumerable = (BerOctetString)base.obj;
                     }
                     else
                     {
                         Asn1OctetString asn1OctetString = (Asn1OctetString)base.obj;
                         enumerable = new BerOctetString(asn1OctetString.GetOctets());
                     }
                 }
                 else if (base.obj is Asn1Sequence)
                 {
                     enumerable = (Asn1Sequence)base.obj;
                 }
                 else
                 {
                     if (!(base.obj is Asn1Set))
                     {
                         throw Platform.CreateNotImplementedException(Platform.GetTypeName(base.obj));
                     }
                     enumerable = (Asn1Set)base.obj;
                 }
                 foreach (Asn1Encodable item in enumerable)
                 {
                     derOut.WriteObject(item);
                 }
             }
             else
             {
                 derOut.WriteObject(obj);
             }
         }
         derOut.WriteByte(0);
         derOut.WriteByte(0);
     }
     else
     {
         base.Encode(derOut);
     }
 }
Exemple #3
0
        internal override void Encode(DerOutputStream derOut)
        {
            if (derOut is Asn1OutputStream || derOut is BerOutputStream)
            {
                derOut.WriteByte(Asn1Tags.Set | Asn1Tags.Constructed);
                derOut.WriteByte(0x80);

                foreach (Asn1Encodable o in this)
                {
                    derOut.WriteObject(o);
                }

                derOut.WriteByte(0x00);
                derOut.WriteByte(0x00);
            }
            else
            {
                base.Encode(derOut);
            }
        }
Exemple #4
0
 internal override void Encode(DerOutputStream derOut)
 {
     if (derOut is Asn1OutputStream || derOut is BerOutputStream)
     {
         derOut.WriteByte(5);
     }
     else
     {
         base.Encode(derOut);
     }
 }
		/*
		 */
		internal override void Encode(
			DerOutputStream derOut)
		{
			if (derOut is Asn1OutputStream || derOut is BerOutputStream)
			{
				derOut.WriteByte(Asn1Tags.Sequence | Asn1Tags.Constructed);
				derOut.WriteByte(0x80);

				foreach (Asn1Encodable o in this)
				{
					derOut.WriteObject(o);
				}

				derOut.WriteByte(0x00);
				derOut.WriteByte(0x00);
			}
			else
			{
				base.Encode(derOut);
			}
		}