Package org.ejbca.core.model.ca.catoken

Examples of org.ejbca.core.model.ca.catoken.CATokenOfflineException


        byte[] crlBytes = null; // return value
        try {
            if ( (ca.getStatus() != SecConst.CA_ACTIVE) && (ca.getStatus() != SecConst.CA_WAITING_CERTIFICATE_RESPONSE) ) {
                String msg = intres.getLocalizedMessage("signsession.canotactive", ca.getSubjectDN());
                logSession.log(admin, ca.getCAId(), LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_CREATECERTIFICATE, msg);
                throw new CATokenOfflineException(msg);
            }
            final X509CRL crl;
            final String certSubjectDN = CertTools.getSubjectDN(ca.getCACertificate());
            int fullnumber = crlSession.getLastCRLNumber(admin, certSubjectDN, false);
            int deltanumber = crlSession.getLastCRLNumber(admin, certSubjectDN, true);
View Full Code Here


                    while ( true ) {
                        slot = slotMap.get(data.getSlotLabel());
                        if ( slot!=null ) {
                            break; // don't wait if we got a slot now
                        } else if ( !slotsBeingCreated.contains(data.getSlotLabel()) ) {
                            throw new CATokenOfflineException(intres.getLocalizedMessage("caadmin.errorcreatetoken")); // thread creating slot failed
                        }
                        // wait until another thread has created the slot
                        try {
                            slotsBeingCreated.wait();
                        } catch (InterruptedException e) {
                            throw new Error( "This should never happen.", e);
                        }
                        // the slot should now have been created by another thread
                    }
                } else {
                    try {
                        slotsBeingCreated.add(data.getSlotLabel());// show that this thread is creating the slot
                        slot = data.getNewP11Slot();
                        slotMap.put(data.getSlotLabel(), slot);
                    } finally {
                        if ( slot==null ) {
                            slotsBeingCreated.remove(data.getSlotLabel());// show that creating the slot failed
                        }
                        slotsBeingCreated.notifyAll();// notify that the slot is now created
                        if ( slot==null ) {
                            throw new CATokenOfflineException(intres.getLocalizedMessage("caadmin.errorcreatetoken"));
                        }
                    }
                    Set<P11Slot> libSet = libMap.get(data.getLibName());
                    if (libSet==null) {
                        libSet=new HashSet<P11Slot>();
View Full Code Here

                tmpProvider = KeyTools.getSunP11Provider(new FileInputStream(this.sunP11ConfigFileName));
            } else {
                throw new Error("Should never happen.");
            }
        } catch (IOException e) {
            final CATokenOfflineException e2 = new CATokenOfflineException("Not possible to create provider. See cause.");
            e2.initCause(e);
            throw e2;
        } finally {
            this.isSettingProvider = false;
            this.notifyAll();
        }
        if ( tmpProvider==null ) {
            throw new CATokenOfflineException("Provider is null");
        }
        if ( Security.getProvider(tmpProvider.getName())!=null ) {
            Security.removeProvider(tmpProvider.getName());
        }
        Security.addProvider( tmpProvider );
View Full Code Here

        // Get CA info.
        CAData cadata = CAData.findByIdOrThrow(entityManager, Integer.valueOf(caid));
        CA ca = cadata.getCA();
        if (ca.getStatus() == SecConst.CA_OFFLINE) {
          String msg = intres.getLocalizedMessage("error.catokenoffline", cadata.getName());
          throw new CATokenOfflineException(msg);
        }
        ArrayList<ExtendedCAServiceInfo> infos = new ArrayList<ExtendedCAServiceInfo>();
        infos.add(info);
        activateAndPublishExternalCAServices(admin, infos, ca);
        // Update CA in database
View Full Code Here

          cadata = CAData.findByIdOrThrow(entityManager, Integer.valueOf(caid));
            CA ca = cadata.getCA();

            if (ca.getStatus() == SecConst.CA_OFFLINE) {
                String msg = intres.getLocalizedMessage("error.catokenoffline", cadata.getName());
                throw new CATokenOfflineException(msg);
            }

            CATokenContainer caToken = ca.getCAToken();
            if (regenerateKeys) {
                boolean renew = true;
View Full Code Here

        } catch (IllegalKeyException ke) {
            log.error("Key is of unknown type: ", ke);
            throw ke;
        } catch (CATokenOfflineException ctoe) {
          String msg = intres.getLocalizedMessage("error.catokenoffline", ca.getSubjectDN());
          CATokenOfflineException ex = new CATokenOfflineException(msg);
          ex.initCause(ctoe);
          throw ex;
        } catch (EjbcaException e) {
            throw e;
        } catch (NoSuchProviderException e) {
            log.error("NoSuchProvider provider: ", e);
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ca.catoken.CATokenOfflineException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.