58 lines
2.0 KiB
Java
58 lines
2.0 KiB
Java
|
package org.bouncycastle.asn1.x509;
|
||
|
|
||
|
import org.bouncycastle.asn1.ASN1Choice;
|
||
|
import org.bouncycastle.asn1.ASN1Object;
|
||
|
import org.bouncycastle.asn1.ASN1Primitive;
|
||
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
||
|
import org.bouncycastle.asn1.DERTaggedObject;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class Target extends ASN1Object implements ASN1Choice {
|
||
|
public static final int targetGroup = 1;
|
||
|
public static final int targetName = 0;
|
||
|
private GeneralName targGroup;
|
||
|
private GeneralName targName;
|
||
|
|
||
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
||
|
public ASN1Primitive toASN1Primitive() {
|
||
|
return this.targName != null ? new DERTaggedObject(true, 0, this.targName) : new DERTaggedObject(true, 1, this.targGroup);
|
||
|
}
|
||
|
|
||
|
public GeneralName getTargetName() {
|
||
|
return this.targName;
|
||
|
}
|
||
|
|
||
|
public GeneralName getTargetGroup() {
|
||
|
return this.targGroup;
|
||
|
}
|
||
|
|
||
|
public static Target getInstance(Object obj) {
|
||
|
if (obj == null || (obj instanceof Target)) {
|
||
|
return (Target) obj;
|
||
|
}
|
||
|
if (obj instanceof ASN1TaggedObject) {
|
||
|
return new Target((ASN1TaggedObject) obj);
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("unknown object in factory: ");
|
||
|
sb.append(obj.getClass());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
|
||
|
private Target(ASN1TaggedObject aSN1TaggedObject) {
|
||
|
int tagNo = aSN1TaggedObject.getTagNo();
|
||
|
if (tagNo == 0) {
|
||
|
this.targName = GeneralName.getInstance(aSN1TaggedObject, true);
|
||
|
} else if (tagNo == 1) {
|
||
|
this.targGroup = GeneralName.getInstance(aSN1TaggedObject, true);
|
||
|
} else {
|
||
|
StringBuilder sb = new StringBuilder("unknown tag: ");
|
||
|
sb.append(aSN1TaggedObject.getTagNo());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Target(int i, GeneralName generalName) {
|
||
|
this(new DERTaggedObject(i, generalName));
|
||
|
}
|
||
|
}
|