82 lines
2.8 KiB
Java
82 lines
2.8 KiB
Java
package org.bouncycastle.asn1.x509;
|
|
|
|
import org.bouncycastle.asn1.ASN1EncodableVector;
|
|
import org.bouncycastle.asn1.ASN1Integer;
|
|
import org.bouncycastle.asn1.ASN1UTCTime;
|
|
import org.bouncycastle.asn1.DERSequence;
|
|
import org.bouncycastle.asn1.DERTaggedObject;
|
|
import org.bouncycastle.asn1.x500.X500Name;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class V1TBSCertificateGenerator {
|
|
Time endDate;
|
|
X500Name issuer;
|
|
ASN1Integer serialNumber;
|
|
AlgorithmIdentifier signature;
|
|
Time startDate;
|
|
X500Name subject;
|
|
SubjectPublicKeyInfo subjectPublicKeyInfo;
|
|
DERTaggedObject version = new DERTaggedObject(true, 0, new ASN1Integer(0));
|
|
|
|
public void setSubjectPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo) {
|
|
this.subjectPublicKeyInfo = subjectPublicKeyInfo;
|
|
}
|
|
|
|
public void setSubject(X509Name x509Name) {
|
|
this.subject = X500Name.getInstance(x509Name.toASN1Primitive());
|
|
}
|
|
|
|
public void setSubject(X500Name x500Name) {
|
|
this.subject = x500Name;
|
|
}
|
|
|
|
public void setStartDate(Time time) {
|
|
this.startDate = time;
|
|
}
|
|
|
|
public void setStartDate(ASN1UTCTime aSN1UTCTime) {
|
|
this.startDate = new Time(aSN1UTCTime);
|
|
}
|
|
|
|
public void setSignature(AlgorithmIdentifier algorithmIdentifier) {
|
|
this.signature = algorithmIdentifier;
|
|
}
|
|
|
|
public void setSerialNumber(ASN1Integer aSN1Integer) {
|
|
this.serialNumber = aSN1Integer;
|
|
}
|
|
|
|
public void setIssuer(X509Name x509Name) {
|
|
this.issuer = X500Name.getInstance(x509Name.toASN1Primitive());
|
|
}
|
|
|
|
public void setIssuer(X500Name x500Name) {
|
|
this.issuer = x500Name;
|
|
}
|
|
|
|
public void setEndDate(Time time) {
|
|
this.endDate = time;
|
|
}
|
|
|
|
public void setEndDate(ASN1UTCTime aSN1UTCTime) {
|
|
this.endDate = new Time(aSN1UTCTime);
|
|
}
|
|
|
|
public TBSCertificate generateTBSCertificate() {
|
|
if (this.serialNumber == null || this.signature == null || this.issuer == null || this.startDate == null || this.endDate == null || this.subject == null || this.subjectPublicKeyInfo == null) {
|
|
throw new IllegalStateException("not all mandatory fields set in V1 TBScertificate generator");
|
|
}
|
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
|
aSN1EncodableVector.add(this.serialNumber);
|
|
aSN1EncodableVector.add(this.signature);
|
|
aSN1EncodableVector.add(this.issuer);
|
|
ASN1EncodableVector aSN1EncodableVector2 = new ASN1EncodableVector();
|
|
aSN1EncodableVector2.add(this.startDate);
|
|
aSN1EncodableVector2.add(this.endDate);
|
|
aSN1EncodableVector.add(new DERSequence(aSN1EncodableVector2));
|
|
aSN1EncodableVector.add(this.subject);
|
|
aSN1EncodableVector.add(this.subjectPublicKeyInfo);
|
|
return TBSCertificate.getInstance(new DERSequence(aSN1EncodableVector));
|
|
}
|
|
}
|