1 13 14 package org.ejbca.ui.web.protocol; 15 16 import java.math.BigInteger ; 17 import java.security.cert.Certificate ; 18 import java.util.Collection ; 19 20 import javax.ejb.EJBException ; 21 import javax.servlet.ServletConfig ; 22 import javax.servlet.ServletException ; 23 24 import org.ejbca.core.ejb.ServiceLocator; 25 import org.ejbca.core.ejb.ca.sign.ISignSessionLocal; 26 import org.ejbca.core.ejb.ca.sign.ISignSessionLocalHome; 27 import org.ejbca.core.ejb.ca.store.ICertificateStoreSessionLocal; 28 import org.ejbca.core.ejb.ca.store.ICertificateStoreSessionLocalHome; 29 import org.ejbca.core.model.ca.caadmin.CADoesntExistsException; 30 import org.ejbca.core.model.ca.caadmin.extendedcaservices.ExtendedCAServiceNotActiveException; 31 import org.ejbca.core.model.ca.caadmin.extendedcaservices.ExtendedCAServiceRequestException; 32 import org.ejbca.core.model.ca.caadmin.extendedcaservices.IllegalExtendedCAServiceRequestException; 33 import org.ejbca.core.model.ca.caadmin.extendedcaservices.OCSPCAServiceRequest; 34 import org.ejbca.core.model.ca.caadmin.extendedcaservices.OCSPCAServiceResponse; 35 import org.ejbca.core.model.ca.crl.RevokedCertInfo; 36 import org.ejbca.core.model.log.Admin; 37 38 78 public class OCSPServlet extends OCSPServletBase { 79 80 private ICertificateStoreSessionLocal m_certStore = null; 81 private ISignSessionLocal m_signsession = null; 82 83 public void init(ServletConfig config) 84 throws ServletException { 85 super.init(config); 86 } 87 88 private synchronized ICertificateStoreSessionLocal getStoreSession(){ 89 if(m_certStore == null){ 90 try { 91 ICertificateStoreSessionLocalHome storehome = (ICertificateStoreSessionLocalHome)ServiceLocator.getInstance().getLocalHome(ICertificateStoreSessionLocalHome.COMP_NAME); 92 m_certStore = storehome.create(); 93 }catch(Exception e){ 94 throw new EJBException (e); 95 } 96 } 97 return m_certStore; 98 } 99 100 private synchronized ISignSessionLocal getSignSession(){ 101 if(m_signsession == null){ 102 try { 103 ISignSessionLocalHome signhome = (ISignSessionLocalHome)ServiceLocator.getInstance().getLocalHome(ISignSessionLocalHome.COMP_NAME); 104 m_signsession = signhome.create(); 105 }catch(Exception e){ 106 throw new EJBException (e); 107 } 108 } 109 return m_signsession; 110 } 111 112 protected Collection findCertificatesByType(Admin adm, int i, String issuerDN) { 113 return getStoreSession().findCertificatesByType(adm, i, issuerDN); 114 } 115 116 protected Certificate findCertificateByIssuerAndSerno(Admin adm, String issuer, BigInteger serno) { 117 return getStoreSession().findCertificateByIssuerAndSerno(adm, issuer, serno); 118 } 119 120 protected OCSPCAServiceResponse extendedService(Admin adm, int caid, OCSPCAServiceRequest request) throws CADoesntExistsException, ExtendedCAServiceRequestException, IllegalExtendedCAServiceRequestException, ExtendedCAServiceNotActiveException { 121 return (OCSPCAServiceResponse)getSignSession().extendedService(adm, caid, request); 122 } 123 124 protected RevokedCertInfo isRevoked(Admin adm, String name, BigInteger serialNumber) { 125 return getStoreSession().isRevoked(adm, name, serialNumber); 126 } 127 128 protected void loadPrivateKeys(Admin adm) { 129 } 131 } | Popular Tags |