package org.bouncycastle.asn1.crmf; import org.bouncycastle.asn1.ASN1Choice; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DERNull; import org.bouncycastle.asn1.DERTaggedObject; /* loaded from: classes6.dex */ public class ProofOfPossession extends ASN1Object implements ASN1Choice { public static final int TYPE_KEY_AGREEMENT = 3; public static final int TYPE_KEY_ENCIPHERMENT = 2; public static final int TYPE_RA_VERIFIED = 0; public static final int TYPE_SIGNING_KEY = 1; 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 int getType() { return this.tagNo; } public ASN1Encodable getObject() { return this.obj; } public static ProofOfPossession getInstance(Object obj) { if (obj == null || (obj instanceof ProofOfPossession)) { return (ProofOfPossession) obj; } if (obj instanceof ASN1TaggedObject) { return new ProofOfPossession((ASN1TaggedObject) obj); } StringBuilder sb = new StringBuilder("Invalid object: "); sb.append(obj.getClass().getName()); throw new IllegalArgumentException(sb.toString()); } public ProofOfPossession(POPOSigningKey pOPOSigningKey) { this.tagNo = 1; this.obj = pOPOSigningKey; } private ProofOfPossession(ASN1TaggedObject aSN1TaggedObject) { ASN1Encodable aSN1Encodable; int tagNo = aSN1TaggedObject.getTagNo(); this.tagNo = tagNo; if (tagNo == 0) { aSN1Encodable = DERNull.INSTANCE; } else if (tagNo == 1) { aSN1Encodable = POPOSigningKey.getInstance(aSN1TaggedObject, false); } else { if (tagNo != 2 && tagNo != 3) { StringBuilder sb = new StringBuilder("unknown tag: "); sb.append(this.tagNo); throw new IllegalArgumentException(sb.toString()); } aSN1Encodable = POPOPrivKey.getInstance(aSN1TaggedObject, true); } this.obj = aSN1Encodable; } public ProofOfPossession(int i, POPOPrivKey pOPOPrivKey) { this.tagNo = i; this.obj = pOPOPrivKey; } public ProofOfPossession() { this.tagNo = 0; this.obj = DERNull.INSTANCE; } }