package org.bouncycastle.asn1.crmf; import org.bouncycastle.asn1.ASN1Choice; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERTaggedObject; import org.bouncycastle.asn1.cms.EnvelopedData; /* loaded from: classes6.dex */ public class POPOPrivKey extends ASN1Object implements ASN1Choice { public static final int agreeMAC = 3; public static final int dhMAC = 2; public static final int encryptedKey = 4; public static final int subsequentMessage = 1; public static final int thisMessage = 0; private ASN1Encodable obj; private int tagNo; @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { return new DERTaggedObject(false, this.tagNo, this.obj); } public ASN1Encodable getValue() { return this.obj; } public int getType() { return this.tagNo; } public static POPOPrivKey getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) { return getInstance(ASN1TaggedObject.getInstance(aSN1TaggedObject, z)); } public static POPOPrivKey getInstance(Object obj) { if (obj instanceof POPOPrivKey) { return (POPOPrivKey) obj; } if (obj != null) { return new POPOPrivKey(ASN1TaggedObject.getInstance(obj)); } return null; } public POPOPrivKey(SubsequentMessage subsequentMessage2) { this.tagNo = 1; this.obj = subsequentMessage2; } private POPOPrivKey(ASN1TaggedObject aSN1TaggedObject) { ASN1Encodable dERBitString; int tagNo = aSN1TaggedObject.getTagNo(); this.tagNo = tagNo; if (tagNo != 0) { if (tagNo == 1) { dERBitString = SubsequentMessage.valueOf(ASN1Integer.getInstance(aSN1TaggedObject, false).getValue().intValue()); } else if (tagNo != 2) { if (tagNo == 3) { dERBitString = PKMACValue.getInstance(aSN1TaggedObject, false); } else { if (tagNo != 4) { throw new IllegalArgumentException("unknown tag in POPOPrivKey"); } dERBitString = EnvelopedData.getInstance(aSN1TaggedObject, false); } } this.obj = dERBitString; } dERBitString = DERBitString.getInstance(aSN1TaggedObject, false); this.obj = dERBitString; } }