getLogSession().log(admin, cadata.getCAId().intValue(), LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECRL, "Signing CA " + cadata.getSubjectDN() + " is offline.", ctoe);
getLogSession().log(admin, cadata.getCaId().intValue(), LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECRL, "Signing CA " + cadata.getSubjectDN() + " is offline.", ctoe);
    public X509CRL createCRL(Admin admin, int caid, Vector certs) {        debug(">createCRL()");        X509CRL crl = null;        try {            // get CA            CADataLocal cadata = null;            try {                cadata = cadatahome.findByPrimaryKey(new Integer(caid));            } catch (javax.ejb.FinderException fe) {                getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECRL, "Invalid CA Id", fe);                throw new EJBException(fe);            }            CA ca = null;            try {                ca = cadata.getCA();            } catch (java.io.UnsupportedEncodingException uee) {                throw new EJBException(uee);            }            if (ca.getStatus() != SecConst.CA_ACTIVE) {                getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECERTIFICATE, "Signing CA " + cadata.getSubjectDN() + " isn't active.");                throw new EJBException("Signing CA " + cadata.getSubjectDN() + " isn't active.");            }            // Check that CA hasn't expired.            X509Certificate cacert = (X509Certificate) ca.getCACertificate();            try {                cacert.checkValidity();            } catch (CertificateExpiredException e) {                // Signers Certificate has expired.                cadata.setStatus(SecConst.CA_EXPIRED);                getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECRL, "Signing CA " + cadata.getSubjectDN() + " has expired", e);                throw new EJBException("Signing CA " + cadata.getSubjectDN() + " has expired");            } catch (CertificateNotYetValidException e) {                throw new EJBException(e);            }            ICertificateStoreSessionLocal certificateStore = storeHome.create();            // Get number of last CRL and increase by 1            int number = certificateStore.getLastCRLNumber(admin, ca.getSubjectDN()) + 1;            try {                crl = (X509CRL) ca.generateCRL(certs, number);            } catch (CATokenOfflineException ctoe) {                log.error("CA Token is Offline: ", ctoe);                cadata.setStatus(SecConst.CA_OFFLINE);                getLogSession().log(admin, cadata.getCAId().intValue(), LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECRL, "Signing CA " + cadata.getSubjectDN() + " is offline.", ctoe);                throw new EJBException("Signing CA " + cadata.getSubjectDN() + " is offline.");            }            getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_INFO_CREATECRL, "Number :" + number);            // Store CRL in the database            String fingerprint = CertTools.getFingerprintAsString(cacert);            certificateStore.storeCRL(admin, crl.getEncoded(), fingerprint, number);            // Store crl in ca CRL publishers.            IPublisherSessionLocal pub = publishHome.create();            pub.storeCRL(admin, ca.getCRLPublishers(), crl.getEncoded(), fingerprint, number);        } catch (Exception e) {            getLogSession().log(admin, caid, LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_CREATECRL, "");            throw new EJBException(e);        }        debug("<createCRL()");        return crl;    } // createCRL