108 lines
4.2 KiB
Java
108 lines
4.2 KiB
Java
|
package org.bouncycastle.asn1.isismtt.x509;
|
||
|
|
||
|
import java.util.Enumeration;
|
||
|
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.DERPrintableString;
|
||
|
import org.bouncycastle.asn1.DERSequence;
|
||
|
import org.bouncycastle.asn1.DERTaggedObject;
|
||
|
import org.bouncycastle.asn1.x500.DirectoryString;
|
||
|
import org.bouncycastle.asn1.x509.GeneralName;
|
||
|
import org.bouncycastle.asn1.x509.IssuerSerial;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class ProcurationSyntax extends ASN1Object {
|
||
|
private IssuerSerial certRef;
|
||
|
private String country;
|
||
|
private GeneralName thirdPerson;
|
||
|
private DirectoryString typeOfSubstitution;
|
||
|
|
||
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
||
|
public ASN1Primitive toASN1Primitive() {
|
||
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
||
|
if (this.country != null) {
|
||
|
aSN1EncodableVector.add(new DERTaggedObject(true, 1, new DERPrintableString(this.country, true)));
|
||
|
}
|
||
|
if (this.typeOfSubstitution != null) {
|
||
|
aSN1EncodableVector.add(new DERTaggedObject(true, 2, this.typeOfSubstitution));
|
||
|
}
|
||
|
aSN1EncodableVector.add(this.thirdPerson != null ? new DERTaggedObject(true, 3, this.thirdPerson) : new DERTaggedObject(true, 3, this.certRef));
|
||
|
return new DERSequence(aSN1EncodableVector);
|
||
|
}
|
||
|
|
||
|
public DirectoryString getTypeOfSubstitution() {
|
||
|
return this.typeOfSubstitution;
|
||
|
}
|
||
|
|
||
|
public GeneralName getThirdPerson() {
|
||
|
return this.thirdPerson;
|
||
|
}
|
||
|
|
||
|
public String getCountry() {
|
||
|
return this.country;
|
||
|
}
|
||
|
|
||
|
public IssuerSerial getCertRef() {
|
||
|
return this.certRef;
|
||
|
}
|
||
|
|
||
|
public static ProcurationSyntax getInstance(Object obj) {
|
||
|
if (obj == null || (obj instanceof ProcurationSyntax)) {
|
||
|
return (ProcurationSyntax) obj;
|
||
|
}
|
||
|
if (obj instanceof ASN1Sequence) {
|
||
|
return new ProcurationSyntax((ASN1Sequence) obj);
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("illegal object in getInstance: ");
|
||
|
sb.append(obj.getClass().getName());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
|
||
|
private ProcurationSyntax(ASN1Sequence aSN1Sequence) {
|
||
|
if (aSN1Sequence.size() <= 0 || aSN1Sequence.size() > 3) {
|
||
|
StringBuilder sb = new StringBuilder("Bad sequence size: ");
|
||
|
sb.append(aSN1Sequence.size());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
Enumeration objects = aSN1Sequence.getObjects();
|
||
|
while (objects.hasMoreElements()) {
|
||
|
ASN1TaggedObject aSN1TaggedObject = ASN1TaggedObject.getInstance(objects.nextElement());
|
||
|
int tagNo = aSN1TaggedObject.getTagNo();
|
||
|
if (tagNo == 1) {
|
||
|
this.country = DERPrintableString.getInstance(aSN1TaggedObject, true).getString();
|
||
|
} else if (tagNo == 2) {
|
||
|
this.typeOfSubstitution = DirectoryString.getInstance(aSN1TaggedObject, true);
|
||
|
} else {
|
||
|
if (tagNo != 3) {
|
||
|
StringBuilder sb2 = new StringBuilder("Bad tag number: ");
|
||
|
sb2.append(aSN1TaggedObject.getTagNo());
|
||
|
throw new IllegalArgumentException(sb2.toString());
|
||
|
}
|
||
|
ASN1Primitive object = aSN1TaggedObject.getObject();
|
||
|
if (object instanceof ASN1TaggedObject) {
|
||
|
this.thirdPerson = GeneralName.getInstance(object);
|
||
|
} else {
|
||
|
this.certRef = IssuerSerial.getInstance(object);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public ProcurationSyntax(String str, DirectoryString directoryString, IssuerSerial issuerSerial) {
|
||
|
this.country = str;
|
||
|
this.typeOfSubstitution = directoryString;
|
||
|
this.thirdPerson = null;
|
||
|
this.certRef = issuerSerial;
|
||
|
}
|
||
|
|
||
|
public ProcurationSyntax(String str, DirectoryString directoryString, GeneralName generalName) {
|
||
|
this.country = str;
|
||
|
this.typeOfSubstitution = directoryString;
|
||
|
this.thirdPerson = generalName;
|
||
|
this.certRef = null;
|
||
|
}
|
||
|
}
|