} if(request instanceof CmsCAServiceRequest) { returnval = getExtendedCAService(ExtendedCAServiceInfo.TYPE_CMSEXTENDEDSERVICE).extendedService(request);
	public ExtendedCAServiceResponse extendedService(ExtendedCAServiceRequest request) 	  throws ExtendedCAServiceRequestException, IllegalExtendedCAServiceRequestException, ExtendedCAServiceNotActiveException{          ExtendedCAServiceResponse returnval = null;           if(request instanceof OCSPCAServiceRequest) {              returnval = getExtendedCAService(ExtendedCAServiceInfo.TYPE_OCSPEXTENDEDSERVICE).extendedService(request);                      }          if(request instanceof XKMSCAServiceRequest) {              returnval = getExtendedCAService(ExtendedCAServiceInfo.TYPE_XKMSEXTENDEDSERVICE).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");           		}          	}          	          }                    return returnval;	}