package org.bouncycastle.asn1.x509; 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.DERBitString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERTaggedObject; import org.bouncycastle.util.Strings; /* loaded from: classes6.dex */ public class DistributionPoint extends ASN1Object { GeneralNames cRLIssuer; DistributionPointName distributionPoint; ReasonFlags reasons; public String toString() { String lineSeparator = Strings.lineSeparator(); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("DistributionPoint: ["); stringBuffer.append(lineSeparator); DistributionPointName distributionPointName = this.distributionPoint; if (distributionPointName != null) { appendObject(stringBuffer, lineSeparator, "distributionPoint", distributionPointName.toString()); } ReasonFlags reasonFlags = this.reasons; if (reasonFlags != null) { appendObject(stringBuffer, lineSeparator, "reasons", reasonFlags.toString()); } GeneralNames generalNames = this.cRLIssuer; if (generalNames != null) { appendObject(stringBuffer, lineSeparator, "cRLIssuer", generalNames.toString()); } stringBuffer.append("]"); stringBuffer.append(lineSeparator); return stringBuffer.toString(); } @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector(); if (this.distributionPoint != null) { aSN1EncodableVector.add(new DERTaggedObject(0, this.distributionPoint)); } if (this.reasons != null) { aSN1EncodableVector.add(new DERTaggedObject(false, 1, this.reasons)); } if (this.cRLIssuer != null) { aSN1EncodableVector.add(new DERTaggedObject(false, 2, this.cRLIssuer)); } return new DERSequence(aSN1EncodableVector); } public ReasonFlags getReasons() { return this.reasons; } public DistributionPointName getDistributionPoint() { return this.distributionPoint; } public GeneralNames getCRLIssuer() { return this.cRLIssuer; } public static DistributionPoint getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) { return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z)); } public static DistributionPoint getInstance(Object obj) { if (obj == null || (obj instanceof DistributionPoint)) { return (DistributionPoint) obj; } if (obj instanceof ASN1Sequence) { return new DistributionPoint((ASN1Sequence) obj); } StringBuilder sb = new StringBuilder("Invalid DistributionPoint: "); sb.append(obj.getClass().getName()); throw new IllegalArgumentException(sb.toString()); } private void appendObject(StringBuffer stringBuffer, String str, String str2, String str3) { stringBuffer.append(" "); stringBuffer.append(str2); stringBuffer.append(":"); stringBuffer.append(str); stringBuffer.append(" "); stringBuffer.append(" "); stringBuffer.append(str3); stringBuffer.append(str); } public DistributionPoint(DistributionPointName distributionPointName, ReasonFlags reasonFlags, GeneralNames generalNames) { this.distributionPoint = distributionPointName; this.reasons = reasonFlags; this.cRLIssuer = generalNames; } public DistributionPoint(ASN1Sequence aSN1Sequence) { for (int i = 0; i != aSN1Sequence.size(); i++) { ASN1TaggedObject aSN1TaggedObject = ASN1TaggedObject.getInstance(aSN1Sequence.getObjectAt(i)); int tagNo = aSN1TaggedObject.getTagNo(); if (tagNo == 0) { this.distributionPoint = DistributionPointName.getInstance(aSN1TaggedObject, true); } else if (tagNo == 1) { this.reasons = new ReasonFlags(DERBitString.getInstance(aSN1TaggedObject, false)); } else { if (tagNo != 2) { StringBuilder sb = new StringBuilder("Unknown tag encountered in structure: "); sb.append(aSN1TaggedObject.getTagNo()); throw new IllegalArgumentException(sb.toString()); } this.cRLIssuer = GeneralNames.getInstance(aSN1TaggedObject, false); } } } }