GetInstance() public static méthode

public static GetInstance ( Asn1TaggedObject obj, bool explicitly ) : GeneralNames
obj Asn1TaggedObject
explicitly bool
Résultat GeneralNames
Exemple #1
0
        private Holder(
            Asn1Sequence seq)
        {
            if (seq.Count > 3)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }

            for (int i = 0; i != seq.Count; i++)
            {
                Asn1TaggedObject tObj = Asn1TaggedObject.GetInstance(seq[i]);

                switch (tObj.TagNo)
                {
                case 0:
                    baseCertificateID = IssuerSerial.GetInstance(tObj, false);
                    break;

                case 1:
                    entityName = GeneralNames.GetInstance(tObj, false);
                    break;

                case 2:
                    objectDigestInfo = ObjectDigestInfo.GetInstance(tObj, false);
                    break;

                default:
                    throw new ArgumentException("unknown tag in Holder");
                }
            }
        }
Exemple #2
0
        private V2Form(
            Asn1Sequence seq)
        {
            if (seq.Count > 3)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }

            int index = 0;

            if (!(seq[0] is Asn1TaggedObject))
            {
                index++;
                this.issuerName = GeneralNames.GetInstance(seq[0]);
            }

            for (int i = index; i != seq.Count; i++)
            {
                Asn1TaggedObject o = Asn1TaggedObject.GetInstance(seq[i]);
                if (o.TagNo == 0)
                {
                    baseCertificateID = IssuerSerial.GetInstance(o, false);
                }
                else if (o.TagNo == 1)
                {
                    objectDigestInfo = ObjectDigestInfo.GetInstance(o, false);
                }
                else
                {
                    throw new ArgumentException("Bad tag number: " + o.TagNo);
                }
            }
        }
Exemple #3
0
        private RoleSyntax(Asn1Sequence seq)
        {
            //IL_002d: Unknown result type (might be due to invalid IL or missing references)
            //IL_007e: 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));
            }
            for (int i = 0; i != seq.Count; i++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[i]);
                switch (instance.TagNo)
                {
                case 0:
                    roleAuthority = GeneralNames.GetInstance(instance, explicitly: false);
                    break;

                case 1:
                    roleName = GeneralName.GetInstance(instance, explicitly: true);
                    break;

                default:
                    throw new ArgumentException("Unknown tag in RoleSyntax");
                }
            }
        }
Exemple #4
0
        public static AttCertIssuer GetInstance(
            object obj)
        {
            if (obj is AttCertIssuer)
            {
                return((AttCertIssuer)obj);
            }
            else if (obj is V2Form)
            {
                return(new AttCertIssuer(V2Form.GetInstance(obj)));
            }
            else if (obj is GeneralNames)
            {
                return(new AttCertIssuer((GeneralNames)obj));
            }
            else if (obj is Asn1TaggedObject)
            {
                return(new AttCertIssuer(V2Form.GetInstance((Asn1TaggedObject)obj, false)));
            }
            else if (obj is Asn1Sequence)
            {
                return(new AttCertIssuer(GeneralNames.GetInstance(obj)));
            }

            throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj");
        }
Exemple #5
0
        private Holder(Asn1Sequence seq)
        {
            if (seq.Count > 3)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }
            for (int num = 0; num != seq.Count; num++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[num]);
                switch (instance.TagNo)
                {
                case 0:
                    this.baseCertificateID = IssuerSerial.GetInstance(instance, false);
                    break;

                case 1:
                    this.entityName = GeneralNames.GetInstance(instance, false);
                    break;

                case 2:
                    this.objectDigestInfo = ObjectDigestInfo.GetInstance(instance, false);
                    break;

                default:
                    throw new ArgumentException("unknown tag in Holder");
                }
            }
            this.version = 1;
        }
