📄 v2tbscertlistgenerator.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: V2TBSCertListGenerator.java
package jit.asn1.x509;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import jit.asn1.*;
// Referenced classes of package jit.asn1.x509:
// Time, CRLReason, X509Extensions, TBSCertList,
// AlgorithmIdentifier, X509Name
public class V2TBSCertListGenerator
{
DERInteger version;
AlgorithmIdentifier signature;
X509Name issuer;
Time thisUpdate;
Time nextUpdate;
X509Extensions extensions;
private ASN1Sequence crlentries;
public V2TBSCertListGenerator()
{
version = new DERInteger(1);
nextUpdate = null;
extensions = null;
crlentries = null;
}
public void setSignature(AlgorithmIdentifier signature)
{
this.signature = signature;
}
public void setIssuer(X509Name issuer)
{
this.issuer = issuer;
}
public void setThisUpdate(DERUTCTime thisUpdate)
{
this.thisUpdate = new Time(thisUpdate);
}
public void setNextUpdate(DERUTCTime nextUpdate)
{
this.nextUpdate = new Time(nextUpdate);
}
public void setThisUpdate(Time thisUpdate)
{
this.thisUpdate = thisUpdate;
}
public void setNextUpdate(Time nextUpdate)
{
this.nextUpdate = nextUpdate;
}
public void addCRLEntry(ASN1Sequence crlEntry)
{
crlentries = crlEntry;
}
public void addCRLEntry(DERInteger userCertificate, DERUTCTime revocationDate, int reason)
{
addCRLEntry(userCertificate, new Time(revocationDate), reason);
}
public void addCRLEntry(DERInteger userCertificate, Time revocationDate, int reason)
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(userCertificate);
v.add(revocationDate);
if(reason != 0)
{
CRLReason rf = new CRLReason(reason);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
DEROutputStream dOut = new DEROutputStream(bOut);
try
{
dOut.writeObject(rf);
}
catch(IOException e)
{
throw new IllegalArgumentException("error encoding value: ".concat(String.valueOf(String.valueOf(e))));
}
byte value[] = bOut.toByteArray();
ASN1EncodableVector v1 = new ASN1EncodableVector();
v1.add(X509Extensions.ReasonCode);
v1.add(new DEROctetString(value));
X509Extensions ex = new X509Extensions(new DERSequence(new DERSequence(v1)));
v.add(ex);
}
crlentries = new DERSequence(v);
}
public void setExtensions(X509Extensions extensions)
{
this.extensions = extensions;
}
public TBSCertList generateTBSCertList()
{
if(signature == null || issuer == null || thisUpdate == null)
throw new IllegalStateException("Not all mandatory fields set in V2 TBSCertList generator.");
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(version);
v.add(signature);
v.add(issuer);
v.add(thisUpdate);
if(nextUpdate != null)
v.add(nextUpdate);
if(crlentries != null)
v.add(crlentries);
if(extensions != null)
v.add(new DERTaggedObject(0, extensions));
return new TBSCertList(new DERSequence(v));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -