package org.bouncycastle.asn1.isismtt.x509; import java.util.Enumeration; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERTaggedObject; import org.bouncycastle.asn1.x509.GeneralName; /* loaded from: classes6.dex */ public class Admissions extends ASN1Object { private GeneralName admissionAuthority; private NamingAuthority namingAuthority; private ASN1Sequence professionInfos; @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector(); if (this.admissionAuthority != null) { aSN1EncodableVector.add(new DERTaggedObject(true, 0, this.admissionAuthority)); } if (this.namingAuthority != null) { aSN1EncodableVector.add(new DERTaggedObject(true, 1, this.namingAuthority)); } aSN1EncodableVector.add(this.professionInfos); return new DERSequence(aSN1EncodableVector); } public ProfessionInfo[] getProfessionInfos() { ProfessionInfo[] professionInfoArr = new ProfessionInfo[this.professionInfos.size()]; Enumeration objects = this.professionInfos.getObjects(); int i = 0; while (objects.hasMoreElements()) { professionInfoArr[i] = ProfessionInfo.getInstance(objects.nextElement()); i++; } return professionInfoArr; } public NamingAuthority getNamingAuthority() { return this.namingAuthority; } public GeneralName getAdmissionAuthority() { return this.admissionAuthority; } public static Admissions getInstance(Object obj) { if (obj == null || (obj instanceof Admissions)) { return (Admissions) obj; } if (obj instanceof ASN1Sequence) { return new Admissions((ASN1Sequence) obj); } StringBuilder sb = new StringBuilder("illegal object in getInstance: "); sb.append(obj.getClass().getName()); throw new IllegalArgumentException(sb.toString()); } public Admissions(GeneralName generalName, NamingAuthority namingAuthority, ProfessionInfo[] professionInfoArr) { this.admissionAuthority = generalName; this.namingAuthority = namingAuthority; this.professionInfos = new DERSequence(professionInfoArr); } private Admissions(ASN1Sequence aSN1Sequence) { if (aSN1Sequence.size() > 3) { StringBuilder sb = new StringBuilder("Bad sequence size: "); sb.append(aSN1Sequence.size()); throw new IllegalArgumentException(sb.toString()); } Enumeration objects = aSN1Sequence.getObjects(); ASN1Encodable aSN1Encodable = (ASN1Encodable) objects.nextElement(); if (aSN1Encodable instanceof ASN1TaggedObject) { ASN1TaggedObject aSN1TaggedObject = (ASN1TaggedObject) aSN1Encodable; int tagNo = aSN1TaggedObject.getTagNo(); if (tagNo == 0) { this.admissionAuthority = GeneralName.getInstance(aSN1TaggedObject, true); } else { if (tagNo != 1) { StringBuilder sb2 = new StringBuilder("Bad tag number: "); sb2.append(aSN1TaggedObject.getTagNo()); throw new IllegalArgumentException(sb2.toString()); } this.namingAuthority = NamingAuthority.getInstance(aSN1TaggedObject, true); } aSN1Encodable = (ASN1Encodable) objects.nextElement(); } if (aSN1Encodable instanceof ASN1TaggedObject) { ASN1TaggedObject aSN1TaggedObject2 = (ASN1TaggedObject) aSN1Encodable; if (aSN1TaggedObject2.getTagNo() != 1) { StringBuilder sb3 = new StringBuilder("Bad tag number: "); sb3.append(aSN1TaggedObject2.getTagNo()); throw new IllegalArgumentException(sb3.toString()); } this.namingAuthority = NamingAuthority.getInstance(aSN1TaggedObject2, true); aSN1Encodable = (ASN1Encodable) objects.nextElement(); } this.professionInfos = ASN1Sequence.getInstance(aSN1Encodable); if (objects.hasMoreElements()) { StringBuilder sb4 = new StringBuilder("Bad object encountered: "); sb4.append(objects.nextElement().getClass()); throw new IllegalArgumentException(sb4.toString()); } } }