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.DERSequence; import org.bouncycastle.asn1.x509.GeneralName; /* loaded from: classes6.dex */ public class AdmissionSyntax extends ASN1Object { private GeneralName admissionAuthority; private ASN1Sequence contentsOfAdmissions; @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector(); GeneralName generalName = this.admissionAuthority; if (generalName != null) { aSN1EncodableVector.add(generalName); } aSN1EncodableVector.add(this.contentsOfAdmissions); return new DERSequence(aSN1EncodableVector); } public Admissions[] getContentsOfAdmissions() { Admissions[] admissionsArr = new Admissions[this.contentsOfAdmissions.size()]; Enumeration objects = this.contentsOfAdmissions.getObjects(); int i = 0; while (objects.hasMoreElements()) { admissionsArr[i] = Admissions.getInstance(objects.nextElement()); i++; } return admissionsArr; } public GeneralName getAdmissionAuthority() { return this.admissionAuthority; } public static AdmissionSyntax getInstance(Object obj) { if (obj == null || (obj instanceof AdmissionSyntax)) { return (AdmissionSyntax) obj; } if (obj instanceof ASN1Sequence) { return new AdmissionSyntax((ASN1Sequence) obj); } StringBuilder sb = new StringBuilder("illegal object in getInstance: "); sb.append(obj.getClass().getName()); throw new IllegalArgumentException(sb.toString()); } public AdmissionSyntax(GeneralName generalName, ASN1Sequence aSN1Sequence) { this.admissionAuthority = generalName; this.contentsOfAdmissions = aSN1Sequence; } private AdmissionSyntax(ASN1Sequence aSN1Sequence) { ASN1Encodable objectAt; int size = aSN1Sequence.size(); if (size == 1) { objectAt = aSN1Sequence.getObjectAt(0); } else { if (size != 2) { StringBuilder sb = new StringBuilder("Bad sequence size: "); sb.append(aSN1Sequence.size()); throw new IllegalArgumentException(sb.toString()); } this.admissionAuthority = GeneralName.getInstance(aSN1Sequence.getObjectAt(0)); objectAt = aSN1Sequence.getObjectAt(1); } this.contentsOfAdmissions = DERSequence.getInstance(objectAt); } }