package org.bouncycastle.asn1.dvcs; import org.bouncycastle.asn1.ASN1Encodable; 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.ASN1Set; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERTaggedObject; import org.bouncycastle.asn1.cmp.PKIStatusInfo; import org.bouncycastle.asn1.x509.DigestInfo; import org.bouncycastle.asn1.x509.Extensions; import org.bouncycastle.asn1.x509.PolicyInformation; /* loaded from: classes6.dex */ public class DVCSCertInfo extends ASN1Object { private static final int DEFAULT_VERSION = 1; private static final int TAG_CERTS = 3; private static final int TAG_DV_STATUS = 0; private static final int TAG_POLICY = 1; private static final int TAG_REQ_SIGNATURE = 2; private ASN1Sequence certs; private DVCSRequestInformation dvReqInfo; private PKIStatusInfo dvStatus; private Extensions extensions; private DigestInfo messageImprint; private PolicyInformation policy; private ASN1Set reqSignature; private DVCSTime responseTime; private ASN1Integer serialNumber; private int version; public String toString() { StringBuffer stringBuffer = new StringBuffer("DVCSCertInfo {\n"); if (this.version != 1) { StringBuilder sb = new StringBuilder("version: "); sb.append(this.version); sb.append("\n"); stringBuffer.append(sb.toString()); } StringBuilder sb2 = new StringBuilder("dvReqInfo: "); sb2.append(this.dvReqInfo); sb2.append("\n"); stringBuffer.append(sb2.toString()); StringBuilder sb3 = new StringBuilder("messageImprint: "); sb3.append(this.messageImprint); sb3.append("\n"); stringBuffer.append(sb3.toString()); StringBuilder sb4 = new StringBuilder("serialNumber: "); sb4.append(this.serialNumber); sb4.append("\n"); stringBuffer.append(sb4.toString()); StringBuilder sb5 = new StringBuilder("responseTime: "); sb5.append(this.responseTime); sb5.append("\n"); stringBuffer.append(sb5.toString()); if (this.dvStatus != null) { StringBuilder sb6 = new StringBuilder("dvStatus: "); sb6.append(this.dvStatus); sb6.append("\n"); stringBuffer.append(sb6.toString()); } if (this.policy != null) { StringBuilder sb7 = new StringBuilder("policy: "); sb7.append(this.policy); sb7.append("\n"); stringBuffer.append(sb7.toString()); } if (this.reqSignature != null) { StringBuilder sb8 = new StringBuilder("reqSignature: "); sb8.append(this.reqSignature); sb8.append("\n"); stringBuffer.append(sb8.toString()); } if (this.certs != null) { StringBuilder sb9 = new StringBuilder("certs: "); sb9.append(this.certs); sb9.append("\n"); stringBuffer.append(sb9.toString()); } if (this.extensions != null) { StringBuilder sb10 = new StringBuilder("extensions: "); sb10.append(this.extensions); sb10.append("\n"); stringBuffer.append(sb10.toString()); } stringBuffer.append("}\n"); return stringBuffer.toString(); } @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector(); int i = this.version; if (i != 1) { aSN1EncodableVector.add(new ASN1Integer(i)); } aSN1EncodableVector.add(this.dvReqInfo); aSN1EncodableVector.add(this.messageImprint); aSN1EncodableVector.add(this.serialNumber); aSN1EncodableVector.add(this.responseTime); if (this.dvStatus != null) { aSN1EncodableVector.add(new DERTaggedObject(false, 0, this.dvStatus)); } if (this.policy != null) { aSN1EncodableVector.add(new DERTaggedObject(false, 1, this.policy)); } if (this.reqSignature != null) { aSN1EncodableVector.add(new DERTaggedObject(false, 2, this.reqSignature)); } if (this.certs != null) { aSN1EncodableVector.add(new DERTaggedObject(false, 3, this.certs)); } Extensions extensions = this.extensions; if (extensions != null) { aSN1EncodableVector.add(extensions); } return new DERSequence(aSN1EncodableVector); } public int getVersion() { return this.version; } public ASN1Integer getSerialNumber() { return this.serialNumber; } public DVCSTime getResponseTime() { return this.responseTime; } public ASN1Set getReqSignature() { return this.reqSignature; } public PolicyInformation getPolicy() { return this.policy; } public DigestInfo getMessageImprint() { return this.messageImprint; } public Extensions getExtensions() { return this.extensions; } public PKIStatusInfo getDvStatus() { return this.dvStatus; } public DVCSRequestInformation getDvReqInfo() { return this.dvReqInfo; } public TargetEtcChain[] getCerts() { ASN1Sequence aSN1Sequence = this.certs; if (aSN1Sequence != null) { return TargetEtcChain.arrayFromSequence(aSN1Sequence); } return null; } private void setVersion(int i) { this.version = i; } private void setMessageImprint(DigestInfo digestInfo) { this.messageImprint = digestInfo; } private void setDvReqInfo(DVCSRequestInformation dVCSRequestInformation) { this.dvReqInfo = dVCSRequestInformation; } public static DVCSCertInfo getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) { return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z)); } public static DVCSCertInfo getInstance(Object obj) { if (obj instanceof DVCSCertInfo) { return (DVCSCertInfo) obj; } if (obj != null) { return new DVCSCertInfo(ASN1Sequence.getInstance(obj)); } return null; } public DVCSCertInfo(DVCSRequestInformation dVCSRequestInformation, DigestInfo digestInfo, ASN1Integer aSN1Integer, DVCSTime dVCSTime) { this.version = 1; this.dvReqInfo = dVCSRequestInformation; this.messageImprint = digestInfo; this.serialNumber = aSN1Integer; this.responseTime = dVCSTime; } private DVCSCertInfo(ASN1Sequence aSN1Sequence) { int i; this.version = 1; ASN1Encodable objectAt = aSN1Sequence.getObjectAt(0); try { this.version = ASN1Integer.getInstance(objectAt).getValue().intValue(); try { objectAt = aSN1Sequence.getObjectAt(1); } catch (IllegalArgumentException unused) { } i = 2; } catch (IllegalArgumentException unused2) { i = 1; } this.dvReqInfo = DVCSRequestInformation.getInstance(objectAt); this.messageImprint = DigestInfo.getInstance(aSN1Sequence.getObjectAt(i)); this.serialNumber = ASN1Integer.getInstance(aSN1Sequence.getObjectAt(i + 1)); this.responseTime = DVCSTime.getInstance(aSN1Sequence.getObjectAt(i + 2)); for (int i2 = i + 3; i2 < aSN1Sequence.size(); i2++) { ASN1Encodable objectAt2 = aSN1Sequence.getObjectAt(i2); if (objectAt2 instanceof ASN1TaggedObject) { ASN1TaggedObject aSN1TaggedObject = ASN1TaggedObject.getInstance(objectAt2); int tagNo = aSN1TaggedObject.getTagNo(); if (tagNo == 0) { this.dvStatus = PKIStatusInfo.getInstance(aSN1TaggedObject, false); } else if (tagNo == 1) { this.policy = PolicyInformation.getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, false)); } else if (tagNo == 2) { this.reqSignature = ASN1Set.getInstance(aSN1TaggedObject, false); } else { if (tagNo != 3) { throw new IllegalArgumentException("Unknown tag encountered: ".concat(String.valueOf(tagNo))); } this.certs = ASN1Sequence.getInstance(aSN1TaggedObject, false); } } else { try { this.extensions = Extensions.getInstance(objectAt2); } catch (IllegalArgumentException unused3) { } } } } }