package org.bouncycastle.asn1.dvcs; import org.bouncycastle.asn1.ASN1Choice; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERTaggedObject; import org.bouncycastle.asn1.x509.DigestInfo; /* loaded from: classes6.dex */ public class Data extends ASN1Object implements ASN1Choice { private ASN1Sequence certs; private ASN1OctetString message; private DigestInfo messageImprint; public String toString() { StringBuilder sb; Object obj; if (this.message != null) { sb = new StringBuilder("Data {\n"); obj = this.message; } else if (this.messageImprint != null) { sb = new StringBuilder("Data {\n"); obj = this.messageImprint; } else { sb = new StringBuilder("Data {\n"); obj = this.certs; } sb.append(obj); sb.append("}\n"); return sb.toString(); } @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1OctetString aSN1OctetString = this.message; if (aSN1OctetString != null) { return aSN1OctetString.toASN1Primitive(); } DigestInfo digestInfo = this.messageImprint; return digestInfo != null ? digestInfo.toASN1Primitive() : new DERTaggedObject(false, 0, this.certs); } public DigestInfo getMessageImprint() { return this.messageImprint; } public ASN1OctetString getMessage() { return this.message; } public TargetEtcChain[] getCerts() { ASN1Sequence aSN1Sequence = this.certs; if (aSN1Sequence == null) { return null; } int size = aSN1Sequence.size(); TargetEtcChain[] targetEtcChainArr = new TargetEtcChain[size]; for (int i = 0; i != size; i++) { targetEtcChainArr[i] = TargetEtcChain.getInstance(this.certs.getObjectAt(i)); } return targetEtcChainArr; } public static Data getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) { return getInstance(aSN1TaggedObject.getObject()); } public static Data getInstance(Object obj) { if (obj instanceof Data) { return (Data) obj; } if (obj instanceof ASN1OctetString) { return new Data((ASN1OctetString) obj); } if (obj instanceof ASN1Sequence) { return new Data(DigestInfo.getInstance(obj)); } if (obj instanceof ASN1TaggedObject) { return new Data(ASN1Sequence.getInstance((ASN1TaggedObject) obj, false)); } StringBuilder sb = new StringBuilder("Unknown object submitted to getInstance: "); sb.append(obj.getClass().getName()); throw new IllegalArgumentException(sb.toString()); } public Data(TargetEtcChain[] targetEtcChainArr) { this.certs = new DERSequence(targetEtcChainArr); } public Data(byte[] bArr) { this.message = new DEROctetString(bArr); } public Data(DigestInfo digestInfo) { this.messageImprint = digestInfo; } public Data(TargetEtcChain targetEtcChain) { this.certs = new DERSequence(targetEtcChain); } private Data(ASN1Sequence aSN1Sequence) { this.certs = aSN1Sequence; } public Data(ASN1OctetString aSN1OctetString) { this.message = aSN1OctetString; } }