package org.bouncycastle.asn1.crmf; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Integer; 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 CertRequest extends ASN1Object { private ASN1Integer certReqId; private CertTemplate certTemplate; private Controls controls; @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector(); aSN1EncodableVector.add(this.certReqId); aSN1EncodableVector.add(this.certTemplate); Controls controls = this.controls; if (controls != null) { aSN1EncodableVector.add(controls); } return new DERSequence(aSN1EncodableVector); } public Controls getControls() { return this.controls; } public CertTemplate getCertTemplate() { return this.certTemplate; } public ASN1Integer getCertReqId() { return this.certReqId; } public static CertRequest getInstance(Object obj) { if (obj instanceof CertRequest) { return (CertRequest) obj; } if (obj != null) { return new CertRequest(ASN1Sequence.getInstance(obj)); } return null; } private CertRequest(ASN1Sequence aSN1Sequence) { this.certReqId = new ASN1Integer(ASN1Integer.getInstance(aSN1Sequence.getObjectAt(0)).getValue()); this.certTemplate = CertTemplate.getInstance(aSN1Sequence.getObjectAt(1)); if (aSN1Sequence.size() > 2) { this.controls = Controls.getInstance(aSN1Sequence.getObjectAt(2)); } } public CertRequest(ASN1Integer aSN1Integer, CertTemplate certTemplate, Controls controls) { this.certReqId = aSN1Integer; this.certTemplate = certTemplate; this.controls = controls; } public CertRequest(int i, CertTemplate certTemplate, Controls controls) { this(new ASN1Integer(i), certTemplate, controls); } }