summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java')
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java982
1 files changed, 517 insertions, 465 deletions
diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java
index a2a7d5df..570c5158 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.servlet.csadmin;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.ConnectException;
@@ -79,8 +78,8 @@ public class WizardPanelBase implements IWizardPanel {
public static final String PRE_CONF_AGENT_GROUP = "preop.admin.group";
/**
- * Definition for "preop" static variables in CS.cfg
- * -- "preop" config parameters should not assumed to exist after configuation
+ * Definition for "preop" static variables in CS.cfg -- "preop" config
+ * parameters should not assumed to exist after configuation
*/
public static final String PRE_CONF_CA_TOKEN = "preop.module.token";
@@ -95,15 +94,12 @@ public class WizardPanelBase implements IWizardPanel {
/**
* Initializes this panel.
*/
- public void init(ServletConfig config, int panelno)
- throws ServletException
- {
+ public void init(ServletConfig config, int panelno) throws ServletException {
mPanelNo = panelno;
}
- public void init(WizardServlet servlet, ServletConfig config, int panelno, String id)
- throws ServletException
- {
+ public void init(WizardServlet servlet, ServletConfig config, int panelno,
+ String id) throws ServletException {
mPanelNo = panelno;
}
@@ -142,7 +138,7 @@ public class WizardPanelBase implements IWizardPanel {
return set;
}
-
+
/**
* Should we skip this panel?
*/
@@ -186,30 +182,29 @@ public class WizardPanelBase implements IWizardPanel {
* Display the panel.
*/
public void display(HttpServletRequest request,
- HttpServletResponse response,
- Context context) {}
+ HttpServletResponse response, Context context) {
+ }
/**
* Checks if the given parameters are valid.
*/
public void validate(HttpServletRequest request,
- HttpServletResponse response,
- Context context) throws IOException {
+ HttpServletResponse response, Context context) throws IOException {
}
/**
* Commit parameter changes
*/
public void update(HttpServletRequest request,
- HttpServletResponse response,
- Context context) throws IOException {}
+ HttpServletResponse response, Context context) throws IOException {
+ }
/**
* If validiate() returns false, this method will be called.
*/
public void displayError(HttpServletRequest request,
- HttpServletResponse response,
- Context context) {}
+ HttpServletResponse response, Context context) {
+ }
/**
* Retrieves locale based on the request.
@@ -233,15 +228,17 @@ public class WizardPanelBase implements IWizardPanel {
try {
instanceID = config.getString("instanceId", "");
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
String nickname = certTag + "Cert cert-" + instanceID;
String preferredNickname = null;
try {
- preferredNickname = config.getString(
- PCERT_PREFIX + certTag + ".nickname", null);
- } catch (Exception e) {}
+ preferredNickname = config.getString(PCERT_PREFIX + certTag
+ + ".nickname", null);
+ } catch (Exception e) {
+ }
if (preferredNickname != null) {
nickname = preferredNickname;
@@ -250,37 +247,41 @@ public class WizardPanelBase implements IWizardPanel {
}
public void updateDomainXML(String hostname, int port, boolean https,
- String servlet, String uri) throws IOException {
- CMS.debug("WizardPanelBase updateDomainXML start hostname=" + hostname + " port=" + port);
+ String servlet, String uri) throws IOException {
+ CMS.debug("WizardPanelBase updateDomainXML start hostname=" + hostname
+ + " port=" + port);
IConfigStore cs = CMS.getConfigStore();
String nickname = "";
String tokenname = "";
try {
nickname = cs.getString("preop.cert.subsystem.nickname", "");
tokenname = cs.getString("preop.module.token", "");
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
- if (!tokenname.equals("") &&
- !tokenname.equals("Internal Key Storage Token") &&
- !tokenname.equals("internal")) {
- nickname = tokenname+":"+nickname;
+ if (!tokenname.equals("")
+ && !tokenname.equals("Internal Key Storage Token")
+ && !tokenname.equals("internal")) {
+ nickname = tokenname + ":" + nickname;
}
CMS.debug("WizardPanelBase updateDomainXML nickname=" + nickname);
CMS.debug("WizardPanelBase: start sending updateDomainXML request");
- String c = getHttpResponse(hostname, port, https, servlet, uri, nickname);
+ String c = getHttpResponse(hostname, port, https, servlet, uri,
+ nickname);
CMS.debug("WizardPanelBase: done sending updateDomainXML request");
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject obj = null;
try {
obj = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::updateDomainXML() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::updateDomainXML() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = obj.getValue("Status");
@@ -291,7 +292,7 @@ public class WizardPanelBase implements IWizardPanel {
} else {
String error = obj.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
CMS.debug("WizardPanelBase: updateDomainXML: " + e.toString());
throw e;
@@ -302,21 +303,21 @@ public class WizardPanelBase implements IWizardPanel {
}
}
- public int getSubsystemCount( String hostname, int https_admin_port,
- boolean https, String type )
- throws IOException {
+ public int getSubsystemCount(String hostname, int https_admin_port,
+ boolean https, String type) throws IOException {
CMS.debug("WizardPanelBase getSubsystemCount start");
String c = getDomainXML(hostname, https_admin_port, true);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject obj = new XMLObject(bis);
- String containerName = type+"List";
+ String containerName = type + "List";
Node n = obj.getContainer(containerName);
NodeList nlist = n.getChildNodes();
String countS = "";
- for (int i=0; i<nlist.getLength(); i++) {
- Element nn = (Element)nlist.item(i);
+ for (int i = 0; i < nlist.getLength(); i++) {
+ Element nn = (Element) nlist.item(i);
String tagname = nn.getTagName();
if (tagname.equals("SubsystemCount")) {
NodeList nlist1 = nn.getChildNodes();
@@ -325,7 +326,8 @@ public class WizardPanelBase implements IWizardPanel {
break;
}
}
- CMS.debug("WizardPanelBase getSubsystemCount: SubsystemCount="+countS);
+ CMS.debug("WizardPanelBase getSubsystemCount: SubsystemCount="
+ + countS);
int num = 0;
if (countS != null && !countS.equals("")) {
@@ -337,7 +339,7 @@ public class WizardPanelBase implements IWizardPanel {
return num;
} catch (Exception e) {
- CMS.debug("WizardPanelBase: getSubsystemCount: "+e.toString());
+ CMS.debug("WizardPanelBase: getSubsystemCount: " + e.toString());
throw new IOException(e.toString());
}
}
@@ -345,23 +347,23 @@ public class WizardPanelBase implements IWizardPanel {
return -1;
}
- public String getDomainXML( String hostname, int https_admin_port,
- boolean https )
- throws IOException {
+ public String getDomainXML(String hostname, int https_admin_port,
+ boolean https) throws IOException {
CMS.debug("WizardPanelBase getDomainXML start");
- String c = getHttpResponse( hostname, https_admin_port, https,
- "/ca/admin/ca/getDomainXML", null, null );
+ String c = getHttpResponse(hostname, https_admin_port, https,
+ "/ca/admin/ca/getDomainXML", null, null);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::getDomainXML() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::getDomainXML() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
@@ -371,15 +373,14 @@ public class WizardPanelBase implements IWizardPanel {
if (status.equals(SUCCESS)) {
String domainInfo = parser.getValue("DomainInfo");
- CMS.debug(
- "WizardPanelBase getDomainXML: domainInfo="
- + domainInfo);
- return domainInfo;
+ CMS.debug("WizardPanelBase getDomainXML: domainInfo="
+ + domainInfo);
+ return domainInfo;
} else {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
CMS.debug("WizardPanelBase: getDomainXML: " + e.toString());
throw e;
@@ -392,29 +393,29 @@ public class WizardPanelBase implements IWizardPanel {
return null;
}
- public String getSubsystemCert(String host, int port, boolean https)
- throws IOException {
+ public String getSubsystemCert(String host, int port, boolean https)
+ throws IOException {
CMS.debug("WizardPanelBase getSubsystemCert start");
- String c = getHttpResponse(host, port, https,
- "/ca/admin/ca/getSubsystemCert", null, null);
+ String c = getHttpResponse(host, port, https,
+ "/ca/admin/ca/getSubsystemCert", null, null);
if (c != null) {
try {
- ByteArrayInputStream bis =
- new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::getSubsystemCert() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::getSubsystemCert() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
if (status.equals(SUCCESS)) {
String s = parser.getValue("Cert");
return s;
} else
- return null;
+ return null;
} catch (Exception e) {
}
}
@@ -423,87 +424,90 @@ public class WizardPanelBase implements IWizardPanel {
}
public void updateConnectorInfo(String host, int port, boolean https,
- String content) throws IOException {
+ String content) throws IOException {
CMS.debug("WizardPanelBase updateConnectorInfo start");
- String c = getHttpResponse(host, port, https,
- "/ca/admin/ca/updateConnector", content, null);
+ String c = getHttpResponse(host, port, https,
+ "/ca/admin/ca/updateConnector", content, null);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::updateConnectorInfo() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::updateConnectorInfo() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
- CMS.debug("WizardPanelBase updateConnectorInfo: status=" + status);
+ CMS.debug("WizardPanelBase updateConnectorInfo: status="
+ + status);
if (!status.equals(SUCCESS)) {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
- CMS.debug("WizardPanelBase: updateConnectorInfo: " + e.toString());
+ CMS.debug("WizardPanelBase: updateConnectorInfo: "
+ + e.toString());
throw e;
} catch (Exception e) {
- CMS.debug("WizardPanelBase: updateConnectorInfo: " + e.toString());
+ CMS.debug("WizardPanelBase: updateConnectorInfo: "
+ + e.toString());
throw new IOException(e.toString());
}
}
}
- public String getCertChainUsingSecureAdminPort( String hostname,
- int https_admin_port,
- boolean https,
- ConfigCertApprovalCallback
- certApprovalCallback )
- throws IOException {
+ public String getCertChainUsingSecureAdminPort(String hostname,
+ int https_admin_port, boolean https,
+ ConfigCertApprovalCallback certApprovalCallback) throws IOException {
CMS.debug("WizardPanelBase getCertChainUsingSecureAdminPort start");
- String c = getHttpResponse( hostname, https_admin_port, https,
- "/ca/admin/ca/getCertChain", null, null,
- certApprovalCallback );
+ String c = getHttpResponse(hostname, https_admin_port, https,
+ "/ca/admin/ca/getCertChain", null, null, certApprovalCallback);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::getCertChainUsingSecureAdminPort() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::getCertChainUsingSecureAdminPort() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
- CMS.debug("WizardPanelBase getCertChainUsingSecureAdminPort: status=" + status);
+ CMS.debug("WizardPanelBase getCertChainUsingSecureAdminPort: status="
+ + status);
if (status.equals(SUCCESS)) {
String certchain = parser.getValue("ChainBase64");
certchain = CryptoUtil.normalizeCertStr(certchain);
- CMS.debug(
- "WizardPanelBase getCertChainUsingSecureAdminPort: certchain="
- + certchain);
- return certchain;
+ CMS.debug("WizardPanelBase getCertChainUsingSecureAdminPort: certchain="
+ + certchain);
+ return certchain;
} else {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
- CMS.debug("WizardPanelBase: getCertChainUsingSecureAdminPort: " + e.toString());
+ CMS.debug("WizardPanelBase: getCertChainUsingSecureAdminPort: "
+ + e.toString());
throw e;
} catch (Exception e) {
- CMS.debug("WizardPanelBase: getCertChainUsingSecureAdminPort: " + e.toString());
+ CMS.debug("WizardPanelBase: getCertChainUsingSecureAdminPort: "
+ + e.toString());
throw new IOException(e.toString());
}
}
@@ -511,52 +515,51 @@ public class WizardPanelBase implements IWizardPanel {
return null;
}
- public String getCertChainUsingSecureEEPort( String hostname,
- int https_ee_port,
- boolean https,
- ConfigCertApprovalCallback
- certApprovalCallback )
- throws IOException {
+ public String getCertChainUsingSecureEEPort(String hostname,
+ int https_ee_port, boolean https,
+ ConfigCertApprovalCallback certApprovalCallback) throws IOException {
CMS.debug("WizardPanelBase getCertChainUsingSecureEEPort start");
- String c = getHttpResponse( hostname, https_ee_port, https,
- "/ca/ee/ca/getCertChain", null, null,
- certApprovalCallback );
+ String c = getHttpResponse(hostname, https_ee_port, https,
+ "/ca/ee/ca/getCertChain", null, null, certApprovalCallback);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::getCertChainUsingSecureEEPort() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::getCertChainUsingSecureEEPort() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
- CMS.debug("WizardPanelBase getCertChainUsingSecureEEPort: status=" + status);
+ CMS.debug("WizardPanelBase getCertChainUsingSecureEEPort: status="
+ + status);
if (status.equals(SUCCESS)) {
String certchain = parser.getValue("ChainBase64");
certchain = CryptoUtil.normalizeCertStr(certchain);
- CMS.debug(
- "WizardPanelBase getCertChainUsingSecureEEPort: certchain="
- + certchain);
- return certchain;
+ CMS.debug("WizardPanelBase getCertChainUsingSecureEEPort: certchain="
+ + certchain);
+ return certchain;
} else {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
- CMS.debug("WizardPanelBase: getCertChainUsingSecureEEPort: " + e.toString());
+ CMS.debug("WizardPanelBase: getCertChainUsingSecureEEPort: "
+ + e.toString());
throw e;
} catch (Exception e) {
- CMS.debug("WizardPanelBase: getCertChainUsingSecureEEPort: " + e.toString());
+ CMS.debug("WizardPanelBase: getCertChainUsingSecureEEPort: "
+ + e.toString());
throw new IOException(e.toString());
}
}
@@ -564,41 +567,44 @@ public class WizardPanelBase implements IWizardPanel {
return null;
}
- public boolean updateConfigEntries(String hostname, int port, boolean https,
- String servlet, String uri, IConfigStore config,
- HttpServletResponse response) throws IOException {
+ public boolean updateConfigEntries(String hostname, int port,
+ boolean https, String servlet, String uri, IConfigStore config,
+ HttpServletResponse response) throws IOException {
CMS.debug("WizardPanelBase updateConfigEntries start");
String c = getHttpResponse(hostname, port, https, servlet, uri, null);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::updateConfigEntries() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::updateConfigEntries() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
- CMS.debug("WizardPanelBase updateConfigEntries: status=" + status);
+ CMS.debug("WizardPanelBase updateConfigEntries: status="
+ + status);
if (status.equals(SUCCESS)) {
String cstype = "";
try {
cstype = config.getString("cs.type", "");
} catch (Exception e) {
- CMS.debug("WizardPanelBase::updateConfigEntries() - unable to get cs.type: " + e.toString());
+ CMS.debug("WizardPanelBase::updateConfigEntries() - unable to get cs.type: "
+ + e.toString());
}
-
- Document doc = parser.getDocument();
+
+ Document doc = parser.getDocument();
NodeList list = doc.getElementsByTagName("name");
int len = list.getLength();
- for (int i=0; i<len; i++) {
+ for (int i = 0; i < len; i++) {
Node n = list.item(i);
NodeList nn = n.getChildNodes();
String name = nn.item(0).getNodeValue();
@@ -606,73 +612,104 @@ public class WizardPanelBase implements IWizardPanel {
nn = parent.getChildNodes();
int len1 = nn.getLength();
String v = "";
- for (int j=0; j<len1; j++) {
+ for (int j = 0; j < len1; j++) {
Node nv = nn.item(j);
String val = nv.getNodeName();
if (val.equals("value")) {
NodeList n2 = nv.getChildNodes();
if (n2.getLength() > 0)
- v = n2.item(0).getNodeValue();
- break;
+ v = n2.item(0).getNodeValue();
+ break;
}
}
if (name.equals("internaldb.ldapconn.host")) {
- config.putString("preop.internaldb.master.hostname", v);
+ config.putString(
+ "preop.internaldb.master.hostname", v);
} else if (name.equals("internaldb.ldapconn.port")) {
config.putString("preop.internaldb.master.port", v);
} else if (name.equals("internaldb.ldapauth.bindDN")) {
- config.putString("preop.internaldb.master.binddn", v);
+ config.putString("preop.internaldb.master.binddn",
+ v);
} else if (name.equals("internaldb.basedn")) {
config.putString(name, v);
- config.putString("preop.internaldb.master.basedn", v);
+ config.putString("preop.internaldb.master.basedn",
+ v);
} else if (name.equals("internaldb.ldapauth.password")) {
- config.putString("preop.internaldb.master.bindpwd", v);
- } else if (name.equals("internaldb.replication.password")) {
- config.putString("preop.internaldb.master.replicationpwd", v);
+ config.putString("preop.internaldb.master.bindpwd",
+ v);
+ } else if (name
+ .equals("internaldb.replication.password")) {
+ config.putString(
+ "preop.internaldb.master.replicationpwd", v);
} else if (name.equals("instanceId")) {
config.putString("preop.master.instanceId", v);
} else if (name.equals("cloning.cert.signing.nickname")) {
config.putString("preop.master.signing.nickname", v);
config.putString("preop.cert.signing.nickname", v);
} else if (name.equals("cloning.ocsp_signing.nickname")) {
- config.putString("preop.master.ocsp_signing.nickname", v);
- config.putString("preop.cert.ocsp_signing.nickname", v);
+ config.putString(
+ "preop.master.ocsp_signing.nickname", v);
+ config.putString(
+ "preop.cert.ocsp_signing.nickname", v);
} else if (name.equals("cloning.subsystem.nickname")) {
- config.putString("preop.master.subsystem.nickname", v);
+ config.putString("preop.master.subsystem.nickname",
+ v);
config.putString("preop.cert.subsystem.nickname", v);
} else if (name.equals("cloning.transport.nickname")) {
- config.putString("preop.master.transport.nickname", v);
+ config.putString("preop.master.transport.nickname",
+ v);
config.putString("kra.transportUnit.nickName", v);
config.putString("preop.cert.transport.nickname", v);
} else if (name.equals("cloning.storage.nickname")) {
config.putString("preop.master.storage.nickname", v);
config.putString("kra.storageUnit.nickName", v);
config.putString("preop.cert.storage.nickname", v);
- } else if (name.equals("cloning.audit_signing.nickname")) {
- config.putString("preop.master.audit_signing.nickname", v);
- config.putString("preop.cert.audit_signing.nickname", v);
+ } else if (name
+ .equals("cloning.audit_signing.nickname")) {
+ config.putString(
+ "preop.master.audit_signing.nickname", v);
+ config.putString(
+ "preop.cert.audit_signing.nickname", v);
config.putString(name, v);
} else if (name.startsWith("cloning.ca")) {
- config.putString(name.replaceFirst("cloning", "preop"), v);
+ config.putString(
+ name.replaceFirst("cloning", "preop"), v);
} else if (name.equals("cloning.signing.keyalgorithm")) {
- config.putString(name.replaceFirst("cloning", "preop.cert"), v);
+ config.putString(
+ name.replaceFirst("cloning", "preop.cert"),
+ v);
if (cstype.equals("CA")) {
- config.putString("ca.crl.MasterCRL.signingAlgorithm", v);
- config.putString("ca.signing.defaultSigningAlgorithm", v);
+ config.putString(
+ "ca.crl.MasterCRL.signingAlgorithm", v);
+ config.putString(
+ "ca.signing.defaultSigningAlgorithm", v);
} else if (cstype.equals("OCSP")) {
- config.putString("ocsp.signing.defaultSigningAlgorithm", v);
+ config.putString(
+ "ocsp.signing.defaultSigningAlgorithm",
+ v);
}
- } else if (name.equals("cloning.transport.keyalgorithm")) {
- config.putString(name.replaceFirst("cloning", "preop.cert"), v);
- config.putString("kra.transportUnit.signingAlgorithm", v);
- } else if (name.equals("cloning.ocsp_signing.keyalgorithm")) {
- config.putString(name.replaceFirst("cloning", "preop.cert"), v);
+ } else if (name
+ .equals("cloning.transport.keyalgorithm")) {
+ config.putString(
+ name.replaceFirst("cloning", "preop.cert"),
+ v);
+ config.putString(
+ "kra.transportUnit.signingAlgorithm", v);
+ } else if (name
+ .equals("cloning.ocsp_signing.keyalgorithm")) {
+ config.putString(
+ name.replaceFirst("cloning", "preop.cert"),
+ v);
if (cstype.equals("CA")) {
- config.putString("ca.ocsp_signing.defaultSigningAlgorithm", v);
+ config.putString(
+ "ca.ocsp_signing.defaultSigningAlgorithm",
+ v);
}
} else if (name.startsWith("cloning")) {
- config.putString(name.replaceFirst("cloning", "preop.cert"), v);
+ config.putString(
+ name.replaceFirst("cloning", "preop.cert"),
+ v);
} else {
config.putString(name, v);
}
@@ -686,12 +723,14 @@ public class WizardPanelBase implements IWizardPanel {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
- CMS.debug("WizardPanelBase: updateConfigEntries: " + e.toString());
+ CMS.debug("WizardPanelBase: updateConfigEntries: "
+ + e.toString());
throw e;
} catch (Exception e) {
- CMS.debug("WizardPanelBase: updateConfigEntries: " + e.toString());
+ CMS.debug("WizardPanelBase: updateConfigEntries: "
+ + e.toString());
throw new IOException(e.toString());
}
}
@@ -707,15 +746,16 @@ public class WizardPanelBase implements IWizardPanel {
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::authenticate() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::authenticate() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
@@ -729,7 +769,7 @@ public class WizardPanelBase implements IWizardPanel {
} else {
String error = parser.getValue("Error");
return false;
- }
+ }
} catch (Exception e) {
CMS.debug("WizardPanelBase: authenticate: " + e.toString());
throw new IOException(e.toString());
@@ -739,26 +779,27 @@ public class WizardPanelBase implements IWizardPanel {
return false;
}
- public void updateOCSPConfig(String hostname, int port, boolean https,
- String content, HttpServletResponse response)
- throws IOException {
+ public void updateOCSPConfig(String hostname, int port, boolean https,
+ String content, HttpServletResponse response) throws IOException {
CMS.debug("WizardPanelBase updateOCSPConfig start");
- String c = getHttpResponse(hostname, port, https,
- "/ca/ee/ca/updateOCSPConfig", content, null);
+ String c = getHttpResponse(hostname, port, https,
+ "/ca/ee/ca/updateOCSPConfig", content, null);
if (c == null || c.equals("")) {
CMS.debug("WizardPanelBase updateOCSPConfig: content is null.");
- throw new IOException("The server you want to contact is not available");
+ throw new IOException(
+ "The server you want to contact is not available");
} else {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::updateOCSPConfig() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::updateOCSPConfig() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
@@ -774,7 +815,7 @@ public class WizardPanelBase implements IWizardPanel {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
CMS.debug("WizardPanelBase updateOCSPConfig: " + e.toString());
throw e;
@@ -785,11 +826,11 @@ public class WizardPanelBase implements IWizardPanel {
}
}
- public void updateNumberRange(String hostname, int port, boolean https,
- String content, String type, HttpServletResponse response)
- throws IOException {
- CMS.debug("WizardPanelBase updateNumberRange start host=" + hostname +
- " port=" + port);
+ public void updateNumberRange(String hostname, int port, boolean https,
+ String content, String type, HttpServletResponse response)
+ throws IOException {
+ CMS.debug("WizardPanelBase updateNumberRange start host=" + hostname
+ + " port=" + port);
IConfigStore cs = CMS.getConfigStore();
String cstype = "";
try {
@@ -798,23 +839,25 @@ public class WizardPanelBase implements IWizardPanel {
}
cstype = toLowerCaseSubsystemType(cstype);
- String c = getHttpResponse(hostname, port, https,
- "/"+cstype+"/ee/"+cstype+"/updateNumberRange", content, null);
+ String c = getHttpResponse(hostname, port, https, "/" + cstype + "/ee/"
+ + cstype + "/updateNumberRange", content, null);
if (c == null || c.equals("")) {
CMS.debug("WizardPanelBase updateNumberRange: content is null.");
- throw new IOException("The server you want to contact is not available");
+ throw new IOException(
+ "The server you want to contact is not available");
} else {
- CMS.debug("content="+c);
+ CMS.debug("content=" + c);
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::updateNumberRange() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::updateNumberRange() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
@@ -843,7 +886,7 @@ public class WizardPanelBase implements IWizardPanel {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
CMS.debug("WizardPanelBase: updateNumberRange: " + e.toString());
CMS.debug(e);
@@ -856,24 +899,24 @@ public class WizardPanelBase implements IWizardPanel {
}
}
- public int getPort(String hostname, int port, boolean https,
- String portServlet, boolean sport)
- throws IOException {
+ public int getPort(String hostname, int port, boolean https,
+ String portServlet, boolean sport) throws IOException {
CMS.debug("WizardPanelBase getPort start");
String c = getHttpResponse(hostname, port, https, portServlet,
"secure=" + sport, null);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::getPort() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::getPort() - " + "Exception="
+ + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
@@ -889,7 +932,7 @@ public class WizardPanelBase implements IWizardPanel {
String error = parser.getValue("Error");
throw new IOException(error);
- }
+ }
} catch (IOException e) {
CMS.debug("WizardPanelBase: getPort: " + e.toString());
throw e;
@@ -903,14 +946,16 @@ public class WizardPanelBase implements IWizardPanel {
}
public String getHttpResponse(String hostname, int port, boolean secure,
- String uri, String content, String clientnickname) throws IOException {
- return getHttpResponse(hostname, port, secure, uri, content, clientnickname, null);
+ String uri, String content, String clientnickname)
+ throws IOException {
+ return getHttpResponse(hostname, port, secure, uri, content,
+ clientnickname, null);
}
- public String getHttpResponse(String hostname, int port, boolean secure,
- String uri, String content, String clientnickname,
- SSLCertificateApprovalCallback certApprovalCallback)
- throws IOException {
+ public String getHttpResponse(String hostname, int port, boolean secure,
+ String uri, String content, String clientnickname,
+ SSLCertificateApprovalCallback certApprovalCallback)
+ throws IOException {
HttpClient httpclient = null;
String c = null;
@@ -939,7 +984,8 @@ public class WizardPanelBase implements IWizardPanel {
if (content != null && content.length() > 0) {
String content_c = content;
- httprequest.setHeader("content-length", "" + content_c.length());
+ httprequest
+ .setHeader("content-length", "" + content_c.length());
httprequest.setContent(content_c);
}
HttpResponse httpresponse = httpclient.send(httprequest);
@@ -947,7 +993,8 @@ public class WizardPanelBase implements IWizardPanel {
c = httpresponse.getContent();
} catch (ConnectException e) {
CMS.debug("WizardPanelBase getHttpResponse: " + e.toString());
- throw new IOException("The server you tried to contact is not running.");
+ throw new IOException(
+ "The server you tried to contact is not running.");
} catch (Exception e) {
CMS.debug("WizardPanelBase getHttpResponse: " + e.toString());
throw new IOException(e.toString());
@@ -960,56 +1007,55 @@ public class WizardPanelBase implements IWizardPanel {
return c;
}
- public boolean isSDHostDomainMaster (IConfigStore config) {
- String dm="false";
+ public boolean isSDHostDomainMaster(IConfigStore config) {
+ String dm = "false";
try {
String hostname = config.getString("securitydomain.host");
- int httpsadminport = config.getInteger("securitydomain.httpsadminport");
+ int httpsadminport = config
+ .getInteger("securitydomain.httpsadminport");
CMS.debug("Getting domain.xml from CA...");
String c = getDomainXML(hostname, httpsadminport, true);
CMS.debug("Getting DomainMaster from security domain");
- ByteArrayInputStream bis = new ByteArrayInputStream( c.getBytes() );
- XMLObject parser = new XMLObject( bis );
+ ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ XMLObject parser = new XMLObject(bis);
Document doc = parser.getDocument();
- NodeList nodeList = doc.getElementsByTagName( "CA" );
+ NodeList nodeList = doc.getElementsByTagName("CA");
int len = nodeList.getLength();
- for( int i = 0; i < len; i++ ) {
- Vector v_hostname =
- parser.getValuesFromContainer( nodeList.item(i),
- "Host" );
-
- Vector v_https_admin_port =
- parser.getValuesFromContainer( nodeList.item(i),
- "SecureAdminPort" );
-
- Vector v_domain_mgr =
- parser.getValuesFromContainer( nodeList.item(i),
- "DomainManager" );
-
- if( v_hostname.elementAt( 0 ).equals( hostname ) &&
- v_https_admin_port.elementAt( 0 ).equals( Integer.toString(httpsadminport) ) ) {
- dm = v_domain_mgr.elementAt( 0 ).toString();
+ for (int i = 0; i < len; i++) {
+ Vector v_hostname = parser.getValuesFromContainer(
+ nodeList.item(i), "Host");
+
+ Vector v_https_admin_port = parser.getValuesFromContainer(
+ nodeList.item(i), "SecureAdminPort");
+
+ Vector v_domain_mgr = parser.getValuesFromContainer(
+ nodeList.item(i), "DomainManager");
+
+ if (v_hostname.elementAt(0).equals(hostname)
+ && v_https_admin_port.elementAt(0).equals(
+ Integer.toString(httpsadminport))) {
+ dm = v_domain_mgr.elementAt(0).toString();
break;
}
}
} catch (Exception e) {
- CMS.debug( e.toString() );
+ CMS.debug(e.toString());
}
return dm.equalsIgnoreCase("true");
}
-
- public Vector getMasterUrlListFromSecurityDomain( IConfigStore config,
- String type,
- String portType ) {
+
+ public Vector getMasterUrlListFromSecurityDomain(IConfigStore config,
+ String type, String portType) {
Vector v = new Vector();
try {
String hostname = config.getString("securitydomain.host");
- int httpsadminport = config.getInteger("securitydomain.httpsadminport");
+ int httpsadminport = config
+ .getInteger("securitydomain.httpsadminport");
CMS.debug("Getting domain.xml from CA...");
String c = getDomainXML(hostname, httpsadminport, true);
@@ -1026,13 +1072,13 @@ public class WizardPanelBase implements IWizardPanel {
list = "TKSList";
}
- CMS.debug( "Getting " + portType + " from Security Domain ..." );
- if( !portType.equals( "UnSecurePort" ) &&
- !portType.equals( "SecureAgentPort" ) &&
- !portType.equals( "SecurePort" ) &&
- !portType.equals( "SecureAdminPort" ) ) {
- CMS.debug( "getPortFromSecurityDomain: " +
- "unknown port type " + portType );
+ CMS.debug("Getting " + portType + " from Security Domain ...");
+ if (!portType.equals("UnSecurePort")
+ && !portType.equals("SecureAgentPort")
+ && !portType.equals("SecurePort")
+ && !portType.equals("SecureAdminPort")) {
+ CMS.debug("getPortFromSecurityDomain: " + "unknown port type "
+ + portType);
return v;
}
@@ -1042,16 +1088,15 @@ public class WizardPanelBase implements IWizardPanel {
NodeList nodeList = doc.getElementsByTagName(type);
// save domain name in cfg
- config.putString("securitydomain.name",
- parser.getValue("Name"));
+ config.putString("securitydomain.name", parser.getValue("Name"));
int len = nodeList.getLength();
CMS.debug("Len " + len);
for (int i = 0; i < len; i++) {
- Vector v_clone = parser.getValuesFromContainer(nodeList.item(i),
- "Clone");
- String clone = (String)v_clone.elementAt(0);
+ Vector v_clone = parser.getValuesFromContainer(
+ nodeList.item(i), "Clone");
+ String clone = (String) v_clone.elementAt(0);
if (clone.equalsIgnoreCase("true"))
continue;
Vector v_name = parser.getValuesFromContainer(nodeList.item(i),
@@ -1061,11 +1106,8 @@ public class WizardPanelBase implements IWizardPanel {
Vector v_port = parser.getValuesFromContainer(nodeList.item(i),
portType);
- v.addElement( v_name.elementAt(0)
- + " - https://"
- + v_host.elementAt(0)
- + ":"
- + v_port.elementAt(0) );
+ v.addElement(v_name.elementAt(0) + " - https://"
+ + v_host.elementAt(0) + ":" + v_port.elementAt(0));
}
} catch (Exception e) {
CMS.debug(e.toString());
@@ -1074,14 +1116,14 @@ public class WizardPanelBase implements IWizardPanel {
return v;
}
- public Vector getUrlListFromSecurityDomain( IConfigStore config,
- String type,
- String portType ) {
+ public Vector getUrlListFromSecurityDomain(IConfigStore config,
+ String type, String portType) {
Vector v = new Vector();
try {
String hostname = config.getString("securitydomain.host");
- int httpsadminport = config.getInteger("securitydomain.httpsadminport");
+ int httpsadminport = config
+ .getInteger("securitydomain.httpsadminport");
CMS.debug("Getting domain.xml from CA...");
String c = getDomainXML(hostname, httpsadminport, true);
@@ -1098,13 +1140,13 @@ public class WizardPanelBase implements IWizardPanel {
list = "TKSList";
}
- CMS.debug( "Getting " + portType + " from Security Domain ..." );
- if( !portType.equals( "UnSecurePort" ) &&
- !portType.equals( "SecureAgentPort" ) &&
- !portType.equals( "SecurePort" ) &&
- !portType.equals( "SecureAdminPort" ) ) {
- CMS.debug( "getPortFromSecurityDomain: " +
- "unknown port type " + portType );
+ CMS.debug("Getting " + portType + " from Security Domain ...");
+ if (!portType.equals("UnSecurePort")
+ && !portType.equals("SecureAgentPort")
+ && !portType.equals("SecurePort")
+ && !portType.equals("SecureAdminPort")) {
+ CMS.debug("getPortFromSecurityDomain: " + "unknown port type "
+ + portType);
return v;
}
@@ -1114,8 +1156,7 @@ public class WizardPanelBase implements IWizardPanel {
NodeList nodeList = doc.getElementsByTagName(type);
// save domain name in cfg
- config.putString("securitydomain.name",
- parser.getValue("Name"));
+ config.putString("securitydomain.name", parser.getValue("Name"));
int len = nodeList.getLength();
@@ -1127,22 +1168,20 @@ public class WizardPanelBase implements IWizardPanel {
"Host");
Vector v_port = parser.getValuesFromContainer(nodeList.item(i),
portType);
- Vector v_admin_port = parser.getValuesFromContainer(nodeList.item(i),
- "SecureAdminPort");
+ Vector v_admin_port = parser.getValuesFromContainer(
+ nodeList.item(i), "SecureAdminPort");
- if (v_host.elementAt(0).equals(hostname) && v_admin_port.elementAt(0).equals(new Integer(httpsadminport).toString())) {
+ if (v_host.elementAt(0).equals(hostname)
+ && v_admin_port.elementAt(0).equals(
+ new Integer(httpsadminport).toString())) {
// add security domain CA to the beginning of list
- v.add( 0, v_name.elementAt(0)
- + " - https://"
- + v_host.elementAt(0)
- + ":"
- + v_port.elementAt(0) );
+ v.add(0,
+ v_name.elementAt(0) + " - https://"
+ + v_host.elementAt(0) + ":"
+ + v_port.elementAt(0));
} else {
- v.addElement( v_name.elementAt(0)
- + " - https://"
- + v_host.elementAt(0)
- + ":"
- + v_port.elementAt(0) );
+ v.addElement(v_name.elementAt(0) + " - https://"
+ + v_host.elementAt(0) + ":" + v_port.elementAt(0));
}
}
} catch (Exception e) {
@@ -1154,155 +1193,147 @@ public class WizardPanelBase implements IWizardPanel {
// Given an HTTPS Hostname and EE port,
// retrieve the associated HTTPS Admin port
- public String getSecurityDomainAdminPort( IConfigStore config,
- String hostname,
- String https_ee_port,
- String cstype ) {
+ public String getSecurityDomainAdminPort(IConfigStore config,
+ String hostname, String https_ee_port, String cstype) {
String https_admin_port = new String();
try {
- String sd_hostname = config.getString( "securitydomain.host" );
- int sd_httpsadminport =
- config.getInteger( "securitydomain.httpsadminport" );
-
- CMS.debug( "Getting domain.xml from CA ..." );
- String c = getDomainXML( sd_hostname, sd_httpsadminport, true );
-
- CMS.debug( "Getting associated HTTPS Admin port from " +
- "HTTPS Hostname '" + hostname +
- "' and EE port '" + https_ee_port + "'" );
- ByteArrayInputStream bis = new ByteArrayInputStream( c.getBytes() );
- XMLObject parser = new XMLObject( bis );
+ String sd_hostname = config.getString("securitydomain.host");
+ int sd_httpsadminport = config
+ .getInteger("securitydomain.httpsadminport");
+
+ CMS.debug("Getting domain.xml from CA ...");
+ String c = getDomainXML(sd_hostname, sd_httpsadminport, true);
+
+ CMS.debug("Getting associated HTTPS Admin port from "
+ + "HTTPS Hostname '" + hostname + "' and EE port '"
+ + https_ee_port + "'");
+ ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ XMLObject parser = new XMLObject(bis);
Document doc = parser.getDocument();
- NodeList nodeList = doc.getElementsByTagName( cstype.toUpperCase() );
+ NodeList nodeList = doc.getElementsByTagName(cstype.toUpperCase());
int len = nodeList.getLength();
- for( int i = 0; i < len; i++ ) {
- Vector v_hostname =
- parser.getValuesFromContainer( nodeList.item(i),
- "Host" );
-
- Vector v_https_ee_port =
- parser.getValuesFromContainer( nodeList.item(i),
- "SecurePort" );
-
- Vector v_https_admin_port =
- parser.getValuesFromContainer( nodeList.item(i),
- "SecureAdminPort" );
-
- if( v_hostname.elementAt( 0 ).equals( hostname ) &&
- v_https_ee_port.elementAt( 0 ).equals( https_ee_port ) ) {
- https_admin_port =
- v_https_admin_port.elementAt( 0 ).toString();
+ for (int i = 0; i < len; i++) {
+ Vector v_hostname = parser.getValuesFromContainer(
+ nodeList.item(i), "Host");
+
+ Vector v_https_ee_port = parser.getValuesFromContainer(
+ nodeList.item(i), "SecurePort");
+
+ Vector v_https_admin_port = parser.getValuesFromContainer(
+ nodeList.item(i), "SecureAdminPort");
+
+ if (v_hostname.elementAt(0).equals(hostname)
+ && v_https_ee_port.elementAt(0).equals(https_ee_port)) {
+ https_admin_port = v_https_admin_port.elementAt(0)
+ .toString();
break;
}
}
} catch (Exception e) {
- CMS.debug( e.toString() );
+ CMS.debug(e.toString());
}
- return( https_admin_port );
+ return (https_admin_port);
}
- public String getSecurityDomainPort( IConfigStore config,
- String portType ) {
+ public String getSecurityDomainPort(IConfigStore config, String portType) {
String port = new String();
try {
- String hostname = config.getString( "securitydomain.host" );
- int httpsadminport =
- config.getInteger( "securitydomain.httpsadminport" );
-
- CMS.debug( "Getting domain.xml from CA ..." );
- String c = getDomainXML( hostname, httpsadminport, true );
-
- CMS.debug( "Getting " + portType + " from Security Domain ..." );
- if( !portType.equals( "UnSecurePort" ) &&
- !portType.equals( "SecureAgentPort" ) &&
- !portType.equals( "SecurePort" ) &&
- !portType.equals( "SecureAdminPort" ) ) {
- CMS.debug( "getPortFromSecurityDomain: " +
- "unknown port type " + portType );
+ String hostname = config.getString("securitydomain.host");
+ int httpsadminport = config
+ .getInteger("securitydomain.httpsadminport");
+
+ CMS.debug("Getting domain.xml from CA ...");
+ String c = getDomainXML(hostname, httpsadminport, true);
+
+ CMS.debug("Getting " + portType + " from Security Domain ...");
+ if (!portType.equals("UnSecurePort")
+ && !portType.equals("SecureAgentPort")
+ && !portType.equals("SecurePort")
+ && !portType.equals("SecureAdminPort")) {
+ CMS.debug("getPortFromSecurityDomain: " + "unknown port type "
+ + portType);
return "";
}
- ByteArrayInputStream bis = new ByteArrayInputStream( c.getBytes() );
- XMLObject parser = new XMLObject( bis );
+ ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ XMLObject parser = new XMLObject(bis);
Document doc = parser.getDocument();
- NodeList nodeList = doc.getElementsByTagName( "CA" );
+ NodeList nodeList = doc.getElementsByTagName("CA");
int len = nodeList.getLength();
- for( int i = 0; i < len; i++ ) {
- Vector v_admin_port =
- parser.getValuesFromContainer( nodeList.item(i),
- "SecureAdminPort" );
+ for (int i = 0; i < len; i++) {
+ Vector v_admin_port = parser.getValuesFromContainer(
+ nodeList.item(i), "SecureAdminPort");
Vector v_port = null;
- if( portType.equals( "UnSecurePort" ) ) {
- v_port = parser.getValuesFromContainer( nodeList.item(i),
- "UnSecurePort" );
- } else if( portType.equals( "SecureAgentPort" ) ) {
- v_port = parser.getValuesFromContainer( nodeList.item(i),
- "SecureAgentPort" );
- } else if( portType.equals( "SecurePort" ) ) {
- v_port = parser.getValuesFromContainer( nodeList.item(i),
- "SecurePort" );
- } else if( portType.equals( "SecureAdminPort" ) ) {
- v_port = parser.getValuesFromContainer( nodeList.item(i),
- "SecureAdminPort" );
+ if (portType.equals("UnSecurePort")) {
+ v_port = parser.getValuesFromContainer(nodeList.item(i),
+ "UnSecurePort");
+ } else if (portType.equals("SecureAgentPort")) {
+ v_port = parser.getValuesFromContainer(nodeList.item(i),
+ "SecureAgentPort");
+ } else if (portType.equals("SecurePort")) {
+ v_port = parser.getValuesFromContainer(nodeList.item(i),
+ "SecurePort");
+ } else if (portType.equals("SecureAdminPort")) {
+ v_port = parser.getValuesFromContainer(nodeList.item(i),
+ "SecureAdminPort");
}
- if( ( v_port != null ) &&
- ( v_admin_port.elementAt( 0 ).equals(
- Integer.toString( httpsadminport ) ) ) ) {
- port = v_port.elementAt( 0 ).toString();
+ if ((v_port != null)
+ && (v_admin_port.elementAt(0).equals(Integer
+ .toString(httpsadminport)))) {
+ port = v_port.elementAt(0).toString();
break;
}
}
} catch (Exception e) {
- CMS.debug( e.toString() );
+ CMS.debug(e.toString());
}
- return( port );
+ return (port);
}
- public String pingCS( String hostname, int port, boolean https,
- SSLCertificateApprovalCallback certApprovalCallback )
- throws IOException {
- CMS.debug( "WizardPanelBase pingCS: started" );
+ public String pingCS(String hostname, int port, boolean https,
+ SSLCertificateApprovalCallback certApprovalCallback)
+ throws IOException {
+ CMS.debug("WizardPanelBase pingCS: started");
- String c = getHttpResponse( hostname, port, https,
- "/ca/admin/ca/getStatus",
- null, null, certApprovalCallback );
+ String c = getHttpResponse(hostname, port, https,
+ "/ca/admin/ca/getStatus", null, null, certApprovalCallback);
- if( c != null ) {
+ if (c != null) {
try {
- ByteArrayInputStream bis = new
- ByteArrayInputStream( c.getBytes() );
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
String state = null;
try {
- parser = new XMLObject( bis );
- CMS.debug( "WizardPanelBase pingCS: got XML parsed" );
- state = parser.getValue( "State" );
+ parser = new XMLObject(bis);
+ CMS.debug("WizardPanelBase pingCS: got XML parsed");
+ state = parser.getValue("State");
- if( state != null ) {
- CMS.debug( "WizardPanelBase pingCS: state=" + state );
+ if (state != null) {
+ CMS.debug("WizardPanelBase pingCS: state=" + state);
}
} catch (Exception e) {
- CMS.debug( "WizardPanelBase: pingCS: parser failed"
- + e.toString() );
+ CMS.debug("WizardPanelBase: pingCS: parser failed"
+ + e.toString());
}
return state;
- } catch( Exception e ) {
- CMS.debug( "WizardPanelBase: pingCS: " + e.toString() );
- throw new IOException( e.toString() );
+ } catch (Exception e) {
+ CMS.debug("WizardPanelBase: pingCS: " + e.toString());
+ throw new IOException(e.toString());
}
}
- CMS.debug( "WizardPanelBase pingCS: stopped" );
+ CMS.debug("WizardPanelBase pingCS: stopped");
return null;
}
@@ -1311,7 +1342,7 @@ public class WizardPanelBase implements IWizardPanel {
if (s.equals("CA")) {
x = "ca";
} else if (s.equals("KRA")) {
- x = "kra";
+ x = "kra";
} else if (s.equals("OCSP")) {
x = "ocsp";
} else if (s.equals("TKS")) {
@@ -1321,25 +1352,26 @@ public class WizardPanelBase implements IWizardPanel {
return x;
}
- public void getTokenInfo(IConfigStore config, String type, String host,
- int https_ee_port, boolean https, Context context,
- ConfigCertApprovalCallback certApprovalCallback) throws IOException {
+ public void getTokenInfo(IConfigStore config, String type, String host,
+ int https_ee_port, boolean https, Context context,
+ ConfigCertApprovalCallback certApprovalCallback) throws IOException {
CMS.debug("WizardPanelBase getTokenInfo start");
- String uri = "/"+type+"/ee/"+type+"/getTokenInfo";
- CMS.debug("WizardPanelBase getTokenInfo: uri="+uri);
+ String uri = "/" + type + "/ee/" + type + "/getTokenInfo";
+ CMS.debug("WizardPanelBase getTokenInfo: uri=" + uri);
String c = getHttpResponse(host, https_ee_port, https, uri, null, null,
- certApprovalCallback);
+ certApprovalCallback);
if (c != null) {
try {
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ ByteArrayInputStream bis = new ByteArrayInputStream(
+ c.getBytes());
XMLObject parser = null;
try {
parser = new XMLObject(bis);
} catch (Exception e) {
- CMS.debug( "WizardPanelBase::getTokenInfo() - "
- + "Exception="+e.toString() );
- throw new IOException( e.toString() );
+ CMS.debug("WizardPanelBase::getTokenInfo() - "
+ + "Exception=" + e.toString());
+ throw new IOException(e.toString());
}
String status = parser.getValue("Status");
@@ -1350,7 +1382,7 @@ public class WizardPanelBase implements IWizardPanel {
Document doc = parser.getDocument();
NodeList list = doc.getElementsByTagName("name");
int len = list.getLength();
- for (int i=0; i<len; i++) {
+ for (int i = 0; i < len; i++) {
Node n = list.item(i);
NodeList nn = n.getChildNodes();
String name = nn.item(0).getNodeValue();
@@ -1358,30 +1390,35 @@ public class WizardPanelBase implements IWizardPanel {
nn = parent.getChildNodes();
int len1 = nn.getLength();
String v = "";
- for (int j=0; j<len1; j++) {
+ for (int j = 0; j < len1; j++) {
Node nv = nn.item(j);
String val = nv.getNodeName();
if (val.equals("value")) {
NodeList n2 = nv.getChildNodes();
if (n2.getLength() > 0)
v = n2.item(0).getNodeValue();
- break;
+ break;
}
}
- if (name.equals("cloning.signing.nickname")) {
+ if (name.equals("cloning.signing.nickname")) {
config.putString("preop.master.signing.nickname", v);
config.putString(type + ".cert.signing.nickname", v);
config.putString(name, v);
} else if (name.equals("cloning.ocsp_signing.nickname")) {
- config.putString("preop.master.ocsp_signing.nickname", v);
- config.putString(type + ".cert.ocsp_signing.nickname", v);
+ config.putString(
+ "preop.master.ocsp_signing.nickname", v);
+ config.putString(type
+ + ".cert.ocsp_signing.nickname", v);
config.putString(name, v);
} else if (name.equals("cloning.subsystem.nickname")) {
- config.putString("preop.master.subsystem.nickname", v);
- config.putString(type + ".cert.subsystem.nickname", v);
+ config.putString("preop.master.subsystem.nickname",
+ v);
+ config.putString(type + ".cert.subsystem.nickname",
+ v);
config.putString(name, v);
} else if (name.equals("cloning.transport.nickname")) {
- config.putString("preop.master.transport.nickname", v);
+ config.putString("preop.master.transport.nickname",
+ v);
config.putString("kra.transportUnit.nickName", v);
config.putString("kra.cert.transport.nickname", v);
config.putString(name, v);
@@ -1390,35 +1427,45 @@ public class WizardPanelBase implements IWizardPanel {
config.putString("kra.storageUnit.nickName", v);
config.putString("kra.cert.storage.nickname", v);
config.putString(name, v);
- } else if (name.equals("cloning.audit_signing.nickname")) {
- config.putString("preop.master.audit_signing.nickname", v);
- config.putString(type + ".cert.audit_signing.nickname", v);
+ } else if (name
+ .equals("cloning.audit_signing.nickname")) {
+ config.putString(
+ "preop.master.audit_signing.nickname", v);
+ config.putString(type
+ + ".cert.audit_signing.nickname", v);
config.putString(name, v);
} else if (name.equals("cloning.module.token")) {
config.putString("preop.module.token", v);
} else if (name.startsWith("cloning.ca")) {
- config.putString(name.replaceFirst("cloning", "preop"), v);
+ config.putString(
+ name.replaceFirst("cloning", "preop"), v);
} else if (name.startsWith("cloning")) {
- config.putString(name.replaceFirst("cloning", "preop.cert"), v);
+ config.putString(
+ name.replaceFirst("cloning", "preop.cert"),
+ v);
} else {
config.putString(name, v);
}
}
// reset nicknames for system cert verification
- String token = config.getString("preop.module.token",
- "Internal Key Storage Token");
- if (! token.equals("Internal Key Storage Token")) {
+ String token = config.getString("preop.module.token",
+ "Internal Key Storage Token");
+ if (!token.equals("Internal Key Storage Token")) {
String certlist = config.getString("preop.cert.list");
StringTokenizer t1 = new StringTokenizer(certlist, ",");
while (t1.hasMoreTokens()) {
String tag = t1.nextToken();
- if (tag.equals("sslserver")) continue;
- config.putString(type + ".cert." + tag + ".nickname",
- token + ":" +
- config.getString(type + ".cert." + tag + ".nickname", ""));
- }
+ if (tag.equals("sslserver"))
+ continue;
+ config.putString(
+ type + ".cert." + tag + ".nickname",
+ token
+ + ":"
+ + config.getString(type + ".cert."
+ + tag + ".nickname", ""));
+ }
}
} else {
String error = parser.getValue("Error");
@@ -1431,7 +1478,7 @@ public class WizardPanelBase implements IWizardPanel {
CMS.debug("WizardPanelBase: getTokenInfo: " + e.toString());
throw new IOException(e.toString());
}
- }
+ }
}
public void importCertChain(String id) throws IOException {
@@ -1442,31 +1489,32 @@ public class WizardPanelBase implements IWizardPanel {
try {
pkcs7 = config.getString(configName, "");
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
if (pkcs7.length() > 0) {
try {
CryptoUtil.importCertificateChain(pkcs7);
} catch (Exception e) {
- CMS.debug("DisplayCertChainPanel importCertChain: Exception: "+e.toString());
+ CMS.debug("DisplayCertChainPanel importCertChain: Exception: "
+ + e.toString());
}
}
}
public void updateCertChain(IConfigStore config, String name, String host,
- int https_admin_port, boolean https, Context context) throws IOException {
- updateCertChain( config, name, host, https_admin_port,
- https, context, null );
+ int https_admin_port, boolean https, Context context)
+ throws IOException {
+ updateCertChain(config, name, host, https_admin_port, https, context,
+ null);
}
public void updateCertChain(IConfigStore config, String name, String host,
- int https_admin_port, boolean https, Context context,
- ConfigCertApprovalCallback certApprovalCallback) throws IOException {
- String certchain = getCertChainUsingSecureAdminPort( host,
- https_admin_port,
- https,
- certApprovalCallback );
- config.putString("preop."+name+".pkcs7", certchain);
+ int https_admin_port, boolean https, Context context,
+ ConfigCertApprovalCallback certApprovalCallback) throws IOException {
+ String certchain = getCertChainUsingSecureAdminPort(host,
+ https_admin_port, https, certApprovalCallback);
+ config.putString("preop." + name + ".pkcs7", certchain);
byte[] decoded = CryptoUtil.base64Decode(certchain);
java.security.cert.X509Certificate[] b_certchain = null;
@@ -1474,8 +1522,7 @@ public class WizardPanelBase implements IWizardPanel {
try {
b_certchain = CryptoUtil.getX509CertificateFromPKCS7(decoded);
} catch (Exception e) {
- context.put("errorString",
- "Failed to get the certificate chain.");
+ context.put("errorString", "Failed to get the certificate chain.");
return;
}
@@ -1483,7 +1530,7 @@ public class WizardPanelBase implements IWizardPanel {
if (b_certchain != null) {
size = b_certchain.length;
}
- config.putInteger("preop."+name+".certchain.size", size);
+ config.putInteger("preop." + name + ".certchain.size", size);
for (int i = 0; i < size; i++) {
byte[] bb = null;
@@ -1491,11 +1538,11 @@ public class WizardPanelBase implements IWizardPanel {
bb = b_certchain[i].getEncoded();
} catch (Exception e) {
context.put("errorString",
- "Failed to get the der-encoded certificate chain.");
+ "Failed to get the der-encoded certificate chain.");
return;
}
- config.putString("preop."+name+".certchain." + i,
- CryptoUtil.normalizeCertStr(CryptoUtil.base64Encode(bb)));
+ config.putString("preop." + name + ".certchain." + i,
+ CryptoUtil.normalizeCertStr(CryptoUtil.base64Encode(bb)));
}
try {
@@ -1504,16 +1551,13 @@ public class WizardPanelBase implements IWizardPanel {
}
}
- public void updateCertChainUsingSecureEEPort( IConfigStore config,
- String name, String host,
- int https_ee_port,
- boolean https,
- Context context,
- ConfigCertApprovalCallback certApprovalCallback ) throws IOException {
- String certchain = getCertChainUsingSecureEEPort( host, https_ee_port,
- https,
- certApprovalCallback);
- config.putString("preop."+name+".pkcs7", certchain);
+ public void updateCertChainUsingSecureEEPort(IConfigStore config,
+ String name, String host, int https_ee_port, boolean https,
+ Context context, ConfigCertApprovalCallback certApprovalCallback)
+ throws IOException {
+ String certchain = getCertChainUsingSecureEEPort(host, https_ee_port,
+ https, certApprovalCallback);
+ config.putString("preop." + name + ".pkcs7", certchain);
byte[] decoded = CryptoUtil.base64Decode(certchain);
java.security.cert.X509Certificate[] b_certchain = null;
@@ -1521,8 +1565,7 @@ public class WizardPanelBase implements IWizardPanel {
try {
b_certchain = CryptoUtil.getX509CertificateFromPKCS7(decoded);
} catch (Exception e) {
- context.put("errorString",
- "Failed to get the certificate chain.");
+ context.put("errorString", "Failed to get the certificate chain.");
return;
}
@@ -1530,7 +1573,7 @@ public class WizardPanelBase implements IWizardPanel {
if (b_certchain != null) {
size = b_certchain.length;
}
- config.putInteger("preop."+name+".certchain.size", size);
+ config.putInteger("preop." + name + ".certchain.size", size);
for (int i = 0; i < size; i++) {
byte[] bb = null;
@@ -1538,11 +1581,11 @@ public class WizardPanelBase implements IWizardPanel {
bb = b_certchain[i].getEncoded();
} catch (Exception e) {
context.put("errorString",
- "Failed to get the der-encoded certificate chain.");
+ "Failed to get the der-encoded certificate chain.");
return;
}
- config.putString("preop."+name+".certchain." + i,
- CryptoUtil.normalizeCertStr(CryptoUtil.base64Encode(bb)));
+ config.putString("preop." + name + ".certchain." + i,
+ CryptoUtil.normalizeCertStr(CryptoUtil.base64Encode(bb)));
}
try {
@@ -1557,27 +1600,28 @@ public class WizardPanelBase implements IWizardPanel {
CryptoToken tok = cm.getTokenByName(tokenname);
CryptoStore store = tok.getCryptoStore();
String fullnickname = nickname;
- if (!tokenname.equals("") &&
- !tokenname.equals("Internal Key Storage Token") &&
- !tokenname.equals("internal"))
- fullnickname = tokenname+":"+nickname;
+ if (!tokenname.equals("")
+ && !tokenname.equals("Internal Key Storage Token")
+ && !tokenname.equals("internal"))
+ fullnickname = tokenname + ":" + nickname;
- CMS.debug("WizardPanelBase deleteCert: nickname="+fullnickname);
- org.mozilla.jss.crypto.X509Certificate cert = cm.findCertByNickname(fullnickname);
+ CMS.debug("WizardPanelBase deleteCert: nickname=" + fullnickname);
+ org.mozilla.jss.crypto.X509Certificate cert = cm
+ .findCertByNickname(fullnickname);
if (store instanceof PK11Store) {
CMS.debug("WizardPanelBase deleteCert: this is pk11store");
- PK11Store pk11store = (PK11Store)store;
+ PK11Store pk11store = (PK11Store) store;
pk11store.deleteCertOnly(cert);
CMS.debug("WizardPanelBase deleteCert: cert deleted successfully");
}
} catch (Exception e) {
- CMS.debug("WizardPanelBase deleteCert: Exception="+e.toString());
+ CMS.debug("WizardPanelBase deleteCert: Exception=" + e.toString());
}
}
public void deleteEntries(LDAPSearchResults res, LDAPConnection conn,
- String dn, String[] entries) {
+ String dn, String[] entries) {
String[] attrs = null;
LDAPSearchConstraints cons = null;
String filter = "objectclass=*";
@@ -1589,29 +1633,32 @@ public class WizardPanelBase implements IWizardPanel {
while (res.hasMoreElements()) {
LDAPEntry entry = res.next();
String dn1 = entry.getDN();
- LDAPSearchResults res1 = conn.search(dn1, 1, filter, attrs, true, cons);
+ LDAPSearchResults res1 = conn.search(dn1, 1, filter, attrs,
+ true, cons);
deleteEntries(res1, conn, dn1, entries);
deleteEntry(conn, dn1, entries);
}
}
} catch (Exception ee) {
- CMS.debug("WizardPanelBase deleteEntries: Exception="+ee.toString());
+ CMS.debug("WizardPanelBase deleteEntries: Exception="
+ + ee.toString());
}
}
public void deleteEntry(LDAPConnection conn, String dn, String[] entries) {
try {
- for (int i=0; i<entries.length; i++) {
+ for (int i = 0; i < entries.length; i++) {
if (LDAPDN.equals(dn, entries[i])) {
- CMS.debug("WizardPanelBase deleteEntry: entry with this dn "+dn+" is not deleted.");
+ CMS.debug("WizardPanelBase deleteEntry: entry with this dn "
+ + dn + " is not deleted.");
return;
}
}
- CMS.debug("WizardPanelBase deleteEntry: deleting dn="+dn);
+ CMS.debug("WizardPanelBase deleteEntry: deleting dn=" + dn);
conn.delete(dn);
} catch (Exception e) {
- CMS.debug("WizardPanelBase deleteEntry: Exception="+e.toString());
+ CMS.debug("WizardPanelBase deleteEntry: Exception=" + e.toString());
}
}
@@ -1624,12 +1671,17 @@ public class WizardPanelBase implements IWizardPanel {
int cs_port = cs.getInteger("pkicreate.admin_secure_port", -1);
int panel = getPanelNo();
String subsystem = cs.getString("cs.type", "");
- String urlVal = "https://"+cs_hostname+":"+cs_port+"/"+toLowerCaseSubsystemType(subsystem)+"/admin/console/config/wizard?p="+panel+"&subsystem="+subsystem;
+ String urlVal = "https://" + cs_hostname + ":" + cs_port + "/"
+ + toLowerCaseSubsystemType(subsystem)
+ + "/admin/console/config/wizard?p=" + panel + "&subsystem="
+ + subsystem;
String encodedValue = URLEncoder.encode(urlVal, "UTF-8");
- String sdurl = "https://"+hostname+":"+port+"/ca/admin/ca/securityDomainLogin?url="+encodedValue;
+ String sdurl = "https://" + hostname + ":" + port
+ + "/ca/admin/ca/securityDomainLogin?url=" + encodedValue;
response.sendRedirect(sdurl);
} catch (Exception e) {
- CMS.debug("WizardPanelBase reloginSecurityDomain: Exception="+e.toString());
+ CMS.debug("WizardPanelBase reloginSecurityDomain: Exception="
+ + e.toString());
}
}
}