Package org.ejbca.core.model.ca.caadmin.extendedcaservices

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


        if (data.get(ENCRYPTEDDATA) != null) {
            // Data in encrypted, decrypt
            byte[] encdata = (byte[]) data.get(ENCRYPTEDDATA);

            HardTokenEncryptCAServiceRequest request = new HardTokenEncryptCAServiceRequest(HardTokenEncryptCAServiceRequest.COMMAND_DECRYPTDATA, encdata);
            try {
                HardTokenEncryptCAServiceResponse response = (HardTokenEncryptCAServiceResponse) caAdminSession.extendedService(admin, encryptcaid, request);
                ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(response.getData()));
                data = (HashMap) ois.readObject();
            } catch (Exception e) {
View Full Code Here


        if (encryptcaid != 0) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                ObjectOutputStream ois = new ObjectOutputStream(baos);
                ois.writeObject(tokendata.saveData());
                HardTokenEncryptCAServiceRequest request = new HardTokenEncryptCAServiceRequest(HardTokenEncryptCAServiceRequest.COMMAND_ENCRYPTDATA, baos
                        .toByteArray());
                HardTokenEncryptCAServiceResponse response = (HardTokenEncryptCAServiceResponse) caAdminSession.extendedService(admin, encryptcaid, request);
                HashMap<String,byte[]> data = new HashMap<String,byte[]>();
                data.put(ENCRYPTEDDATA, response.getData());
                retval = data;
View Full Code Here

                throw new IllegalExtendedCAServiceRequestException("Illegal Command");
              }
            }           
          }
          if(request instanceof HardTokenEncryptCAServiceRequest){
            HardTokenEncryptCAServiceRequest hardencrequest =  (HardTokenEncryptCAServiceRequest) request;
              if(hardencrequest.getCommand() == HardTokenEncryptCAServiceRequest.COMMAND_ENCRYPTDATA){
                try
                  returnval = new HardTokenEncryptCAServiceResponse(HardTokenEncryptCAServiceResponse.TYPE_ENCRYPTRESPONSE,
                      encryptData(hardencrequest.getData(), SecConst.CAKEYPURPOSE_HARDTOKENENCRYPT))
                }catch(CMSException e){
                  log.error("encrypt:", e.getUnderlyingException());
                  throw new IllegalExtendedCAServiceRequestException(e);
                }catch(Exception e){
                  throw new IllegalExtendedCAServiceRequestException(e);
                }
              }else{
                if(hardencrequest.getCommand() == HardTokenEncryptCAServiceRequest.COMMAND_DECRYPTDATA){
                    try{
                      returnval = new HardTokenEncryptCAServiceResponse(HardTokenEncryptCAServiceResponse.TYPE_DECRYPTRESPONSE,
                      this.decryptData(hardencrequest.getData(), SecConst.CAKEYPURPOSE_HARDTOKENENCRYPT));
                  }catch(CMSException e){
                   log.error("decrypt:", e.getUnderlyingException());
                   throw new IllegalExtendedCAServiceRequestException(e);
                 }catch(Exception e){
                     throw new IllegalExtendedCAServiceRequestException(e);
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ca.caadmin.extendedcaservices.HardTokenEncryptCAServiceRequest

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.