Examples of KeyRecoveryCAServiceRequest


Examples of org.ejbca.core.model.ca.caadmin.extendedcaservices.KeyRecoveryCAServiceRequest

      }
        boolean returnval = false;
        try {
            int caid = CertTools.getIssuerDN(certificate).hashCode();
            KeyRecoveryCAServiceResponse response = (KeyRecoveryCAServiceResponse) caAdminSession.extendedService(admin, caid,
                    new KeyRecoveryCAServiceRequest(KeyRecoveryCAServiceRequest.COMMAND_ENCRYPTKEYS, keypair));
            entityManager.persist(new org.ejbca.core.ejb.keyrecovery.KeyRecoveryData(
                CertTools.getSerialNumber(certificate), CertTools.getIssuerDN(certificate), username, response.getKeyData()));
           // same method to make hex serno as in KeyRecoveryDataBean
            String msg = intres.getLocalizedMessage("keyrecovery.addeddata", CertTools.getSerialNumber(certificate).toString(16), CertTools.getIssuerDN(certificate));             
            logSession.log(admin, certificate, LogConstants.MODULE_KEYRECOVERY, new java.util.Date(), username,
View Full Code Here

Examples of org.ejbca.core.model.ca.caadmin.extendedcaservices.KeyRecoveryCAServiceRequest

            throw new FinderException();
          }
            krd.setMarkedAsRecoverable(markedasrecoverable);
            int caid = dn.hashCode();
            KeyRecoveryCAServiceResponse response = (KeyRecoveryCAServiceResponse) caAdminSession.extendedService(admin, caid,
                    new KeyRecoveryCAServiceRequest(KeyRecoveryCAServiceRequest.COMMAND_ENCRYPTKEYS, keypair));
            krd.setKeyDataFromByteArray(response.getKeyData());
            String msg = intres.getLocalizedMessage("keyrecovery.changeddata", hexSerial, dn);             
            logSession.log(admin, certificate, LogConstants.MODULE_KEYRECOVERY, new java.util.Date(),
                    krd.getUsername(), certificate, LogConstants.EVENT_INFO_KEYRECOVERY, msg);
            returnval = true;
View Full Code Here

Examples of org.ejbca.core.model.ca.caadmin.extendedcaservices.KeyRecoveryCAServiceRequest

              krd = i.next();
              if (returnval == null) {
                int caid = krd.getIssuerDN().hashCode();

                KeyRecoveryCAServiceResponse response = (KeyRecoveryCAServiceResponse) caAdminSession.extendedService(admin, caid,
                    new KeyRecoveryCAServiceRequest(KeyRecoveryCAServiceRequest.COMMAND_DECRYPTKEYS, krd.getKeyDataAsByteArray()));
                KeyPair keys = response.getKeyPair();
                certificate = (X509Certificate) certificateStoreSession.findCertificateByIssuerAndSerno(admin, krd.getIssuerDN(), krd.getCertificateSN());
                returnval = new KeyRecoveryData(krd.getCertificateSN(), krd.getIssuerDN(),
                    krd.getUsername(), krd.getMarkedAsRecoverable(), keys, certificate);
              }
View Full Code Here

Examples of org.ejbca.core.model.ca.caadmin.extendedcaservices.KeyRecoveryCAServiceRequest

          if(request instanceof CmsCAServiceRequest) {
              returnval = getExtendedCAService(ExtendedCAServiceInfo.TYPE_CMSEXTENDEDSERVICE).extendedService(request);           
          }
         
          if(request instanceof KeyRecoveryCAServiceRequest){
            KeyRecoveryCAServiceRequest keyrecoveryrequest =  (KeyRecoveryCAServiceRequest) request;
            if(keyrecoveryrequest.getCommand() == KeyRecoveryCAServiceRequest.COMMAND_ENCRYPTKEYS){
              try
                returnval = new KeyRecoveryCAServiceResponse(KeyRecoveryCAServiceResponse.TYPE_ENCRYPTKEYSRESPONSE,
                    encryptKeys(keyrecoveryrequest.getKeyPair()))
              }catch(CMSException e){
                log.error("encrypt:", e.getUnderlyingException());
                throw new IllegalExtendedCAServiceRequestException(e);
              }catch(Exception e){
                throw new IllegalExtendedCAServiceRequestException(e);
              }
            }else{
              if(keyrecoveryrequest.getCommand() == KeyRecoveryCAServiceRequest.COMMAND_DECRYPTKEYS){
                  try{
                    returnval = new KeyRecoveryCAServiceResponse(KeyRecoveryCAServiceResponse.TYPE_DECRYPTKEYSRESPONSE,
                    this.decryptKeys(keyrecoveryrequest.getKeyData()));
                }catch(CMSException e){
                 log.error("decrypt:", e.getUnderlyingException());
                 throw new IllegalExtendedCAServiceRequestException(e);
               }catch(Exception e){
                   throw new IllegalExtendedCAServiceRequestException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.