GetInstance() public static method

public static GetInstance ( Asn1TaggedObject obj, bool explicitly ) : X509CertificateStructure
obj Asn1TaggedObject
explicitly bool
return X509CertificateStructure
Ejemplo n.º 1
0
        /**
         * Constructor from Asn1Sequence.
         * <p/>
         * The sequence is of type CertificatePair:
         * <p/>
         * <pre>
         *       CertificatePair ::= SEQUENCE {
         *         forward		[0]	Certificate OPTIONAL,
         *         reverse		[1]	Certificate OPTIONAL,
         *         -- at least one of the pair shall be present -- }
         * </pre>
         *
         * @param seq The ASN.1 sequence.
         */
        private CertificatePair(
            Asn1Sequence seq)
        {
            if (seq.Count != 1 && seq.Count != 2)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
            }

            foreach (object obj in seq)
            {
                Asn1TaggedObject o = Asn1TaggedObject.GetInstance(obj);
                if (o.TagNo == 0)
                {
                    forward = X509CertificateStructure.GetInstance(o, true);
                }
                else if (o.TagNo == 1)
                {
                    reverse = X509CertificateStructure.GetInstance(o, true);
                }
                else
                {
                    throw new ArgumentException("Bad tag number: " + o.TagNo);
                }
            }
        }
Ejemplo n.º 2
0
 private CertificatePair(Asn1Sequence seq)
 {
     if (seq.Count != 1 && seq.Count != 2)
     {
         throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
     }
     foreach (object current in seq)
     {
         Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(current);
         if (instance.TagNo == 0)
         {
             this.forward = X509CertificateStructure.GetInstance(instance, true);
         }
         else
         {
             if (instance.TagNo != 1)
             {
                 throw new ArgumentException("Bad tag number: " + instance.TagNo);
             }
             this.reverse = X509CertificateStructure.GetInstance(instance, true);
         }
     }
 }
Ejemplo n.º 3
0
 private CertificatePair(Asn1Sequence seq)
 {
     //IL_0032: Unknown result type (might be due to invalid IL or missing references)
     //IL_0093: Unknown result type (might be due to invalid IL or missing references)
     if (seq.Count != 1 && seq.Count != 2)
     {
         throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count), "seq");
     }
     global::System.Collections.IEnumerator enumerator = seq.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             object           current  = enumerator.get_Current();
             Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(current);
             if (instance.TagNo == 0)
             {
                 forward = X509CertificateStructure.GetInstance(instance, explicitly: true);
                 continue;
             }
             if (instance.TagNo == 1)
             {
                 reverse = X509CertificateStructure.GetInstance(instance, explicitly: true);
                 continue;
             }
             throw new ArgumentException(string.Concat((object)"Bad tag number: ", (object)instance.TagNo));
         }
     }
     finally
     {
         global::System.IDisposable disposable = enumerator as global::System.IDisposable;
         if (disposable != null)
         {
             disposable.Dispose();
         }
     }
 }
Ejemplo n.º 4
0
 public static X509CertificateStructure GetInstance(Asn1TaggedObject obj, bool explicitly)
 {
     return(X509CertificateStructure.GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }