what-the-bank/sources/org/bouncycastle/asn1/cmp/CertRepMessage.java

85 lines
3.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.cmp;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
/* loaded from: classes6.dex */
public class CertRepMessage extends ASN1Object {
private ASN1Sequence caPubs;
private ASN1Sequence response;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
if (this.caPubs != null) {
aSN1EncodableVector.add(new DERTaggedObject(true, 1, this.caPubs));
}
aSN1EncodableVector.add(this.response);
return new DERSequence(aSN1EncodableVector);
}
public CertResponse[] getResponse() {
int size = this.response.size();
CertResponse[] certResponseArr = new CertResponse[size];
for (int i = 0; i != size; i++) {
certResponseArr[i] = CertResponse.getInstance(this.response.getObjectAt(i));
}
return certResponseArr;
}
public CMPCertificate[] getCaPubs() {
ASN1Sequence aSN1Sequence = this.caPubs;
if (aSN1Sequence == null) {
return null;
}
int size = aSN1Sequence.size();
CMPCertificate[] cMPCertificateArr = new CMPCertificate[size];
for (int i = 0; i != size; i++) {
cMPCertificateArr[i] = CMPCertificate.getInstance(this.caPubs.getObjectAt(i));
}
return cMPCertificateArr;
}
public static CertRepMessage getInstance(Object obj) {
if (obj instanceof CertRepMessage) {
return (CertRepMessage) obj;
}
if (obj != null) {
return new CertRepMessage(ASN1Sequence.getInstance(obj));
}
return null;
}
public CertRepMessage(CMPCertificate[] cMPCertificateArr, CertResponse[] certResponseArr) {
if (certResponseArr == null) {
throw new IllegalArgumentException("'response' cannot be null");
}
if (cMPCertificateArr != null) {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
for (CMPCertificate cMPCertificate : cMPCertificateArr) {
aSN1EncodableVector.add(cMPCertificate);
}
this.caPubs = new DERSequence(aSN1EncodableVector);
}
ASN1EncodableVector aSN1EncodableVector2 = new ASN1EncodableVector();
for (CertResponse certResponse : certResponseArr) {
aSN1EncodableVector2.add(certResponse);
}
this.response = new DERSequence(aSN1EncodableVector2);
}
private CertRepMessage(ASN1Sequence aSN1Sequence) {
int i = 0;
if (aSN1Sequence.size() > 1) {
this.caPubs = ASN1Sequence.getInstance((ASN1TaggedObject) aSN1Sequence.getObjectAt(0), true);
i = 1;
}
this.response = ASN1Sequence.getInstance(aSN1Sequence.getObjectAt(i));
}
}