diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java | 222 |
1 files changed, 0 insertions, 222 deletions
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java index f57d12e2..84290ea6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java @@ -28,7 +28,6 @@ import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; import java.math.BigInteger; -import java.net.ServerSocket; import java.security.KeyPair; import java.util.Date; import java.util.Enumeration; @@ -857,196 +856,6 @@ public final class CMSAdminServlet extends AdminServlet { } /** - * Modifies network information. - */ - private void modifyNetworkConfig(HttpServletRequest req, - HttpServletResponse resp) throws ServletException, - IOException, EBaseException { - - /* - HTTPSubsystem eeGateway = (HTTPSubsystem) - SubsystemRegistry.getInstance().get("eeGateway"); - RemoteAdmin raAdmin = (RemoteAdmin)RemoteAdmin.getInstance(); - AgentGateway agent = (AgentGateway)mReg.get(AgentGateway.ID); - - Enumeration enum1 = req.getParameterNames(); - - String eeHTTPportString = null; - String eeHTTPSportString = null; - String agentHTTPSportString = null; - String radminHTTPSportString = null; - - String gatewayBacklog = "15"; - - // eeHTTPEnabled corresponds to the checkbox which enables the - // HTTP EE port - String eeHTTPEnabled = Constants.FALSE; - - while (enum1.hasMoreElements()) { - String key = (String)enum1.nextElement(); - String value = (String)req.getParameter(key); - - if (key.equals(Constants.PR_AGENT_S_BACKLOG)) { - agent.setHTTPSBacklog(value); - } else if (key.equals(Constants.PR_GATEWAY_S_BACKLOG)) { - eeGateway.setHTTPSBacklog(value); - } else if (key.equals(Constants.PR_ADMIN_S_BACKLOG)) { - raAdmin.setHTTPSBacklog(value); - } else if (key.equals(Constants.PR_GATEWAY_BACKLOG)) { - gatewayBacklog = value; - } else if (key.equals(Constants.PR_GATEWAY_PORT_ENABLED)) { - eeHTTPEnabled = value; - } - } - - - eeHTTPportString = req.getParameter(Constants.PR_GATEWAY_PORT); - eeHTTPSportString = req.getParameter(Constants.PR_GATEWAY_S_PORT); - agentHTTPSportString= req.getParameter(Constants.PR_AGENT_S_PORT); - radminHTTPSportString= req.getParameter(Constants.PR_ADMIN_S_PORT); - - - int eeHTTPport=0; - int eeHTTPSport=0; - int agentHTTPSport=0; - int radminHTTPSport=0; - if (eeHTTPportString != null) eeHTTPport = Integer.parseInt(eeHTTPportString); - if (eeHTTPSportString != null) eeHTTPSport = Integer.parseInt(eeHTTPSportString); - if (agentHTTPSportString != null) agentHTTPSport = Integer.parseInt(agentHTTPSportString); - if (radminHTTPSportString != null) radminHTTPSport = Integer.parseInt(radminHTTPSportString); - - - String portName=""; - int portnum; - try { - - // EE HTTP is special, since it has it's own checkbox for enabling/disabling - if (eeHTTPEnabled.equals(Constants.TRUE) && - eeHTTPport != 0 && - eeHTTPport != eeGateway.getHTTPPort()) - { - portName = "End-entity"; - checkPortAvailable(eeHTTPport); - } - - if (eeHTTPSport != 0 && eeHTTPSport != eeGateway.getHTTPSPort()) { - portName = "SSL End-entity"; - checkPortAvailable(eeHTTPSport); - } - if (agentHTTPSport != 0 && agentHTTPSport != agent.getHTTPSPort()) { - portName = "Agent"; - checkPortAvailable(agentHTTPSport); - } - if (radminHTTPSport != 0 && radminHTTPSport != raAdmin.getHTTPSPort()) { - portName = "Remote Admin"; - checkPortAvailable(radminHTTPSport); - } - - // If any of the above ports are not available, an exception - // will be thrown and these methods below will not be called - - if (eeHTTPEnabled.equals(Constants.TRUE)) { - eeGateway.setHTTPPort(eeHTTPport); - } - eeGateway.setHTTPSPort(eeHTTPSport); - agent.setHTTPSPort(agentHTTPSport); - raAdmin.setHTTPSPort(radminHTTPSport); - - } catch (IOException e) { - // send 'port in use' error - sendResponse(ERROR, portName+" "+e.getMessage(), null, resp); - // we do not want to save the config in this case - return; - } - - eeGateway.setHTTPBacklog(gatewayBacklog); - eeGateway.setHTTPPortEnable(eeHTTPEnabled); - - mConfig.commit(true); - sendResponse(RESTART, null, null, resp); - */ - } - - /** - * Check if the port is available for binding. - * @throws IOException if not available - */ - - private void checkPortAvailable(int port) - throws IOException { - try { - // see if the port is being used by somebody else - ServerSocket ss = new ServerSocket(port); - - ss.close(); - } catch (Exception e) { - throw new IOException("port " + port + " is in use. Please select another port"); - } - } - - /** - * Reads network information. - */ - private void readNetworkConfig(HttpServletRequest req, - HttpServletResponse resp) throws ServletException, - IOException, EBaseException { - - NameValuePairs params = new NameValuePairs(); - - getEENetworkConfig(params); - getAdminConfig(params); - getAgentConfig(params); - - sendResponse(SUCCESS, null, params, resp); - } - - private void getEENetworkConfig(NameValuePairs params) - throws EBaseException { - - /* - HTTPSubsystem eeGateway = - (HTTPSubsystem)mReg.get("eeGateway"); - if (eeGateway == null) { - // i.e. standalone DRM - params.add(Constants.PR_GATEWAY_S_PORT, "-1"); - params.add(Constants.PR_GATEWAY_PORT, "-1"); - params.add(Constants.PR_GATEWAY_S_BACKLOG, "-1"); - params.add(Constants.PR_GATEWAY_BACKLOG,"-1"); - params.add(Constants.PR_GATEWAY_PORT_ENABLED,"false"); - } else { - params.add(Constants.PR_GATEWAY_S_PORT, - ""+eeGateway.getHTTPSPort()); - params.add(Constants.PR_GATEWAY_PORT, - ""+eeGateway.getHTTPPort()); - params.add(Constants.PR_GATEWAY_S_BACKLOG, - ""+eeGateway.getHTTPBacklog()); - params.add(Constants.PR_GATEWAY_BACKLOG, - ""+eeGateway.getHTTPSBacklog()); - params.add(Constants.PR_GATEWAY_PORT_ENABLED, - eeGateway.getHTTPPortEnable()); - } - */ - } - - private void getAdminConfig(NameValuePairs params) throws EBaseException { - - /* - RemoteAdmin raAdmin = (RemoteAdmin)RemoteAdmin.getInstance(); - params.add(Constants.PR_ADMIN_S_PORT, ""+raAdmin.getHTTPSPort()); - params.add(Constants.PR_ADMIN_S_BACKLOG,""+raAdmin.getHTTPSBacklog()); - */ - } - - private void getAgentConfig(NameValuePairs params) throws EBaseException { - - /* - AgentGateway agent = (AgentGateway)mReg.get(AgentGateway.ID); - params.add(Constants.PR_AGENT_S_PORT, ""+agent.getHTTPSPort()); - params.add(Constants.PR_AGENT_S_BACKLOG,""+agent.getHTTPSBacklog()); - */ - } - - /** * Modifies database information. */ private void setDBConfig(HttpServletRequest req, @@ -2081,37 +1890,6 @@ private void createMasterKey(HttpServletRequest req, } } - private String getDefaultSigningAlg(String keyType, String messageDigest) { - if (keyType.equals("RSA")) { - if (messageDigest.equals("MD2")) { - return "MD2withRSA"; - } else if (messageDigest.equals("MD5")) { - return "MD5withRSA"; - } else if (messageDigest.equals("SHA1")) { - return "SHA1withRSA"; - } else if (messageDigest.equals("SHA256")) { - return "SHA256withRSA"; - } else if (messageDigest.equals("SHA512")) { - return "SHA512withRSA"; - } - } else if (keyType.equals("DSA")) { - if (messageDigest.equals("SHA1")) { - return "SHA1withDSA"; - } - } else /* EC */ { - if (messageDigest.equals("SHA1")) { - return "SHA1withEC"; - } else if (messageDigest.equals("SHA256")) { - return "SHA256withEC"; - } else if (messageDigest.equals("SHA384")) { - return "SHA384withEC"; - } else if (messageDigest.equals("SHA512")) { - return "SHA512withEC"; - } - } - return null; - } - private void updateCASignature(String nickname, KeyCertData properties, ICryptoSubsystem jssSubSystem) throws EBaseException { String alg = jssSubSystem.getSignatureAlgorithm(nickname); |