114 lines
4.6 KiB
Java
114 lines
4.6 KiB
Java
|
package org.bouncycastle.asn1.x509;
|
||
|
|
||
|
import java.math.BigInteger;
|
||
|
import org.bouncycastle.asn1.ASN1EncodableVector;
|
||
|
import org.bouncycastle.asn1.ASN1Integer;
|
||
|
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;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class GeneralSubtree extends ASN1Object {
|
||
|
private static final BigInteger ZERO = BigInteger.valueOf(0);
|
||
|
private GeneralName base;
|
||
|
private ASN1Integer maximum;
|
||
|
private ASN1Integer minimum;
|
||
|
|
||
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
||
|
public ASN1Primitive toASN1Primitive() {
|
||
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
||
|
aSN1EncodableVector.add(this.base);
|
||
|
ASN1Integer aSN1Integer = this.minimum;
|
||
|
if (aSN1Integer != null && !aSN1Integer.getValue().equals(ZERO)) {
|
||
|
aSN1EncodableVector.add(new DERTaggedObject(false, 0, this.minimum));
|
||
|
}
|
||
|
if (this.maximum != null) {
|
||
|
aSN1EncodableVector.add(new DERTaggedObject(false, 1, this.maximum));
|
||
|
}
|
||
|
return new DERSequence(aSN1EncodableVector);
|
||
|
}
|
||
|
|
||
|
public BigInteger getMinimum() {
|
||
|
ASN1Integer aSN1Integer = this.minimum;
|
||
|
return aSN1Integer == null ? ZERO : aSN1Integer.getValue();
|
||
|
}
|
||
|
|
||
|
public BigInteger getMaximum() {
|
||
|
ASN1Integer aSN1Integer = this.maximum;
|
||
|
if (aSN1Integer == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return aSN1Integer.getValue();
|
||
|
}
|
||
|
|
||
|
public GeneralName getBase() {
|
||
|
return this.base;
|
||
|
}
|
||
|
|
||
|
public static GeneralSubtree getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
||
|
return new GeneralSubtree(ASN1Sequence.getInstance(aSN1TaggedObject, z));
|
||
|
}
|
||
|
|
||
|
public static GeneralSubtree getInstance(Object obj) {
|
||
|
if (obj == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return obj instanceof GeneralSubtree ? (GeneralSubtree) obj : new GeneralSubtree(ASN1Sequence.getInstance(obj));
|
||
|
}
|
||
|
|
||
|
public GeneralSubtree(GeneralName generalName, BigInteger bigInteger, BigInteger bigInteger2) {
|
||
|
this.base = generalName;
|
||
|
if (bigInteger2 != null) {
|
||
|
this.maximum = new ASN1Integer(bigInteger2);
|
||
|
}
|
||
|
this.minimum = bigInteger == null ? null : new ASN1Integer(bigInteger);
|
||
|
}
|
||
|
|
||
|
public GeneralSubtree(GeneralName generalName) {
|
||
|
this(generalName, null, null);
|
||
|
}
|
||
|
|
||
|
private GeneralSubtree(ASN1Sequence aSN1Sequence) {
|
||
|
ASN1TaggedObject aSN1TaggedObject;
|
||
|
this.base = GeneralName.getInstance(aSN1Sequence.getObjectAt(0));
|
||
|
int size = aSN1Sequence.size();
|
||
|
if (size != 1) {
|
||
|
if (size == 2) {
|
||
|
aSN1TaggedObject = ASN1TaggedObject.getInstance(aSN1Sequence.getObjectAt(1));
|
||
|
int tagNo = aSN1TaggedObject.getTagNo();
|
||
|
if (tagNo == 0) {
|
||
|
this.minimum = ASN1Integer.getInstance(aSN1TaggedObject, false);
|
||
|
return;
|
||
|
} else if (tagNo != 1) {
|
||
|
StringBuilder sb = new StringBuilder("Bad tag number: ");
|
||
|
sb.append(aSN1TaggedObject.getTagNo());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
} else {
|
||
|
if (size != 3) {
|
||
|
StringBuilder sb2 = new StringBuilder("Bad sequence size: ");
|
||
|
sb2.append(aSN1Sequence.size());
|
||
|
throw new IllegalArgumentException(sb2.toString());
|
||
|
}
|
||
|
ASN1TaggedObject aSN1TaggedObject2 = ASN1TaggedObject.getInstance(aSN1Sequence.getObjectAt(1));
|
||
|
if (aSN1TaggedObject2.getTagNo() != 0) {
|
||
|
StringBuilder sb3 = new StringBuilder("Bad tag number for 'minimum': ");
|
||
|
sb3.append(aSN1TaggedObject2.getTagNo());
|
||
|
throw new IllegalArgumentException(sb3.toString());
|
||
|
}
|
||
|
this.minimum = ASN1Integer.getInstance(aSN1TaggedObject2, false);
|
||
|
aSN1TaggedObject = ASN1TaggedObject.getInstance(aSN1Sequence.getObjectAt(2));
|
||
|
if (aSN1TaggedObject.getTagNo() != 1) {
|
||
|
StringBuilder sb4 = new StringBuilder("Bad tag number for 'maximum': ");
|
||
|
sb4.append(aSN1TaggedObject.getTagNo());
|
||
|
throw new IllegalArgumentException(sb4.toString());
|
||
|
}
|
||
|
}
|
||
|
this.maximum = ASN1Integer.getInstance(aSN1TaggedObject, false);
|
||
|
}
|
||
|
}
|
||
|
}
|