package org.bouncycastle.asn1.dvcs; import java.io.IOException; import org.bouncycastle.asn1.ASN1Choice; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DERTaggedObject; /* loaded from: classes6.dex */ public class DVCSResponse extends ASN1Object implements ASN1Choice { private DVCSCertInfo dvCertInfo; private DVCSErrorNotice dvErrorNote; public String toString() { StringBuilder sb; Object obj; if (this.dvCertInfo != null) { sb = new StringBuilder("DVCSResponse {\ndvCertInfo: "); obj = this.dvCertInfo; } else { sb = new StringBuilder("DVCSResponse {\ndvErrorNote: "); obj = this.dvErrorNote; } sb.append(obj.toString()); sb.append("}\n"); return sb.toString(); } @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { DVCSCertInfo dVCSCertInfo = this.dvCertInfo; return dVCSCertInfo != null ? dVCSCertInfo.toASN1Primitive() : new DERTaggedObject(false, 0, this.dvErrorNote); } public DVCSErrorNotice getErrorNotice() { return this.dvErrorNote; } public DVCSCertInfo getCertInfo() { return this.dvCertInfo; } public static DVCSResponse getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) { return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z)); } public static DVCSResponse getInstance(Object obj) { if (obj == null || (obj instanceof DVCSResponse)) { return (DVCSResponse) obj; } if (obj instanceof byte[]) { try { return getInstance(ASN1Primitive.fromByteArray((byte[]) obj)); } catch (IOException e) { StringBuilder sb = new StringBuilder("failed to construct sequence from byte[]: "); sb.append(e.getMessage()); throw new IllegalArgumentException(sb.toString()); } } if (obj instanceof ASN1Sequence) { return new DVCSResponse(DVCSCertInfo.getInstance(obj)); } if (obj instanceof ASN1TaggedObject) { return new DVCSResponse(DVCSErrorNotice.getInstance(ASN1TaggedObject.getInstance(obj), false)); } StringBuilder sb2 = new StringBuilder("Couldn't convert from object to DVCSResponse: "); sb2.append(obj.getClass().getName()); throw new IllegalArgumentException(sb2.toString()); } public DVCSResponse(DVCSErrorNotice dVCSErrorNotice) { this.dvErrorNote = dVCSErrorNotice; } public DVCSResponse(DVCSCertInfo dVCSCertInfo) { this.dvCertInfo = dVCSCertInfo; } }