what-the-bank/sources/org/bouncycastle/asn1/x509/TBSCertificate.java

125 lines
4.0 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.x509;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERBitString;
import org.bouncycastle.asn1.x500.X500Name;
/* loaded from: classes6.dex */
public class TBSCertificate extends ASN1Object {
Time endDate;
Extensions extensions;
X500Name issuer;
DERBitString issuerUniqueId;
ASN1Sequence seq;
ASN1Integer serialNumber;
AlgorithmIdentifier signature;
Time startDate;
X500Name subject;
SubjectPublicKeyInfo subjectPublicKeyInfo;
DERBitString subjectUniqueId;
ASN1Integer version;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
return this.seq;
}
public int getVersionNumber() {
return this.version.getValue().intValue() + 1;
}
public ASN1Integer getVersion() {
return this.version;
}
public DERBitString getSubjectUniqueId() {
return this.subjectUniqueId;
}
public SubjectPublicKeyInfo getSubjectPublicKeyInfo() {
return this.subjectPublicKeyInfo;
}
public X500Name getSubject() {
return this.subject;
}
public Time getStartDate() {
return this.startDate;
}
public AlgorithmIdentifier getSignature() {
return this.signature;
}
public ASN1Integer getSerialNumber() {
return this.serialNumber;
}
public DERBitString getIssuerUniqueId() {
return this.issuerUniqueId;
}
public X500Name getIssuer() {
return this.issuer;
}
public Extensions getExtensions() {
return this.extensions;
}
public Time getEndDate() {
return this.endDate;
}
public static TBSCertificate getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
}
public static TBSCertificate getInstance(Object obj) {
if (obj instanceof TBSCertificate) {
return (TBSCertificate) obj;
}
if (obj != null) {
return new TBSCertificate(ASN1Sequence.getInstance(obj));
}
return null;
}
private TBSCertificate(ASN1Sequence aSN1Sequence) {
int i;
this.seq = aSN1Sequence;
if (aSN1Sequence.getObjectAt(0) instanceof ASN1TaggedObject) {
this.version = ASN1Integer.getInstance((ASN1TaggedObject) aSN1Sequence.getObjectAt(0), true);
i = 0;
} else {
this.version = new ASN1Integer(0L);
i = -1;
}
this.serialNumber = ASN1Integer.getInstance(aSN1Sequence.getObjectAt(i + 1));
this.signature = AlgorithmIdentifier.getInstance(aSN1Sequence.getObjectAt(i + 2));
this.issuer = X500Name.getInstance(aSN1Sequence.getObjectAt(i + 3));
ASN1Sequence aSN1Sequence2 = (ASN1Sequence) aSN1Sequence.getObjectAt(i + 4);
this.startDate = Time.getInstance(aSN1Sequence2.getObjectAt(0));
this.endDate = Time.getInstance(aSN1Sequence2.getObjectAt(1));
this.subject = X500Name.getInstance(aSN1Sequence.getObjectAt(i + 5));
int i2 = i + 6;
this.subjectPublicKeyInfo = SubjectPublicKeyInfo.getInstance(aSN1Sequence.getObjectAt(i2));
for (int size = (aSN1Sequence.size() - i2) - 1; size > 0; size--) {
ASN1TaggedObject aSN1TaggedObject = (ASN1TaggedObject) aSN1Sequence.getObjectAt(i2 + size);
int tagNo = aSN1TaggedObject.getTagNo();
if (tagNo == 1) {
this.issuerUniqueId = DERBitString.getInstance(aSN1TaggedObject, false);
} else if (tagNo == 2) {
this.subjectUniqueId = DERBitString.getInstance(aSN1TaggedObject, false);
} else if (tagNo == 3) {
this.extensions = Extensions.getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, true));
}
}
}
}