return (X509CRL)crl;
return crl;
    public CRL generateCRL(Vector certs, int crlnumber) throws Exception {        final String sigAlg= getCAToken().getCATokenInfo().getSignatureAlgorithm();        Date thisUpdate = new Date();        Date nextUpdate = new Date();        // crlperiod is hours = crlperiod*60*60*1000 milliseconds        nextUpdate.setTime(nextUpdate.getTime() + (getCRLPeriod() * (long)(60 * 60 * 1000)));        X509V2CRLGenerator crlgen = new X509V2CRLGenerator();        crlgen.setThisUpdate(thisUpdate);        crlgen.setNextUpdate(nextUpdate);        crlgen.setSignatureAlgorithm(sigAlg);        // Make DNs        X509Name caname = new X509Name(getSubjectDN());        crlgen.setIssuerDN(caname);        if (certs != null) {                        Iterator it = certs.iterator();            while( it.hasNext() ) {                RevokedCertInfo certinfo = (RevokedCertInfo)it.next();                crlgen.addCRLEntry(certinfo.getUserCertificate(), certinfo.getRevocationDate(), certinfo.getReason());            }        }        // Authority key identifier        if (getUseAuthorityKeyIdentifier() == true) {            SubjectPublicKeyInfo apki = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(                new ByteArrayInputStream(getCAToken().getPublicKey(SecConst.CAKEYPURPOSE_CRLSIGN).getEncoded())).readObject());            AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(apki);            crlgen.addExtension(X509Extensions.AuthorityKeyIdentifier.getId(), getAuthorityKeyIdentifierCritical(), aki);        }        // CRLNumber extension        if (getUseCRLNumber() == true) {            CRLNumber crlnum = new CRLNumber(BigInteger.valueOf(crlnumber));            crlgen.addExtension(X509Extensions.CRLNumber.getId(),  this.getCRLNumberCritical(), crlnum);        }                X509CRL crl;        try{        	crl = crlgen.generateX509CRL(getCAToken().getPrivateKey(SecConst.CAKEYPURPOSE_CRLSIGN),getCAToken().getProvider());        }catch(CATokenOfflineException e){        	this.setStatus(SecConst.CA_OFFLINE);        	throw e;         }                                // Verify before sending back        crl.verify(getCAToken().getPublicKey(SecConst.CAKEYPURPOSE_CRLSIGN));        return (X509CRL)crl;            }    