FileDocCategorySizeDatePackage
V2TBSCertListGenerator.javaAPI DocAzureus 3.0.3.45275Tue Jun 08 05:12:56 BST 2004org.bouncycastle.asn1.x509

V2TBSCertListGenerator

public class V2TBSCertListGenerator extends Object
Generator for Version 2 TBSCertList structures.
TBSCertList ::= SEQUENCE {
version Version OPTIONAL,
-- if present, shall be v2
signature AlgorithmIdentifier,
issuer Name,
thisUpdate Time,
nextUpdate Time OPTIONAL,
revokedCertificates SEQUENCE OF SEQUENCE {
userCertificate CertificateSerialNumber,
revocationDate Time,
crlEntryExtensions Extensions OPTIONAL
-- if present, shall be v2
} OPTIONAL,
crlExtensions [0] EXPLICIT Extensions OPTIONAL
-- if present, shall be v2
}
Note: This class may be subject to change

Fields Summary
org.bouncycastle.asn1.DERInteger
version
AlgorithmIdentifier
signature
X509Name
issuer
Time
thisUpdate
Time
nextUpdate
X509Extensions
extensions
private Vector
crlentries
Constructors Summary
public V2TBSCertListGenerator()


     
    
    
Methods Summary
public voidaddCRLEntry(org.bouncycastle.asn1.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: " + 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);
        }

        if (crlentries == null)
        {
            crlentries = new Vector();
        }

        crlentries.addElement(new DERSequence(v));
    
public voidaddCRLEntry(org.bouncycastle.asn1.ASN1Sequence crlEntry)

        if (crlentries == null)
            crlentries = new Vector();
        crlentries.addElement(crlEntry);
    
public voidaddCRLEntry(org.bouncycastle.asn1.DERInteger userCertificate, org.bouncycastle.asn1.DERUTCTime revocationDate, int reason)

        addCRLEntry(userCertificate, new Time(revocationDate), reason);
    
public TBSCertListgenerateTBSCertList()

        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);
        }

        // Add CRLEntries if they exist
        if (crlentries != null)
        {
            ASN1EncodableVector certs = new ASN1EncodableVector();
            Enumeration it = crlentries.elements();
            while( it.hasMoreElements() )
            {
                certs.add((ASN1Sequence)it.nextElement());
            }
            v.add(new DERSequence(certs));
        }

        if (extensions != null)
        {
            v.add(new DERTaggedObject(0, extensions));
        }

        return new TBSCertList(new DERSequence(v));
    
public voidsetExtensions(X509Extensions extensions)

        this.extensions = extensions;
    
public voidsetIssuer(X509Name issuer)

        this.issuer = issuer;
    
public voidsetNextUpdate(org.bouncycastle.asn1.DERUTCTime nextUpdate)

        this.nextUpdate = new Time(nextUpdate);
    
public voidsetNextUpdate(Time nextUpdate)

        this.nextUpdate = nextUpdate;
    
public voidsetSignature(AlgorithmIdentifier signature)

        this.signature = signature;
    
public voidsetThisUpdate(org.bouncycastle.asn1.DERUTCTime thisUpdate)

        this.thisUpdate = new Time(thisUpdate);
    
public voidsetThisUpdate(Time thisUpdate)

        this.thisUpdate = thisUpdate;