Exemple #6
0
        private V2Form(Asn1Sequence seq)
        {
            //IL_0024: Unknown result type (might be due to invalid IL or missing references)
            //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
            if (seq.Count > 3)
            {
                throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count));
            }
            int num = 0;

            if (!(seq[0] is Asn1TaggedObject))
            {
                num++;
                issuerName = GeneralNames.GetInstance(seq[0]);
            }
            for (int i = num; i != seq.Count; i++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[i]);
                if (instance.TagNo == 0)
                {
                    baseCertificateID = IssuerSerial.GetInstance(instance, explicitly: false);
                    continue;
                }
                if (instance.TagNo == 1)
                {
                    objectDigestInfo = ObjectDigestInfo.GetInstance(instance, isExplicit: false);
                    continue;
                }
                throw new ArgumentException(string.Concat((object)"Bad tag number: ", (object)instance.TagNo));
            }
        }
Exemple #7
0
        private Holder(Asn1Sequence seq)
        {
            //IL_0024: Unknown result type (might be due to invalid IL or missing references)
            //IL_0088: Unknown result type (might be due to invalid IL or missing references)
            if (seq.Count > 3)
            {
                throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count));
            }
            for (int i = 0; i != seq.Count; i++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[i]);
                switch (instance.TagNo)
                {
                case 0:
                    baseCertificateID = IssuerSerial.GetInstance(instance, explicitly: false);
                    break;

                case 1:
                    entityName = GeneralNames.GetInstance(instance, explicitly: false);
                    break;

                case 2:
                    objectDigestInfo = ObjectDigestInfo.GetInstance(instance, isExplicit: false);
                    break;

                default:
                    throw new ArgumentException("unknown tag in Holder");
                }
            }
            version = 1;
        }
        /**
         * Constructor that builds an instance of <code>RoleSyntax</code> by
         * extracting the encoded elements from the <code>Asn1Sequence</code>
         * object supplied.
         * @param seq    an instance of <code>Asn1Sequence</code> that holds
         * the encoded elements used to build this <code>RoleSyntax</code>.
         */
        private RoleSyntax(
            Asn1Sequence seq)
        {
            if (seq.Count < 1 || seq.Count > 2)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }

            for (int i = 0; i != seq.Count; i++)
            {
                Asn1TaggedObject taggedObject = Asn1TaggedObject.GetInstance(seq[i]);
                switch (taggedObject.TagNo)
                {
                case 0:
                    roleAuthority = GeneralNames.GetInstance(taggedObject, false);
                    break;

                case 1:
                    roleName = GeneralName.GetInstance(taggedObject, true);
                    break;

                default:
                    throw new ArgumentException("Unknown tag in RoleSyntax");
                }
            }
        }
Exemple #9
0
        private V2Form(Asn1Sequence seq)
        {
            if (seq.Count > 3)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }
            int num = 0;

            if (!(seq[0] is Asn1TaggedObject))
            {
                num++;
                this.issuerName = GeneralNames.GetInstance(seq[0]);
            }
            for (int num2 = num; num2 != seq.Count; num2++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[num2]);
                if (instance.TagNo == 0)
                {
                    this.baseCertificateID = IssuerSerial.GetInstance(instance, false);
                }
                else
                {
                    if (instance.TagNo != 1)
                    {
                        throw new ArgumentException("Bad tag number: " + instance.TagNo);
                    }
                    this.objectDigestInfo = ObjectDigestInfo.GetInstance(instance, false);
                }
            }
        }
        protected internal AuthorityKeyIdentifier(
            Asn1Sequence seq)
        {
            foreach (Asn1Encodable element in seq)
            {
                Asn1TaggedObject obj = Asn1TaggedObject.GetInstance(element);

                switch (obj.TagNo)
                {
                case 0:
                    this.keyidentifier = Asn1OctetString.GetInstance(obj, false);
                    break;

                case 1:
                    this.certissuer = GeneralNames.GetInstance(obj, false);
                    break;

                case 2:
                    this.certserno = DerInteger.GetInstance(obj, false);
                    break;

                default:
                    throw new ArgumentException("illegal tag");
                }
            }
        }
 public static AttCertIssuer GetInstance(object obj)
 {
     //IL_007a: Unknown result type (might be due to invalid IL or missing references)
     if (obj is AttCertIssuer)
     {
         return((AttCertIssuer)obj);
     }
     if (obj is V2Form)
     {
         return(new AttCertIssuer(V2Form.GetInstance(obj)));
     }
     if (obj is GeneralNames)
     {
         return(new AttCertIssuer((GeneralNames)obj));
     }
     if (obj is Asn1TaggedObject)
     {
         return(new AttCertIssuer(V2Form.GetInstance((Asn1TaggedObject)obj, explicitly: false)));
     }
     if (obj is Asn1Sequence)
     {
         return(new AttCertIssuer(GeneralNames.GetInstance(obj)));
     }
     throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
 }
 /**
  * create an AuthorityKeyIdentifier with the GeneralNames tag and
  * the serial number provided.
  */
 public AuthorityKeyIdentifier(
     GeneralNames name,
     BigInteger serialNumber)
 {
     this.keyidentifier = null;
     this.certissuer    = GeneralNames.GetInstance(name.ToAsn1Object());
     this.certserno     = new DerInteger(serialNumber);
 }
        /**
         *
         */
        public IetfAttrSyntax(
            Asn1Sequence seq)
        {
            int i = 0;

            if (seq[0] is Asn1TaggedObject)
            {
                policyAuthority = GeneralNames.GetInstance(((Asn1TaggedObject)seq[0]), false);
                i++;
            }
            else if (seq.Count == 2)
            { // VOMS fix
                policyAuthority = GeneralNames.GetInstance(seq[0]);
                i++;
            }

            if (!(seq[i] is Asn1Sequence))
            {
                throw new ArgumentException("Non-IetfAttrSyntax encoding");
            }

            seq = (Asn1Sequence)seq[i];

            foreach (Asn1Object obj in seq)
            {
                int type;

                if (obj is DerObjectIdentifier)
                {
                    type = ValueOid;
                }
                else if (obj is DerUtf8String)
                {
                    type = ValueUtf8;
                }
                else if (obj is DerOctetString)
                {
                    type = ValueOctets;
                }
                else
                {
                    throw new ArgumentException("Bad value type encoding IetfAttrSyntax");
                }

                if (valueChoice < 0)
                {
                    valueChoice = type;
                }

                if (type != valueChoice)
                {
                    throw new ArgumentException("Mix of value types in IetfAttrSyntax");
                }

                values.Add(obj);
            }
        }
 /**
  * create an AuthorityKeyIdentifier with a precomupted key identifier
  * and the GeneralNames tag and the serial number provided as well.
  */
 public AuthorityKeyIdentifier(
     byte[]                  keyIdentifier,
     GeneralNames name,
     IBigInteger serialNumber)
 {
     this.keyidentifier = new DerOctetString(keyIdentifier);
     this.certissuer    = GeneralNames.GetInstance(name.ToAsn1Object());
     this.certserno     = new DerInteger(serialNumber);
 }
 public DistributionPointName(Asn1TaggedObject obj)
 {
     this.type = obj.TagNo;
     if (this.type == 0)
     {
         this.name = GeneralNames.GetInstance(obj, false);
         return;
     }
     this.name = Asn1Set.GetInstance(obj, false);
 }
 public DistributionPointName(Asn1TaggedObject obj)
 {
     type = obj.TagNo;
     if (type == 0)
     {
         name = GeneralNames.GetInstance(obj, explicitly: false);
     }
     else
     {
         name = Asn1Set.GetInstance(obj, explicitly: false);
     }
 }
