package org.bouncycastle.asn1.x509; 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.DERSequence; /* loaded from: classes6.dex */ public class UserNotice extends ASN1Object { private final DisplayText explicitText; private final NoticeReference noticeRef; @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector(); NoticeReference noticeReference = this.noticeRef; if (noticeReference != null) { aSN1EncodableVector.add(noticeReference); } DisplayText displayText = this.explicitText; if (displayText != null) { aSN1EncodableVector.add(displayText); } return new DERSequence(aSN1EncodableVector); } public NoticeReference getNoticeRef() { return this.noticeRef; } public DisplayText getExplicitText() { return this.explicitText; } public static UserNotice getInstance(Object obj) { if (obj instanceof UserNotice) { return (UserNotice) obj; } if (obj != null) { return new UserNotice(ASN1Sequence.getInstance(obj)); } return null; } public UserNotice(NoticeReference noticeReference, DisplayText displayText) { this.noticeRef = noticeReference; this.explicitText = displayText; } public UserNotice(NoticeReference noticeReference, String str) { this(noticeReference, new DisplayText(str)); } private UserNotice(ASN1Sequence aSN1Sequence) { ASN1Encodable objectAt; if (aSN1Sequence.size() != 2) { if (aSN1Sequence.size() == 1) { if (aSN1Sequence.getObjectAt(0).toASN1Primitive() instanceof ASN1Sequence) { this.noticeRef = NoticeReference.getInstance(aSN1Sequence.getObjectAt(0)); } else { this.noticeRef = null; objectAt = aSN1Sequence.getObjectAt(0); } } else { if (aSN1Sequence.size() != 0) { StringBuilder sb = new StringBuilder("Bad sequence size: "); sb.append(aSN1Sequence.size()); throw new IllegalArgumentException(sb.toString()); } this.noticeRef = null; } this.explicitText = null; return; } this.noticeRef = NoticeReference.getInstance(aSN1Sequence.getObjectAt(0)); objectAt = aSN1Sequence.getObjectAt(1); this.explicitText = DisplayText.getInstance(objectAt); } }