package org.bouncycastle.asn1.cms; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.BERSequence; import org.bouncycastle.asn1.BERTaggedObject; /* loaded from: classes6.dex */ public class ContentInfo extends ASN1Object implements CMSObjectIdentifiers { private ASN1Encodable content; private ASN1ObjectIdentifier contentType; @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector(); aSN1EncodableVector.add(this.contentType); ASN1Encodable aSN1Encodable = this.content; if (aSN1Encodable != null) { aSN1EncodableVector.add(new BERTaggedObject(0, aSN1Encodable)); } return new BERSequence(aSN1EncodableVector); } public ASN1ObjectIdentifier getContentType() { return this.contentType; } public ASN1Encodable getContent() { return this.content; } public static ContentInfo getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) { return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z)); } public static ContentInfo getInstance(Object obj) { if (obj instanceof ContentInfo) { return (ContentInfo) obj; } if (obj != null) { return new ContentInfo(ASN1Sequence.getInstance(obj)); } return null; } public ContentInfo(ASN1Sequence aSN1Sequence) { if (aSN1Sequence.size() <= 0 || aSN1Sequence.size() > 2) { StringBuilder sb = new StringBuilder("Bad sequence size: "); sb.append(aSN1Sequence.size()); throw new IllegalArgumentException(sb.toString()); } this.contentType = (ASN1ObjectIdentifier) aSN1Sequence.getObjectAt(0); if (aSN1Sequence.size() > 1) { ASN1TaggedObject aSN1TaggedObject = (ASN1TaggedObject) aSN1Sequence.getObjectAt(1); if (!aSN1TaggedObject.isExplicit() || aSN1TaggedObject.getTagNo() != 0) { throw new IllegalArgumentException("Bad tag for 'content'"); } this.content = aSN1TaggedObject.getObject(); } } public ContentInfo(ASN1ObjectIdentifier aSN1ObjectIdentifier, ASN1Encodable aSN1Encodable) { this.contentType = aSN1ObjectIdentifier; this.content = aSN1Encodable; } }