Exemple #17
0
        public IetfAttrSyntax(Asn1Sequence seq)
        {
            int num = 0;

            if (seq[0] is Asn1TaggedObject)
            {
                this.policyAuthority = GeneralNames.GetInstance((Asn1TaggedObject)seq[0], false);
                num++;
            }
            else if (seq.Count == 2)
            {
                this.policyAuthority = GeneralNames.GetInstance(seq[0]);
                num++;
            }
            if (!(seq[num] is Asn1Sequence))
            {
                throw new ArgumentException("Non-IetfAttrSyntax encoding");
            }
            seq = (Asn1Sequence)seq[num];
            foreach (Asn1Object asn1Object in seq)
            {
                int num2;
                if (asn1Object is DerObjectIdentifier)
                {
                    num2 = 2;
                }
                else if (asn1Object is DerUtf8String)
                {
                    num2 = 3;
                }
                else
                {
                    if (!(asn1Object is DerOctetString))
                    {
                        throw new ArgumentException("Bad value type encoding IetfAttrSyntax");
                    }
                    num2 = 1;
                }
                if (this.valueChoice < 0)
                {
                    this.valueChoice = num2;
                }
                if (num2 != this.valueChoice)
                {
                    throw new ArgumentException("Mix of value types in IetfAttrSyntax");
                }
                this.values.Add(new Asn1Encodable[]
                {
                    asn1Object
                });
            }
        }
Exemple #18
0
 private IssuerSerial(Asn1Sequence seq)
 {
     if (seq.Count != 2 && seq.Count != 3)
     {
         throw new ArgumentException("Bad sequence size: " + seq.Count);
     }
     this.issuer = GeneralNames.GetInstance(seq[0]);
     this.serial = DerInteger.GetInstance(seq[1]);
     if (seq.Count == 3)
     {
         this.issuerUid = DerBitString.GetInstance(seq[2]);
     }
 }
Exemple #19
0
 private IssuerSerial(Asn1Sequence seq)
 {
     //IL_002d: Unknown result type (might be due to invalid IL or missing references)
     if (seq.Count != 2 && seq.Count != 3)
     {
         throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count));
     }
     issuer = GeneralNames.GetInstance(seq[0]);
     serial = DerInteger.GetInstance(seq[1]);
     if (seq.Count == 3)
     {
         issuerUid = DerBitString.GetInstance(seq[2]);
     }
 }
Exemple #20
0
        public Holder(Asn1TaggedObject tagObj)
        {
            switch (tagObj.TagNo)
            {
            case 0:
                this.baseCertificateID = IssuerSerial.GetInstance(tagObj, false);
                break;

            case 1:
                this.entityName = GeneralNames.GetInstance(tagObj, false);
                break;

            default:
                throw new ArgumentException("unknown tag in Holder");
            }
            this.version = 0;
        }
Exemple #21
0
        public Holder(Asn1TaggedObject tagObj)
        {
            //IL_0040: Unknown result type (might be due to invalid IL or missing references)
            switch (tagObj.TagNo)
            {
            case 0:
                baseCertificateID = IssuerSerial.GetInstance(tagObj, explicitly: false);
                break;

            case 1:
                entityName = GeneralNames.GetInstance(tagObj, explicitly: false);
                break;

            default:
                throw new ArgumentException("unknown tag in Holder");
            }
            version = 0;
        }
		private DistributionPoint(Asn1Sequence seq)
		{
			for (int i = 0; i != seq.Count; i++)
			{
				Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[i]);
				switch (instance.TagNo)
				{
				case 0:
					distributionPoint = DistributionPointName.GetInstance(instance, explicitly: true);
					break;
				case 1:
					reasons = new ReasonFlags(DerBitString.GetInstance(instance, isExplicit: false));
					break;
				case 2:
					cRLIssuer = GeneralNames.GetInstance(instance, explicitly: false);
					break;
				}
			}
		}
