what-the-bank/sources/org/bouncycastle/asn1/dvcs/TargetEtcChain.java

139 lines
4.9 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.dvcs;
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.ASN1TaggedObject;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
/* loaded from: classes6.dex */
public class TargetEtcChain extends ASN1Object {
private ASN1Sequence chain;
private PathProcInput pathProcInput;
private CertEtcToken target;
public String toString() {
StringBuffer stringBuffer = new StringBuffer("TargetEtcChain {\n");
StringBuilder sb = new StringBuilder("target: ");
sb.append(this.target);
sb.append("\n");
stringBuffer.append(sb.toString());
if (this.chain != null) {
StringBuilder sb2 = new StringBuilder("chain: ");
sb2.append(this.chain);
sb2.append("\n");
stringBuffer.append(sb2.toString());
}
if (this.pathProcInput != null) {
StringBuilder sb3 = new StringBuilder("pathProcInput: ");
sb3.append(this.pathProcInput);
sb3.append("\n");
stringBuffer.append(sb3.toString());
}
stringBuffer.append("}\n");
return stringBuffer.toString();
}
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.target);
ASN1Sequence aSN1Sequence = this.chain;
if (aSN1Sequence != null) {
aSN1EncodableVector.add(aSN1Sequence);
}
if (this.pathProcInput != null) {
aSN1EncodableVector.add(new DERTaggedObject(false, 0, this.pathProcInput));
}
return new DERSequence(aSN1EncodableVector);
}
public CertEtcToken getTarget() {
return this.target;
}
public PathProcInput getPathProcInput() {
return this.pathProcInput;
}
public CertEtcToken[] getChain() {
ASN1Sequence aSN1Sequence = this.chain;
if (aSN1Sequence != null) {
return CertEtcToken.arrayFromSequence(aSN1Sequence);
}
return null;
}
public static TargetEtcChain getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
}
public static TargetEtcChain getInstance(Object obj) {
if (obj instanceof TargetEtcChain) {
return (TargetEtcChain) obj;
}
if (obj != null) {
return new TargetEtcChain(ASN1Sequence.getInstance(obj));
}
return null;
}
private void extractPathProcInput(ASN1Encodable aSN1Encodable) {
ASN1TaggedObject aSN1TaggedObject = ASN1TaggedObject.getInstance(aSN1Encodable);
if (aSN1TaggedObject.getTagNo() == 0) {
this.pathProcInput = PathProcInput.getInstance(aSN1TaggedObject, false);
} else {
StringBuilder sb = new StringBuilder("Unknown tag encountered: ");
sb.append(aSN1TaggedObject.getTagNo());
throw new IllegalArgumentException(sb.toString());
}
}
public static TargetEtcChain[] arrayFromSequence(ASN1Sequence aSN1Sequence) {
int size = aSN1Sequence.size();
TargetEtcChain[] targetEtcChainArr = new TargetEtcChain[size];
for (int i = 0; i != size; i++) {
targetEtcChainArr[i] = getInstance(aSN1Sequence.getObjectAt(i));
}
return targetEtcChainArr;
}
public TargetEtcChain(CertEtcToken certEtcToken, CertEtcToken[] certEtcTokenArr, PathProcInput pathProcInput) {
this.target = certEtcToken;
if (certEtcTokenArr != null) {
this.chain = new DERSequence(certEtcTokenArr);
}
this.pathProcInput = pathProcInput;
}
public TargetEtcChain(CertEtcToken certEtcToken, CertEtcToken[] certEtcTokenArr) {
this(certEtcToken, certEtcTokenArr, null);
}
public TargetEtcChain(CertEtcToken certEtcToken, PathProcInput pathProcInput) {
this(certEtcToken, null, pathProcInput);
}
public TargetEtcChain(CertEtcToken certEtcToken) {
this(certEtcToken, null, null);
}
private TargetEtcChain(ASN1Sequence aSN1Sequence) {
this.target = CertEtcToken.getInstance(aSN1Sequence.getObjectAt(0));
if (aSN1Sequence.size() > 1) {
ASN1Encodable objectAt = aSN1Sequence.getObjectAt(1);
if (objectAt instanceof ASN1TaggedObject) {
extractPathProcInput(objectAt);
return;
}
this.chain = ASN1Sequence.getInstance(objectAt);
if (aSN1Sequence.size() > 2) {
extractPathProcInput(aSN1Sequence.getObjectAt(2));
}
}
}
}