📄 createcrlsessionbean.java
字号:
/************************************************************************* * * * EJBCA: The OpenSource Certificate Authority * * * * This software is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or any later version. * * * * See terms of license at gnu.org. * * * *************************************************************************/package org.ejbca.core.ejb.ca.crl;import java.math.BigInteger;import java.security.cert.X509CRL;import java.util.Collection;import java.util.Date;import java.util.Iterator;import java.util.Vector;import javax.ejb.CreateException;import javax.ejb.EJBException;import org.ejbca.core.ejb.BaseSessionBean;import org.ejbca.core.ejb.ca.caadmin.ICAAdminSessionLocal;import org.ejbca.core.ejb.ca.caadmin.ICAAdminSessionLocalHome;import org.ejbca.core.ejb.ca.sign.ISignSessionLocal;import org.ejbca.core.ejb.ca.sign.ISignSessionLocalHome;import org.ejbca.core.ejb.ca.store.CertificateDataBean;import org.ejbca.core.ejb.ca.store.CertificateDataLocal;import org.ejbca.core.ejb.ca.store.CertificateDataLocalHome;import org.ejbca.core.ejb.ca.store.CertificateDataPK;import org.ejbca.core.ejb.ca.store.ICertificateStoreSessionLocal;import org.ejbca.core.ejb.ca.store.ICertificateStoreSessionLocalHome;import org.ejbca.core.ejb.log.ILogSessionLocal;import org.ejbca.core.ejb.log.ILogSessionLocalHome;import org.ejbca.core.model.InternalResources;import org.ejbca.core.model.SecConst;import org.ejbca.core.model.ca.caadmin.CADoesntExistsException;import org.ejbca.core.model.ca.caadmin.CAInfo;import org.ejbca.core.model.ca.caadmin.X509CAInfo;import org.ejbca.core.model.ca.catoken.CATokenOfflineException;import org.ejbca.core.model.ca.crl.RevokedCertInfo;import org.ejbca.core.model.ca.store.CRLInfo;import org.ejbca.core.model.log.Admin;import org.ejbca.core.model.log.LogEntry;import org.ejbca.util.CertTools;/** * Generates a new CRL by looking in the database for revoked certificates and * generating a CRL. * * @version $Id: CreateCRLSessionBean.java,v 1.15 2007/01/16 11:42:23 anatom Exp $ * @ejb.bean * description="Session bean handling hard token data, both about hard tokens and hard token issuers." * display-name="CreateCRLSB" * name="CreateCRLSession" * jndi-name="CreateCRLSession" * local-jndi-name="CreateCRLSessionLocal" * view-type="both" * type="Stateless" * transaction-type="Container" * * @ejb.transaction type="Required" * * @weblogic.enable-call-by-reference True * * @ejb.home * extends="javax.ejb.EJBHome" * local-extends="javax.ejb.EJBLocalHome" * local-class="org.ejbca.core.ejb.ca.crl.ICreateCRLSessionLocalHome" * remote-class="org.ejbca.core.ejb.ca.crl.ICreateCRLSessionHome" * * @ejb.interface * extends="javax.ejb.EJBObject" * local-extends="javax.ejb.EJBLocalObject" * local-class="org.ejbca.core.ejb.ca.crl.ICreateCRLSessionLocal" * remote-class="org.ejbca.core.ejb.ca.crl.ICreateCRLSessionRemote" * * @ejb.ejb-external-ref * description="The log session bean" * view-type="local" * ref-name="ejb/LogSessionLocal" * type="Session" * home="org.ejbca.core.ejb.log.ILogSessionLocalHome" * business="org.ejbca.core.ejb.log.ILogSessionLocal" * link="LogSession" * * @ejb.ejb-external-ref * description="The Certificate entity bean used manipulate certificates" * view-type="local" * ref-name="ejb/CertificateDataLocal" * type="Entity" * home="org.ejbca.core.ejb.ca.store.CertificateDataLocalHome" * business="org.ejbca.core.ejb.ca.store.CertificateDataLocal" * link="CertificateData" * * @ejb.ejb-external-ref * description="The CA Admin Session" * view-type="local" * ref-name="ejb/CAAdminSessionLocal" * type="Session" * home="org.ejbca.core.ejb.ca.caadmin.ICAAdminSessionLocalHome" * business="org.ejbca.core.ejb.ca.caadmin.ICAAdminSessionLocal" * link="CAAdminSession" * * @ejb.ejb-external-ref * description="The Certificate Store session bean" * view-type="local" * ref-name="ejb/CertificateStoreSessionLocal" * type="Session" * home="org.ejbca.core.ejb.ca.store.ICertificateStoreSessionLocalHome" * business="org.ejbca.core.ejb.ca.store.ICertificateStoreSessionLocal" * link="CertificateStoreSession" * * @ejb.ejb-external-ref * description="The signing session used to create CRL" * view-type="local" * ref-name="ejb/RSASignSessionLocal" * type="Session" * home="org.ejbca.core.ejb.ca.sign.ISignSessionLocalHome" * business="org.ejbca.core.ejb.ca.sign.ISignSessionLocal" * link="RSASignSession" * */public class CreateCRLSessionBean extends BaseSessionBean { /** Internal localization of logs and errors */ private static final InternalResources intres = InternalResources.getInstance(); /** The local home interface of Certificate store */ private ICertificateStoreSessionLocalHome storeHome = null; /** The local home interface of Certificate entity bean */ private CertificateDataLocalHome certHome = null; /** The local home interface of the signing session */ private ISignSessionLocalHome signHome = null; /** The local home interface of the caadmin session */ private ICAAdminSessionLocalHome caadminHome = null; /** The local interface of the log session bean */ private ILogSessionLocal logsession; /** Default create for SessionBean without any creation Arguments. * @throws CreateException if bean instance can't be created */ public void ejbCreate () throws CreateException { caadminHome = (ICAAdminSessionLocalHome)getLocator().getLocalHome(ICAAdminSessionLocalHome.COMP_NAME); storeHome = (ICertificateStoreSessionLocalHome)getLocator().getLocalHome(ICertificateStoreSessionLocalHome.COMP_NAME); certHome = (CertificateDataLocalHome)getLocator().getLocalHome(CertificateDataLocalHome.COMP_NAME); signHome = (ISignSessionLocalHome)getLocator().getLocalHome(ISignSessionLocalHome.COMP_NAME); ILogSessionLocalHome logsessionhome = (ILogSessionLocalHome) getLocator().getLocalHome(ILogSessionLocalHome.COMP_NAME); logsession = logsessionhome.create(); } /** * Generates a new CRL by looking in the database for revoked certificates and generating a * CRL. * * @param admin administrator performing the task * @param issuerdn of the ca (normalized for EJBCA) * * @throws EJBException om ett kommunikations eller systemfel intr?ffar. * @ejb.interface-method */ public void run(Admin admin, String issuerdn) throws CATokenOfflineException { debug(">run()"); int caid = issuerdn.hashCode(); try { ICAAdminSessionLocal caadmin = caadminHome.create(); ICertificateStoreSessionLocal store = storeHome.create(); CAInfo cainfo = caadmin.getCAInfo(admin, caid); if (cainfo == null) { throw new CADoesntExistsException("CA not found: "+issuerdn); } int crlperiod = cainfo.getCRLPeriod(); // Find all revoked certificates
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -