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