Exemple #23
0
        private DistributionPoint(Asn1Sequence seq)
        {
            for (int num = 0; num != seq.Count; num++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[num]);
                switch (instance.TagNo)
                {
                case 0:
                    this.distributionPoint = DistributionPointName.GetInstance(instance, true);
                    break;

                case 1:
                    this.reasons = new ReasonFlags(DerBitString.GetInstance(instance, false));
                    break;

                case 2:
                    this.cRLIssuer = GeneralNames.GetInstance(instance, false);
                    break;
                }
            }
        }
        private DistributionPoint(Asn1Sequence seq)
        {
            for (int i = 0; i != seq.Count; i++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[i]);
                switch (instance.TagNo)
                {
                case 0:
                    this.distributionPoint = Org.BouncyCastle.Asn1.X509.DistributionPointName.GetInstance(instance, true);
                    break;

                case 1:
                    this.reasons = new ReasonFlags(DerBitString.GetInstance(instance, false));
                    break;

                case 2:
                    this.cRLIssuer = GeneralNames.GetInstance(instance, false);
                    break;
                }
            }
        }
Exemple #25
0
        protected internal AuthorityKeyIdentifier(Asn1Sequence seq)
        {
            //IL_0068: Unknown result type (might be due to invalid IL or missing references)
            global::System.Collections.IEnumerator enumerator = seq.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Asn1TaggedObject asn1TaggedObject = (Asn1TaggedObject)enumerator.get_Current();
                    switch (asn1TaggedObject.TagNo)
                    {
                    case 0:
                        keyidentifier = Asn1OctetString.GetInstance(asn1TaggedObject, isExplicit: false);
                        break;

                    case 1:
                        certissuer = GeneralNames.GetInstance(asn1TaggedObject, explicitly: false);
                        break;

                    case 2:
                        certserno = DerInteger.GetInstance(asn1TaggedObject, isExplicit: false);
                        break;

                    default:
                        throw new ArgumentException("illegal tag");
                    }
                }
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Exemple #26
0
        private RoleSyntax(Asn1Sequence seq)
        {
            if (seq.Count < 1 || seq.Count > 2)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }
            for (int num = 0; num != seq.Count; num++)
            {
                Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(seq[num]);
                switch (instance.TagNo)
                {
                case 0:
                    this.roleAuthority = GeneralNames.GetInstance(instance, false);
                    break;

                case 1:
                    this.roleName = GeneralName.GetInstance(instance, true);
                    break;

                default:
                    throw new ArgumentException("Unknown tag in RoleSyntax");
                }
            }
        }
Exemple #27
0
        public IetfAttrSyntax(Asn1Sequence seq)
        {
            //IL_007e: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d0: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f4: Unknown result type (might be due to invalid IL or missing references)
            int num = 0;

            if (seq[0] is Asn1TaggedObject)
            {
                policyAuthority = GeneralNames.GetInstance((Asn1TaggedObject)seq[0], explicitly: false);
                num++;
            }
            else if (seq.Count == 2)
            {
                policyAuthority = GeneralNames.GetInstance(seq[0]);
                num++;
            }
            if (!(seq[num] is Asn1Sequence))
            {
                throw new ArgumentException("Non-IetfAttrSyntax encoding");
            }
            seq = (Asn1Sequence)seq[num];
            global::System.Collections.IEnumerator enumerator = seq.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Asn1Object asn1Object = (Asn1Object)enumerator.get_Current();
                    int        num2;
                    if (asn1Object is DerObjectIdentifier)
                    {
                        num2 = 2;
                    }
                    else if (asn1Object is DerUtf8String)
                    {
                        num2 = 3;
                    }
                    else
                    {
                        if (!(asn1Object is DerOctetString))
                        {
                            throw new ArgumentException("Bad value type encoding IetfAttrSyntax");
                        }
                        num2 = 1;
                    }
                    if (valueChoice < 0)
                    {
                        valueChoice = num2;
                    }
                    if (num2 != valueChoice)
                    {
                        throw new ArgumentException("Mix of value types in IetfAttrSyntax");
                    }
                    values.Add(asn1Object);
                }
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Exemple #28
0
 public static GeneralNames GetInstance(Asn1TaggedObject obj, bool explicitly)
 {
     return(GeneralNames.GetInstance(Asn1Sequence.GetInstance(obj, explicitly)));
 }