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);