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

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


            // 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) {
                throw new EJBException(e);
            }
        }
View Full Code Here


                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;
            } catch (Exception e) {
                throw new EJBException(e);
            }
        } else {
View Full Code Here

          }
          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){
View Full Code Here

TOP

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

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.