throw new ExtendedCAServiceRequestException(ike);
} catch (CATokenOfflineException ctoe) {
throw new ExtendedCAServiceRequestException(ctoe);
} catch (IllegalArgumentException e) {
log.error("IllegalArgumentException: ", e);
throw new IllegalExtendedCAServiceRequestException(e);
}
returnval = getExtendedCAService(ExtendedCAServiceInfo.TYPE_OCSPEXTENDEDSERVICE).extendedService(ocspServiceReq);
}
if(request instanceof XKMSCAServiceRequest) {
returnval = getExtendedCAService(ExtendedCAServiceInfo.TYPE_XKMSEXTENDEDSERVICE).extendedService(request);
}
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);
}
}else{
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);
}
}else{
throw new IllegalExtendedCAServiceRequestException("Illegal Command");
}
}
}
return returnval;