summaryrefslogtreecommitdiffstats
path: root/pki/base/silent/src/com/netscape/pkisilent/common
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/silent/src/com/netscape/pkisilent/common')
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/AutoInstaller.java98
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/BaseState.java34
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSConfig.java13
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSInstance.java49
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java77
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java282
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSTask.java10
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CertificateRecord.java8
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java106
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java33
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/DirEnroll.java61
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java19
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/PostQuery.java17
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/Request.java151
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/ServerInfo.java48
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java85
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java62
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java18
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java78
19 files changed, 566 insertions, 683 deletions
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/AutoInstaller.java b/pki/base/silent/src/com/netscape/pkisilent/common/AutoInstaller.java
index 925e04dc..7ba9d586 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/AutoInstaller.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/AutoInstaller.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -26,15 +27,12 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Properties;
-
-
/**
- * CMS Test Framework.
- * Use this class to Configure a CA, RA,DRM,OCSP and SubCA subsystem.
+ * CMS Test Framework.
+ * Use this class to Configure a CA, RA,DRM,OCSP and SubCA subsystem.
* This simulartes the installation wizard functions and helps to configure a CMS subsystem.
*/
-
public class AutoInstaller {
private static Properties props = null;
@@ -54,10 +52,10 @@ public class AutoInstaller {
private String configURL, deamonURL, certInstID;
private String inputLine;
private boolean st = false;
-
+
private String postQuery = null;
private String propFileName;
- private StringBuffer spage = new StringBuffer();
+ private StringBuffer spage = new StringBuffer();
// 4.5 server String CERTtokenName="Internal Key Storage Token";
private String CERTtokenName = "internal";
@@ -70,7 +68,8 @@ public class AutoInstaller {
// / Constructors
- public AutoInstaller() {}
+ public AutoInstaller() {
+ }
/**
* Constructor . Takes parameter Server Root .
@@ -81,7 +80,7 @@ public class AutoInstaller {
// Set InternalDBVInfo
/**
- * Set Internal Database Information . Takes parameters internaldatabase hostname, internaldatabase port, internaldatabase name, internaldatabase binddn, internaldatabase password
+ * Set Internal Database Information . Takes parameters internaldatabase hostname, internaldatabase port, internaldatabase name, internaldatabase binddn, internaldatabase password
*/
public void setInternalDBInfo(String dbh, String dbp, String dbname, String dbdn, String dbpswd) {
@@ -109,7 +108,8 @@ public class AutoInstaller {
} catch (Exception e) {
System.out.println("exception " + e.getMessage());
try {
- if (f0 != null) f0.close();
+ if (f0 != null)
+ f0.close();
} catch (IOException ioe) {
System.out.println("IO Exception: " + ioe.getMessage());
}
@@ -137,23 +137,25 @@ public class AutoInstaller {
f2.write(b);
f1.close();
- f2.close();
+ f2.close();
return true;
} catch (Exception e) {
System.out.println("exception " + e.getMessage());
try {
- if (f1 != null) f1.close();
+ if (f1 != null)
+ f1.close();
} catch (IOException ioe) {
System.out.println("IO Exception: " + ioe.getMessage());
}
try {
- if (f2 != null) f2.close();
+ if (f2 != null)
+ f2.close();
} catch (IOException ioe) {
System.out.println("IO Exception: " + ioe.getMessage());
}
return false;
}
-
+
}
// Get RaSigning Cert
@@ -199,8 +201,8 @@ public class AutoInstaller {
// Set ClientDB Info;
/**
- * Sets Client Database information . Takes paramters : certdbdir, certdbpasswd, certnickanme
- */
+ * Sets Client Database information . Takes paramters : certdbdir, certdbpasswd, certnickanme
+ */
public void setClientDBInfo(String cd, String pwd, String nickname) {
@@ -223,7 +225,7 @@ public class AutoInstaller {
// Set Subsystem Information for Configuring
/**
- * Takes parameters - sID- ServerID e.x cert1, sRoot- ServerRootK kT- keyType "RSA/DSA" , kL - keylength (1024.2048) , cVD- certificate validity dates e.g 365 for 1 year, sdn - subsystems dn, sAdp - subsystem's Admin port, sAgp - subsystems's Agentport,seSP- subsystem's ee SSL port , sep- Subsystems ee port.
+ * Takes parameters - sID- ServerID e.x cert1, sRoot- ServerRootK kT- keyType "RSA/DSA" , kL - keylength (1024.2048) , cVD- certificate validity dates e.g 365 for 1 year, sdn - subsystems dn, sAdp - subsystem's Admin port, sAgp - subsystems's Agentport,seSP- subsystem's ee SSL port , sep- Subsystems ee port.
*/
public void setSubSystemInfo(String sID, String sRoot, String kT, String kL, String hT, String cVD, String sdn, String sAdP, String sAgP, String seSP, String seP) {
@@ -286,7 +288,7 @@ public class AutoInstaller {
certAdminUid = aduid;
certAdminPWD = adp;
SingleSignOnPWD = ssonpwd;
- signingCert = "raSigningCert";
+ signingCert = "raSigningCert";
certType = signingCert;
subsystems = "tks";
ra = "false";
@@ -440,7 +442,6 @@ public class AutoInstaller {
* Confiures a RA Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
*/
-
public boolean ConfigureRA(String adn, String aduid, String adp, String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
@@ -477,7 +478,6 @@ public class AutoInstaller {
* Confiures a OCSP Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
*/
-
public boolean ConfigureOCSP(String adn, String aduid, String adp, String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
@@ -513,7 +513,6 @@ public class AutoInstaller {
* Confiures a KRA Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
*/
-
public boolean ConfigureKRA(String adn, String aduid, String adp, String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
@@ -548,7 +547,6 @@ public class AutoInstaller {
* Confiures a SubCA Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
*/
-
public boolean ConfigureSubCA(String adn, String aduid, String adp, String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
@@ -594,7 +592,8 @@ public class AutoInstaller {
System.out.println("exception " + e.getMessage());
}
try {
- if (fis != null) fis.close();
+ if (fis != null)
+ fis.close();
} catch (IOException ioe) {
System.out.println("IO Exception: " + ioe.getMessage());
}
@@ -629,7 +628,7 @@ public class AutoInstaller {
spage = sm.getPage();
return st;
}
-
+
private boolean startDeamon() {
// Set StringURL to connect , set the query string and Connect .Get the result
System.out.println("Log Info - configuring Cert Instance : Start Deamon");
@@ -726,13 +725,13 @@ public class AutoInstaller {
query += "&opType=" + URLEncoder.encode("OP_MODIFY");
query += "&taskID=" + URLEncoder.encode("selectSubsystems");
query += "&cmsSeed=0";
-
+
if (subsystems.equals("ca")) {
query += "&internaldb.ldapconn.host="
+ URLEncoder.encode(dbConnHost);
query += "&internaldb.ldapconn.port="
+ URLEncoder.encode(dbConnPort);
-
+
}
if (subsystems.equals("ra")) {
query += "&caHostname=" + caHostname;
@@ -978,8 +977,8 @@ public class AutoInstaller {
query += "&aki=true";
query += "&keyUsage=true";
query += "&caSigningCertReqFormat=PKCS10";
- }
-
+ }
+
if (subsystems.equals("ra")) {
query += "&aki=" + URLEncoder.encode(aki);
query += "&keyUsage=" + URLEncoder.encode("true");
@@ -1013,7 +1012,7 @@ public class AutoInstaller {
query += "&taskID=" + URLEncoder.encode("certRequest");
query += "&caHostname=" + caHostname;
query += "&caEEPort=" + caEEPort;
- query += "&cmsSeed=0";
+ query += "&cmsSeed=0";
setPostQueryString(query);
if (!Connect(myStringUrl)) {
@@ -1082,7 +1081,7 @@ public class AutoInstaller {
query += "&serverRoot=" + URLEncoder.encode(serverRoot);
query += "&caEEPort=" + caEEPort;
query += "&caHostname=" + host;
- query += "&caEEType=https";
+ query += "&caEEType=https";
query += "&opType=" + URLEncoder.encode("OP_MODIFY");
query += "&taskID=" + URLEncoder.encode("reqSuccess");
query += "&cmsSeed=0";
@@ -1103,7 +1102,7 @@ public class AutoInstaller {
// install cert
System.out.println(
- "configuring Cert Instance : install cert :" + cert);
+ "configuring Cert Instance : install cert :" + cert);
setConfigURL();
myStringUrl = "http://" + host + ":" + adminPort + configURL;
System.out.println(myStringUrl);
@@ -1115,7 +1114,7 @@ public class AutoInstaller {
if (certType.equals("raSigningCert")) {
query += "&nickname="
- + URLEncoder.encode(certType + " " + instanceID);
+ + URLEncoder.encode(certType + " " + instanceID);
raSigningCert = "-----BEGIN CERTIFICATE-----" + "\n"
+ cr.getCert() + "\n"
+ "-----END CERTIFICATE-----\n";
@@ -1128,30 +1127,30 @@ public class AutoInstaller {
kraTransportCert = cCrypto.normalize(cr.getCert());
}
- if (certType.equals("serverCert")) {
+ if (certType.equals("serverCert")) {
query += "&nickname="
- + URLEncoder.encode("Server-Cert" + " " + instanceID);
+ + URLEncoder.encode("Server-Cert" + " " + instanceID);
}
if (certType.equals("ocspSigningCert")) {
query += "&nickname="
+ URLEncoder.encode(certType + " " + instanceID);
}
-
+
query += "&pkcs10=" + URLEncoder.encode(cert);
query += "&opType=" + URLEncoder.encode("OP_MODIFY");
query += "&taskID=" + URLEncoder.encode("installCert");
query += "&cmsSeed=0";
setPostQueryString(query);
- return(Connect(myStringUrl));
+ return (Connect(myStringUrl));
}
} else {
System.out.println("Error: Request is not approved");
return false;
}
- return true;
+ return true;
}
private String getString(int m) {
@@ -1163,19 +1162,19 @@ public class AutoInstaller {
private boolean createCert() {
System.out.println("configuring Cert Instance : Create Cert");
-
+
// clauclate the validity dates for the cert.
GregorianCalendar begin = new GregorianCalendar();
GregorianCalendar end = new GregorianCalendar();
Integer days = new Integer(certValidityDays);
end.add(GregorianCalendar.DATE, days.intValue());
-
+
setConfigURL();
String myStringUrl = "http://" + host + ":" + adminPort + configURL;
System.out.println(myStringUrl);
-
+
String query = "AdminUserPassword=" + URLEncoder.encode(adminPWD);
query += "&";
@@ -1225,7 +1224,7 @@ public class AutoInstaller {
if (certType.equals("serverCert")) {
query += "&sslServerBit=" + URLEncoder.encode("true");
query += "&sslClientBit=" + URLEncoder.encode("true");
-
+
} else {
query += "&caOComponent=" + URLEncoder.encode(caOComponent);
query += "&caCComponent=" + URLEncoder.encode("us");
@@ -1237,7 +1236,7 @@ public class AutoInstaller {
query += "&mailCABit=" + URLEncoder.encode(mailCABit);
query += "&objectSigningCABit="
+ URLEncoder.encode(objectSigningCABit);
-
+
}
query += "&hashType=" + URLEncoder.encode(hashType);
@@ -1271,7 +1270,7 @@ public class AutoInstaller {
query += "&pwcTokenname=" + URLEncoder.encode("internal");
query += "&singlesignon=" + URLEncoder.encode(tokenPWD);
-
+
query += "&opType=" + URLEncoder.encode("OP_MODIFY");
query += "&taskID=" + URLEncoder.encode("singleSignon");
query += "&cmsSeed=0";
@@ -1308,7 +1307,7 @@ public class AutoInstaller {
}
private boolean exitDeamon() {
-
+
System.out.println("configuring Cert Instance : Exit Deamon");
setDeamonURL();
String myStringUrl = "http://" + host + ":" + adminPort + configURL;
@@ -2212,12 +2211,12 @@ public class AutoInstaller {
}
if (subsystems.equals("ocsp")) {
return ConfOCSP();
- }
+ }
if (subsystems.equals("kra")) {
return ConfKRA();
}
if (subsystems.equals("subca")) {
- subca = true;
+ subca = true;
subsystems = "ca";
return ConfSubCA();
}
@@ -2230,7 +2229,6 @@ public class AutoInstaller {
// - 1 Configured and server Alive
// - 0 Configured bur could not sart server
-
AutoInstaller t = new AutoInstaller();
System.out.println(args.length);
@@ -2239,13 +2237,13 @@ public class AutoInstaller {
if (args.length < 1) {
System.out.println("Usage : PropertiesFilePath");
System.exit(-1);
- }
-
+ }
+
System.out.println("configuring Cert Instance : Start");
boolean st = t.readProperties();
- if (st) {
+ if (st) {
System.out.println("Configuring Cert Instance : Successful");
System.exit(1);
} else {
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/BaseState.java b/pki/base/silent/src/com/netscape/pkisilent/common/BaseState.java
index a3ceec31..99487a8f 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/BaseState.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/BaseState.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,40 +18,37 @@ package com.netscape.pkisilent.common;
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
-
-
/**
* CMS Test framework .
- * This class reads and sets the values for a CMS subsytems Config file (CS.cfg)
- * Using this class you can set the server to a base state.
+ * This class reads and sets the values for a CMS subsytems Config file (CS.cfg)
+ * Using this class you can set the server to a base state.
*/
-
-
public class BaseState {
private String CMSConfigFile;
private CMSConfig cmscfg = null;
private String ldapbase, ldaphost, ldapport, ldapdn, ldapdnpw;
private boolean ldapsecConn = false;
- // Constructor
-
+ // Constructor
- public BaseState() {}
+ public BaseState() {
+ }
/**
- * Constructor . Takes the parameter CMSConfigfilename ( with fullpath)
+ * Constructor . Takes the parameter CMSConfigfilename ( with fullpath)
+ *
* @param CMSConfigfile.
*/
- public BaseState(String cmscfilename) {
+ public BaseState(String cmscfilename) {
CMSConfigFile = cmscfilename;
}
/**
- * Set the publishing directory information . Takes the paramters ldaphost,ldapport,ldapDN, ldapDN password, BaseDN , Secure coonection (true/false)
+ * Set the publishing directory information . Takes the paramters ldaphost,ldapport,ldapDN, ldapDN password, BaseDN , Secure coonection (true/false)
*/
public void setLDAPInfo(String h, String p, String dn, String pw, String base, boolean sc) {
ldaphost = h;
@@ -63,8 +61,8 @@ public class BaseState {
}
/**
- * Enable SSL Client authentication for Directory enrollment and publishing
- */
+ * Enable SSL Client authentication for Directory enrollment and publishing
+ */
public void EnableSSLClientAuth() {
ldapsecConn = true;
@@ -79,7 +77,7 @@ public class BaseState {
}
/**
- * Set to CA 's base state . Enables Directory based enrollment , publishing and Portal enrollment
+ * Set to CA 's base state . Enables Directory based enrollment , publishing and Portal enrollment
*/
public void CABaseState() {
@@ -98,10 +96,9 @@ public class BaseState {
}
/**
- * Set to RA 's base state . Enables Directory based enrollment and Portal enrollment
+ * Set to RA 's base state . Enables Directory based enrollment and Portal enrollment
*/
-
public void RABaseState() {
cmscfg = new CMSConfig(CMSConfigFile);
cmscfg.EnableAdminEnrollment();
@@ -114,6 +111,7 @@ public class BaseState {
}
- public static void main(String args[]) {}// end of function main
+ public static void main(String args[]) {
+ }// end of function main
}
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSConfig.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSConfig.java
index 94c57a62..5a933a22 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSConfig.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSConfig.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -20,20 +21,17 @@ package com.netscape.pkisilent.common;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-
/**
* CMS Test framework .
- * This class reads,modifies and saves CS.cfg file
+ * This class reads,modifies and saves CS.cfg file
*/
-
-public class CMSConfig extends ServerInfo {
+public class CMSConfig extends ServerInfo {
/**
* Constructor . Reads the CS.cfg file .Takes the parameter for Configfile ( Provide fullpath)
*/
-
public CMSConfig(String confFile) {
CMSConfigFile = confFile;
System.out.println(CMSConfigFile);
@@ -57,7 +55,7 @@ public class CMSConfig extends ServerInfo {
}
/**
- * Saves the config file
+ * Saves the config file
**/
public void saveCMSConfig() {
@@ -85,7 +83,6 @@ public class CMSConfig extends ServerInfo {
// Authentication
-
// Enable DirectoryBased Authentication
/**
* Takes parameters : secureConnection( true/false), basedn, ldaphostname, lapdaportnumber ( in case of secured connection give ldap secured port)
@@ -560,7 +557,7 @@ public class CMSConfig extends ServerInfo {
// s.EnableDirEnrollment(secureC);
s.saveCMSConfig();
-
+
}// end of function main
} // end of class
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSInstance.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSInstance.java
index 0687bc2a..d163a7f1 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSInstance.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSInstance.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -25,7 +26,6 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URLEncoder;
-
public class CMSInstance {
private int i;
@@ -34,10 +34,9 @@ public class CMSInstance {
/**
* CMS Test framework .
- * This class Creates and Removes a CMS server instance
+ * This class Creates and Removes a CMS server instance
*/
-
/**
* Constructor. Takes parameters hostname, adminserverport, adminDN, adminDNpassword, Dominanname, ServerRoot( full path) , instanceID, mnameand sieURL. mname is the fully qualified name of the server ( jupiter2.nscp.aoltw.net) sieURL is ("ldap://jupiter2.nscp.aoltw.net:(ConfigLADPPort)/o=NetscapeRoot"
*/
@@ -101,7 +100,7 @@ public class CMSInstance {
// steps
// 1. create .cfg file
// 2. run create.pl with that .cfg file
-
+
FileOutputStream out = new FileOutputStream(
cs_server_root + "/tps_auto_config.cfg");
BufferedWriter awriter;
@@ -152,12 +151,12 @@ public class CMSInstance {
Runtime r = Runtime.getRuntime();
// String[] se = {"perl", cs_server_root+"/bin/cert/tps/setup/create.pl" , "-i", cs_server_root+"/tps_auto_config.cfg" };
String[] se = {
- "perl",
- "/home/ckannan/cms/src/ns/netkeyra/setup/create.pl", "-i",
- cs_server_root + "/tps_auto_config.cfg" };
+ "perl",
+ "/home/ckannan/cms/src/ns/netkeyra/setup/create.pl", "-i",
+ cs_server_root + "/tps_auto_config.cfg" };
System.out.println(se);
- p = r.exec(se);
+ p = r.exec(se);
p.waitFor();
String line;
@@ -192,7 +191,7 @@ public class CMSInstance {
+ startURL;
System.out.println(myStringUrl);
-
+
String query = "serverRoot=" + URLEncoder.encode(serverRoot);
query += "&instanceID=" + URLEncoder.encode(instanceID);
@@ -205,7 +204,7 @@ public class CMSInstance {
PostQuery sm = new PostQuery(myStringUrl, AdminDN, AdminDNPW, query);
return (sm.Send());
-
+
}
public boolean RemoveInstance() {
@@ -214,11 +213,11 @@ public class CMSInstance {
String myStringUrl = "http://" + host + ":" + port + startURL;
System.out.println(myStringUrl);
-
+
String query = "serverRoot=" + URLEncoder.encode(serverRoot);
query += "&instanceID=" + URLEncoder.encode(instanceID);
-
+
PostQuery sm = new PostQuery(myStringUrl, AdminDN, AdminDNPW, query);
st = sm.Send();
@@ -233,15 +232,15 @@ public class CMSInstance {
myStringUrl = "http://" + host + ":" + port + startURL;
System.out.println(myStringUrl);
-
+
query = "serverRoot=" + URLEncoder.encode(serverRoot);
query += "&InstanceName=" + URLEncoder.encode(instanceID + "-db");
-
+
PostQuery rmdb = new PostQuery(myStringUrl, AdminDN, AdminDNPW, query);
rmdb.setNMCStatus("NMC_Status: 0");
return (rmdb.Send());
-
+
}
public static void main(String args[]) {
@@ -250,38 +249,38 @@ public class CMSInstance {
// Exit Status - (-1) for error
// - 0 FAIL
// - 1 PASS
-
+
boolean st;
-
+
System.out.println(args.length);
if (args.length < 10) {
System.out.println(
"Usage : <task:Create/REmove> host port AdminDN AdminDNPW adminDomain serverRoot instanceID machineName sieURL");
System.exit(-1);
- }
+ }
int task = 0;
args[0] = args[0].toLowerCase();
- if (args[0].equals("create")) {
+ if (args[0].equals("create")) {
task = 0;
}
if (args[0].equals("remove")) {
task = 1;
}
-
+
CMSInstance t = new CMSInstance(args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8], args[9]);
switch (task) {
-
+
case 0:
st = t.CreateInstance();
- if (st) {
+ if (st) {
System.out.println("server Instance created ");
System.exit(1);
} else {
-
+
System.out.println("Error: Server Instance could not be created");
System.exit(0);
}
@@ -289,11 +288,11 @@ public class CMSInstance {
case 1:
st = t.RemoveInstance();
- if (st) {
+ if (st) {
System.out.println("Server instance removed");
System.exit(1);
} else {
-
+
System.out.println("Server instance could not be removed");
System.exit(0);
}
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java
index 038ec42f..643f706a 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -31,15 +32,13 @@ import netscape.ldap.LDAPModificationSet;
import netscape.ldap.LDAPSearchResults;
import netscape.ldap.LDAPv2;
-
/**
* CMS Test framework .
* Using this class you can add a user and user certificate to LDAP server.
- * You can also check if a certificate / CRL is published in LDAP server
- * USe this class to turn of SSL and turn on SSL in a LDAP server.
+ * You can also check if a certificate / CRL is published in LDAP server
+ * USe this class to turn of SSL and turn on SSL in a LDAP server.
*/
-
public class CMSLDAP {
private String HOST, DN, BASEDN, PASSWORD;
@@ -47,7 +46,8 @@ public class CMSLDAP {
private LDAPConnection conn = new LDAPConnection();
- public CMSLDAP() {}
+ public CMSLDAP() {
+ }
/**
* Constructor. Takes parametes ldaphost, ldapport
@@ -68,7 +68,7 @@ public class CMSLDAP {
}
/**
- * Connect to ldap server
+ * Connect to ldap server
*/
public boolean connect() {
@@ -100,11 +100,11 @@ public class CMSLDAP {
/**
* Search for certificaterevocationList attribute. Takes basedn and filter as parameters
- */
+ */
- public boolean searchCRL(String basedn, String filter) throws LDAPException {
+ public boolean searchCRL(String basedn, String filter) throws LDAPException {
int searchScope = LDAPv2.SCOPE_SUB;
- String getAttrs[] = { "certificateRevocationList;binary"};
+ String getAttrs[] = { "certificateRevocationList;binary" };
LDAPSearchResults results = conn.search(basedn, searchScope, filter,
getAttrs, false);
@@ -135,11 +135,9 @@ public class CMSLDAP {
* Search for attriburte usercertificate. Takes parameters basedn and filter
*/
-
-
- public boolean searchUserCert(String basedn, String filter) throws LDAPException {
+ public boolean searchUserCert(String basedn, String filter) throws LDAPException {
int searchScope = LDAPv2.SCOPE_SUB;
- String getAttrs[] = { "usercertificate;binary"};
+ String getAttrs[] = { "usercertificate;binary" };
LDAPSearchResults results = conn.search(basedn, searchScope, filter,
getAttrs, false);
@@ -175,9 +173,9 @@ public class CMSLDAP {
attrSet.add(
new LDAPAttribute("objectclass",
- new String[] {
- "top", "person", "organizationalPerson",
- "inetorgperson"}));
+ new String[] {
+ "top", "person", "organizationalPerson",
+ "inetorgperson" }));
attrSet.add(new LDAPAttribute("cn", cn));
attrSet.add(new LDAPAttribute("mail", uid + "@netscape.com"));
attrSet.add(new LDAPAttribute("userpassword", pwd));
@@ -225,7 +223,7 @@ public class CMSLDAP {
val += ',';
i++;
continue;
- } else {
+ } else {
val += s.charAt(i);
}
}
@@ -258,19 +256,19 @@ public class CMSLDAP {
}
/**
- * Adds a user of objectclass cmsuser . Takes cn,sn,uid,password,certificate as parameters.
+ * Adds a user of objectclass cmsuser . Takes cn,sn,uid,password,certificate as parameters.
*/
public boolean CMSuserAdd(String cn, String sn, String uid, String pwd, byte[] certpack) {
try {
X509Certificate cert = getXCertificate(certpack);
-
+
LDAPAttributeSet attrSet = new LDAPAttributeSet();
attrSet.add(
new LDAPAttribute("objectclass",
- new String[] {
- "top", "person", "organizationalPerson",
- "inetorgperson", "cmsuser"}));
+ new String[] {
+ "top", "person", "organizationalPerson",
+ "inetorgperson", "cmsuser" }));
attrSet.add(new LDAPAttribute("cn", cn));
attrSet.add(new LDAPAttribute("mail", uid + "@netscape.com"));
attrSet.add(new LDAPAttribute("userpassword", pwd));
@@ -301,7 +299,7 @@ public class CMSLDAP {
}
/**
- * Adds a user of objectclass cmsuser . Takes cn,sn,uid,password,certificate as parameters.
+ * Adds a user of objectclass cmsuser . Takes cn,sn,uid,password,certificate as parameters.
*/
public boolean CMSuserAdd(String cn, String sn, String uid, String pwd, X509Certificate cert) {
@@ -310,10 +308,10 @@ public class CMSLDAP {
LDAPAttributeSet attrSet = new LDAPAttributeSet();
attrSet.add(
- new LDAPAttribute("objectclass",
- new String[] {
- "top", "person", "organizationalPerson",
- "inetorgperson", "cmsuser"}));
+ new LDAPAttribute("objectclass",
+ new String[] {
+ "top", "person", "organizationalPerson",
+ "inetorgperson", "cmsuser" }));
attrSet.add(new LDAPAttribute("cn", cn));
attrSet.add(new LDAPAttribute("mail", uid + "@netscape.com"));
attrSet.add(new LDAPAttribute("userpassword", pwd));
@@ -345,7 +343,7 @@ public class CMSLDAP {
}
/**
- * adds a cms user to Trusted Manager Group. Takes uid as parameter.
+ * adds a cms user to Trusted Manager Group. Takes uid as parameter.
*/
public boolean addCMSUserToTMGroup(String uid) {
@@ -370,7 +368,7 @@ public class CMSLDAP {
}
/**
- * adds a cms user to Agent Group. Takes subsytem (ca/ra/ocsp/kra) and uid as parameters .
+ * adds a cms user to Agent Group. Takes subsytem (ca/ra/ocsp/kra) and uid as parameters .
*/
public boolean addCMSUserToAgentGroup(String subsystem, String uid) {
@@ -415,7 +413,7 @@ public class CMSLDAP {
}
/**
- * Will trun of SSL in LDAP server
+ * Will trun of SSL in LDAP server
**/
public boolean TurnOffSSL() {
@@ -430,7 +428,6 @@ public class CMSLDAP {
// conn.delete("cn=RSA,cn=encryption,cn=config");
-
mods.add(LDAPModification.REPLACE, ssl3);
mods.add(LDAPModification.DELETE, ssl3ciphers);
mods.add(LDAPModification.DELETE, kfile);
@@ -464,7 +461,7 @@ public class CMSLDAP {
/**
* Will Turn ON SSL in LDAP server . Takes certPrefix, certificatenickanme and sslport as parameters.
**/
-
+
public boolean TurnOnSSL(String certPrefix, String certName, String sslport) {
String dn;
String CIPHERS = "-rsa_null_md5,+rsa_fips_3des_sha,+rsa_fips_des_sha,+rsa_3des_sha,+rsa_rc4_128_md5,+rsa_des_sha,+rsa_rc2_40_md5,+rsa_rc4_40_md5";
@@ -472,8 +469,8 @@ public class CMSLDAP {
try {
boolean found = false;
int searchScope = LDAPv2.SCOPE_SUB;
- String getAttrs[] = { "nssslactivation"};
-
+ String getAttrs[] = { "nssslactivation" };
+
LDAPModificationSet mods = new LDAPModificationSet();
LDAPAttribute sec = new LDAPAttribute("nsslapd-security", "on");
LDAPAttribute sp = new LDAPAttribute("nsslapd-securePort", sslport);
@@ -481,7 +478,7 @@ public class CMSLDAP {
mods.add(LDAPModification.REPLACE, sec);
mods.add(LDAPModification.REPLACE, sp);
conn.modify("cn=config", mods);
- mods.removeElementAt(1);
+ mods.removeElementAt(1);
mods.removeElementAt(0);
LDAPAttribute ssl3 = new LDAPAttribute("nsssl3", "on");
@@ -500,7 +497,7 @@ public class CMSLDAP {
mods.add(LDAPModification.REPLACE, cauth);
conn.modify("cn=encryption,cn=config", mods);
- int i = 4;
+ int i = 4;
while (i >= 0) {
mods.removeElementAt(i);
@@ -532,7 +529,7 @@ public class CMSLDAP {
attrSet.add(
new LDAPAttribute("objectclass",
- new String[] { "top", "nsEncryptionModule"}));
+ new String[] { "top", "nsEncryptionModule" }));
attrSet.add(new LDAPAttribute("cn", "RSA"));
attrSet.add(
new LDAPAttribute("nsssltoken", "internal (software)"));
@@ -561,7 +558,8 @@ public class CMSLDAP {
String PASSWORD = args[3];
String BASEDN = args[4];
- String s = "MIICFzCCAYCgAwIBAgIBBjANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVz\ndDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTEyMTUx\nMzZaFw0wNDA0MTAwOTQ2NTVaMFwxCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNTU0wxHTAbBgNVBAsT\nFHNzbHRlc3QxMDUwMDk3ODkzNzQ1MSAwHgYDVQQDExdqdXBpdGVyMi5uc2NwLmFvbHR3Lm5ldDBc\nMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDCsCTIIQ+bJMfPHi6kwa7HF+/xSTVHcpZ5zsodXsNWjPlD\noRu/5KAO8NotfwGnYmALWdYnqXCF0q0gkaJQalQTAgMBAAGjRjBEMA4GA1UdDwEB/wQEAwIFoDAR\nBglghkgBhvhCAQEEBAMCBkAwHwYDVR0jBBgwFoAUzxZkSySZT/Y3SxGMEiNyHnLUOPAwDQYJKoZI\nhvcNAQEEBQADgYEALtpqMOtZt6j5KlghDFgdg/dvf36nWiZwC1ap6+ka22shLkA/RjmOix97btzT\nQ+8LcmdkAW5iap4YbtrCu0wdN6IbIEXoQI1QGZBoKO2o02utssXANmTnRCyH/GX2KefQlp1NSRj9\nZNZ+GRT2Qk/8G5Ds9vVjm1I5+/AkzI9jS14=";
+ String s =
+ "MIICFzCCAYCgAwIBAgIBBjANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVz\ndDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTEyMTUx\nMzZaFw0wNDA0MTAwOTQ2NTVaMFwxCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNTU0wxHTAbBgNVBAsT\nFHNzbHRlc3QxMDUwMDk3ODkzNzQ1MSAwHgYDVQQDExdqdXBpdGVyMi5uc2NwLmFvbHR3Lm5ldDBc\nMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDCsCTIIQ+bJMfPHi6kwa7HF+/xSTVHcpZ5zsodXsNWjPlD\noRu/5KAO8NotfwGnYmALWdYnqXCF0q0gkaJQalQTAgMBAAGjRjBEMA4GA1UdDwEB/wQEAwIFoDAR\nBglghkgBhvhCAQEEBAMCBkAwHwYDVR0jBBgwFoAUzxZkSySZT/Y3SxGMEiNyHnLUOPAwDQYJKoZI\nhvcNAQEEBQADgYEALtpqMOtZt6j5KlghDFgdg/dvf36nWiZwC1ap6+ka22shLkA/RjmOix97btzT\nQ+8LcmdkAW5iap4YbtrCu0wdN6IbIEXoQI1QGZBoKO2o02utssXANmTnRCyH/GX2KefQlp1NSRj9\nZNZ+GRT2Qk/8G5Ds9vVjm1I5+/AkzI9jS14=";
s = "-----BEGIN CERTIFICATE-----" + "\n" + s + "\n"
+ "-----END CERTIFICATE-----\n";
@@ -590,7 +588,7 @@ public class CMSLDAP {
// if(!caIdb.searchUserCert("o=mcom.com","uid=test"))
// System.out.println("USer cert is not published");
-
+
// if (!caIdb.CMSuserAdd("ra-trust" ,"ra-trust","ra-trust","netscape",bytes))
// {System.out.println("Trusted MAnager user Could not be add ");}
@@ -609,4 +607,3 @@ public class CMSLDAP {
}
}
-
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java
index bae3e420..c79174f6 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -40,45 +41,29 @@ import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
-
/**
* The <code>Properties</code> class represents a persistent set of
* properties. The <code>Properties</code> can be saved to a stream
* or loaded from a stream. Each key and its corresponding value in
* the property list is a string.
* <p>
- * A property list can contain another property list as its
- * "defaults"; this second property list is searched if
- * the property key is not found in the original property list.
+ * A property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list.
* <p>
- * Because <code>Properties</code> inherits from <code>Hashtable</code>, the
- * <code>put</code> and <code>putAll</code> methods can be applied to a
- * <code>Properties</code> object. Their use is strongly discouraged as they
- * allow the caller to insert entries whose keys or values are not
- * <code>Strings</code>. The <code>setProperty</code> method should be used
- * instead. If the <code>store</code> or <code>save</code> method is called
- * on a "compromised" <code>Properties</code> object that contains a
- * non-<code>String</code> key or value, the call will fail.
+ * Because <code>Properties</code> inherits from <code>Hashtable</code>, the <code>put</code> and <code>putAll</code> methods can be applied to a <code>Properties</code> object. Their use is strongly discouraged as they allow the caller to insert entries whose keys or values are not <code>Strings</code>. The <code>setProperty</code> method should be used instead. If the <code>store</code> or <code>save</code> method is called on a "compromised" <code>Properties</code> object that contains a non-
+ * <code>String</code> key or value, the call will fail.
* <p>
- * <a name="encoding"></a>
- * When saving properties to a stream or loading them from a stream, the
- * ISO 8859-1 character encoding is used. For characters that cannot be directly
- * represented in this encoding,
- * <a href="http://java.sun.com/docs/books/jls/html/3.doc.html#100850">Unicode escapes</a>
- * are used; however, only a single 'u' character is allowed in an escape sequence.
- * The native2ascii tool can be used to convert property files to and from
- * other character encodings.
+ * <a name="encoding"></a> When saving properties to a stream or loading them from a stream, the ISO 8859-1 character encoding is used. For characters that cannot be directly represented in this encoding, <a href="http://java.sun.com/docs/books/jls/html/3.doc.html#100850">Unicode escapes</a> are used; however, only a single 'u' character is allowed in an escape sequence. The native2ascii tool can be used to convert property files to and from other character encodings.
*
* @see <a href="../../../tooldocs/solaris/native2ascii.html">native2ascii tool for Solaris</a>
* @see <a href="../../../tooldocs/win32/native2ascii.html">native2ascii tool for Windows</a>
- *
- * @author Arthur van Hoff
- * @author Michael McCloskey
+ *
+ * @author Arthur van Hoff
+ * @author Michael McCloskey
* @version 1.60, 02/02/00
- * @since JDK1.0
+ * @since JDK1.0
*/
-class CMSProperties extends Hashtable<String,String> {
+class CMSProperties extends Hashtable<String, String> {
/**
* use serialVersionUID from JDK 1.1.X for interoperability
@@ -88,7 +73,7 @@ class CMSProperties extends Hashtable<String,String> {
/**
* A property list that contains default values for any keys not
* found in this property list.
- *
+ *
* @serial
*/
protected CMSProperties defaults;
@@ -102,8 +87,8 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Creates an empty property list with the specified defaults.
- *
- * @param defaults the defaults.
+ *
+ * @param defaults the defaults.
*/
public CMSProperties(CMSProperties defaults) {
this.defaults = defaults;
@@ -113,11 +98,11 @@ class CMSProperties extends Hashtable<String,String> {
* Calls the hashtable method <code>put</code>. Provided for
* parallelism with the <tt>getProperty</tt> method. Enforces use of
* strings for property keys and values.
- *
+ *
* @param key the key to be placed into this property list.
* @param value the value corresponding to <tt>key</tt>.
* @see #getProperty
- * @since 1.2
+ * @since 1.2
*/
public synchronized Object setProperty(String key, String value) {
return put(key, value);
@@ -135,75 +120,54 @@ class CMSProperties extends Hashtable<String,String> {
* Reads a property list (key and element pairs) from the input stream.
* The stream is assumed to be using the ISO 8859-1 character encoding.
* <p>
- * Every property occupies one line of the input stream. Each line
- * is terminated by a line terminator (<code>\n</code> or <code>\r</code>
- * or <code>\r\n</code>). Lines from the input stream are processed until
- * end of file is reached on the input stream.
+ * Every property occupies one line of the input stream. Each line is terminated by a line terminator (<code>\n</code> or <code>\r</code> or <code>\r\n</code>). Lines from the input stream are processed until end of file is reached on the input stream.
* <p>
- * A line that contains only whitespace or whose first non-whitespace
- * character is an ASCII <code>#</code> or <code>!</code> is ignored
- * (thus, <code>#</code> or <code>!</code> indicate comment lines).
+ * A line that contains only whitespace or whose first non-whitespace character is an ASCII <code>#</code> or <code>!</code> is ignored (thus, <code>#</code> or <code>!</code> indicate comment lines).
* <p>
- * Every line other than a blank line or a comment line describes one
- * property to be added to the table (except that if a line ends with \,
- * then the following line, if it exists, is treated as a continuation
- * line, as described
- * below). The key consists of all the characters in the line starting
- * with the first non-whitespace character and up to, but not including,
- * the first ASCII <code>=</code>, <code>:</code>, or whitespace
- * character. All of the key termination characters may be included in
- * the key by preceding them with a \.
- * Any whitespace after the key is skipped; if the first non-whitespace
- * character after the key is <code>=</code> or <code>:</code>, then it
- * is ignored and any whitespace characters after it are also skipped.
- * All remaining characters on the line become part of the associated
- * element string. Within the element string, the ASCII
- * escape sequences <code>\t</code>, <code>\n</code>,
- * <code>\r</code>, <code>\\</code>, <code>\"</code>, <code>\'</code>,
- * <code>\ &#32;</code> &#32;(a backslash and a space), and
- * <code>&#92;u</code><i>xxxx</i> are recognized and converted to single
- * characters. Moreover, if the last character on the line is
- * <code>\</code>, then the next line is treated as a continuation of the
- * current line; the <code>\</code> and line terminator are simply
- * discarded, and any leading whitespace characters on the continuation
- * line are also discarded and are not part of the element string.
+ * Every line other than a blank line or a comment line describes one property to be added to the table (except that if a line ends with \, then the following line, if it exists, is treated as a continuation line, as described below). The key consists of all the characters in the line starting with the first non-whitespace character and up to, but not including, the first ASCII <code>=</code>, <code>:</code>, or whitespace character. All of the key termination characters may be included in
+ * the key by preceding them with a \. Any whitespace after the key is skipped; if the first non-whitespace character after the key is <code>=</code> or <code>:</code>, then it is ignored and any whitespace characters after it are also skipped. All remaining characters on the line become part of the associated element string. Within the element string, the ASCII escape sequences <code>\t</code>, <code>\n</code>, <code>\r</code>, <code>\\</code>, <code>\"</code>, <code>\'</code>,
+ * <code>\ &#32;</code> &#32;(a backslash and a space), and <code>&#92;u</code><i>xxxx</i> are recognized and converted to single characters. Moreover, if the last character on the line is <code>\</code>, then the next line is treated as a continuation of the current line; the <code>\</code> and line terminator are simply discarded, and any leading whitespace characters on the continuation line are also discarded and are not part of the element string.
* <p>
- * As an example, each of the following four lines specifies the key
- * <code>"Truth"</code> and the associated element value
- * <code>"Beauty"</code>:
+ * As an example, each of the following four lines specifies the key <code>"Truth"</code> and the associated element value <code>"Beauty"</code>:
* <p>
+ *
* <pre>
* Truth = Beauty
- * Truth:Beauty
+ * Truth:Beauty
* Truth :Beauty
* </pre>
- * As another example, the following three lines specify a single
- * property:
+ *
+ * As another example, the following three lines specify a single property:
* <p>
+ *
* <pre>
* fruits apple, banana, pear, \
* cantaloupe, watermelon, \
* kiwi, mango
* </pre>
+ *
* The key is <code>"fruits"</code> and the associated element is:
* <p>
- * <pre>"apple, banana, pear, cantaloupe, watermelon,kiwi, mango"</pre>
- * Note that a space appears before each <code>\</code> so that a space
- * will appear after each comma in the final result; the <code>\</code>,
- * line terminator, and leading whitespace on the continuation line are
- * merely discarded and are <i>not</i> replaced by one or more other
- * characters.
+ *
+ * <pre>
+ * &quot;apple, banana, pear, cantaloupe, watermelon,kiwi, mango&quot;
+ * </pre>
+ *
+ * Note that a space appears before each <code>\</code> so that a space will appear after each comma in the final result; the <code>\</code>, line terminator, and leading whitespace on the continuation line are merely discarded and are <i>not</i> replaced by one or more other characters.
* <p>
* As a third example, the line:
* <p>
- * <pre>cheeses
+ *
+ * <pre>
+ * cheeses
* </pre>
- * specifies that the key is <code>"cheeses"</code> and the associated
- * element is the empty string.<p>
- *
- * @param inStream the input stream.
- * @exception IOException if an error occurred when reading from the
- * input stream.
+ *
+ * specifies that the key is <code>"cheeses"</code> and the associated element is the empty string.
+ * <p>
+ *
+ * @param inStream the input stream.
+ * @exception IOException if an error occurred when reading from the
+ * input stream.
*/
public synchronized void load(InputStream inStream) throws IOException {
@@ -235,8 +199,7 @@ class CMSProperties extends Hashtable<String,String> {
for (startIndex = 0; startIndex < nextLine.length(); startIndex++) {
if (whiteSpaceChars.indexOf(
- nextLine.charAt(startIndex))
- == -1) {
+ nextLine.charAt(startIndex)) == -1) {
break;
}
}
@@ -277,8 +240,7 @@ class CMSProperties extends Hashtable<String,String> {
int valueIndex;
for (valueIndex = separatorIndex; valueIndex < len; valueIndex++) {
- if (whiteSpaceChars.indexOf(line.charAt(valueIndex))
- == -1) {
+ if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1) {
break;
}
}
@@ -286,16 +248,14 @@ class CMSProperties extends Hashtable<String,String> {
// Skip over one non whitespace key value separators if any
if (valueIndex < len) {
if (strictKeyValueSeparators.indexOf(
- line.charAt(valueIndex))
- != -1) {
+ line.charAt(valueIndex)) != -1) {
valueIndex++;
}
}
// Skip over white space after other separators if any
while (valueIndex < len) {
- if (whiteSpaceChars.indexOf(line.charAt(valueIndex))
- == -1) {
+ if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1) {
break;
}
valueIndex++;
@@ -418,7 +378,7 @@ class CMSProperties extends Hashtable<String,String> {
switch (aChar) {
case ' ':
- if (x == 0 || escapeSpace) {
+ if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
@@ -472,70 +432,49 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Calls the <code>store(OutputStream out, String header)</code> method
* and suppresses IOExceptions that were thrown.
- *
+ *
* @deprecated This method does not throw an IOException if an I/O error
- * occurs while saving the property list. As of the Java 2 platform v1.2, the preferred
- * way to save a properties list is via the <code>store(OutputStream out,
+ * occurs while saving the property list. As of the Java 2 platform v1.2, the preferred
+ * way to save a properties list is via the <code>store(OutputStream out,
* String header)</code> method.
- *
- * @param out an output stream.
- * @param header a description of the property list.
- * @exception ClassCastException if this <code>Properties</code> object
- * contains any keys or values that are not <code>Strings</code>.
+ *
+ * @param out an output stream.
+ * @param header a description of the property list.
+ * @exception ClassCastException if this <code>Properties</code> object
+ * contains any keys or values that are not <code>Strings</code>.
*/
public synchronized void save(OutputStream out, String header) {
try {
store(out, header);
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
/**
- * Writes this property list (key and element pairs) in this
- * <code>Properties</code> table to the output stream in a format suitable
- * for loading into a <code>Properties</code> table using the
- * <code>load</code> method.
+ * Writes this property list (key and element pairs) in this <code>Properties</code> table to the output stream in a format suitable
+ * for loading into a <code>Properties</code> table using the <code>load</code> method.
* The stream is written using the ISO 8859-1 character encoding.
* <p>
- * Properties from the defaults table of this <code>Properties</code>
- * table (if any) are <i>not</i> written out by this method.
+ * Properties from the defaults table of this <code>Properties</code> table (if any) are <i>not</i> written out by this method.
* <p>
- * If the header argument is not null, then an ASCII <code>#</code>
- * character, the header string, and a line separator are first written
- * to the output stream. Thus, the <code>header</code> can serve as an
- * identifying comment.
+ * If the header argument is not null, then an ASCII <code>#</code> character, the header string, and a line separator are first written to the output stream. Thus, the <code>header</code> can serve as an identifying comment.
* <p>
- * Next, a comment line is always written, consisting of an ASCII
- * <code>#</code> character, the current date and time (as if produced
- * by the <code>toString</code> method of <code>Date</code> for the
- * current time), and a line separator as generated by the Writer.
+ * Next, a comment line is always written, consisting of an ASCII <code>#</code> character, the current date and time (as if produced by the <code>toString</code> method of <code>Date</code> for the current time), and a line separator as generated by the Writer.
* <p>
- * Then every entry in this <code>Properties</code> table is written out,
- * one per line. For each entry the key string is written, then an ASCII
- * <code>=</code>, then the associated element string. Each character of
- * the element string is examined to see whether it should be rendered as
- * an escape sequence. The ASCII characters <code>\</code>, tab, newline,
- * and carriage return are written as <code>\\</code>, <code>\t</code>,
- * <code>\n</code>, and <code>\r</code>, respectively. Characters less
- * than <code>&#92;u0020</code> and characters greater than
- * <code>&#92;u007E</code> are written as <code>&#92;u</code><i>xxxx</i> for
- * the appropriate hexadecimal value <i>xxxx</i>. Leading space characters,
- * but not embedded or trailing space characters, are written with a
- * preceding <code>\</code>. The key and value characters <code>#</code>,
- * <code>!</code>, <code>=</code>, and <code>:</code> are written with a
- * preceding slash to ensure that they are properly loaded.
+ * Then every entry in this <code>Properties</code> table is written out, one per line. For each entry the key string is written, then an ASCII <code>=</code>, then the associated element string. Each character of the element string is examined to see whether it should be rendered as an escape sequence. The ASCII characters <code>\</code>, tab, newline, and carriage return are written as <code>\\</code>, <code>\t</code>, <code>\n</code>, and <code>\r</code>, respectively. Characters less
+ * than <code>&#92;u0020</code> and characters greater than <code>&#92;u007E</code> are written as <code>&#92;u</code><i>xxxx</i> for the appropriate hexadecimal value <i>xxxx</i>. Leading space characters, but not embedded or trailing space characters, are written with a preceding <code>\</code>. The key and value characters <code>#</code>, <code>!</code>, <code>=</code>, and <code>:</code> are written with a preceding slash to ensure that they are properly loaded.
* <p>
- * After the entries have been written, the output stream is flushed. The
- * output stream remains open after this method returns.
- *
- * @param out an output stream.
- * @param header a description of the property list.
- * @exception IOException if writing this property list to the specified
- * output stream throws an <tt>IOException</tt>.
- * @exception ClassCastException if this <code>Properties</code> object
- * contains any keys or values that are not <code>Strings</code>.
+ * After the entries have been written, the output stream is flushed. The output stream remains open after this method returns.
+ *
+ * @param out an output stream.
+ * @param header a description of the property list.
+ * @exception IOException if writing this property list to the specified
+ * output stream throws an <tt>IOException</tt>.
+ * @exception ClassCastException if this <code>Properties</code> object
+ * contains any keys or values that are not <code>Strings</code>.
*/
public synchronized void store(OutputStream out, String header)
- throws IOException {
+ throws IOException {
BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
@@ -544,8 +483,8 @@ class CMSProperties extends Hashtable<String,String> {
}
writeln(awriter, "#" + new Date().toString());
for (Enumeration<String> e = keys(); e.hasMoreElements();) {
- String key = e.nextElement();
- String val = get(key);
+ String key = e.nextElement();
+ String val = get(key);
key = saveConvert(key, true);
@@ -566,17 +505,16 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Searches for the property with the specified key in this property list.
* If the key is not found in this property list, the default property list,
- * and its defaults, recursively, are then checked. The method returns
- * <code>null</code> if the property is not found.
- *
- * @param key the property key.
- * @return the value in this property list with the specified key value.
- * @see #setProperty
- * @see #defaults
+ * and its defaults, recursively, are then checked. The method returns <code>null</code> if the property is not found.
+ *
+ * @param key the property key.
+ * @return the value in this property list with the specified key value.
+ * @see #setProperty
+ * @see #defaults
*/
public String getProperty(String key) {
String oval = super.get(key);
- String sval = (oval instanceof String) ? oval : null;
+ String sval = (oval instanceof String) ? oval : null;
return ((sval == null) && (defaults != null))
? defaults.getProperty(key)
@@ -588,13 +526,13 @@ class CMSProperties extends Hashtable<String,String> {
* If the key is not found in this property list, the default property list,
* and its defaults, recursively, are then checked. The method returns the
* default value argument if the property is not found.
- *
- * @param key the hashtable key.
- * @param defaultValue a default value.
- *
- * @return the value in this property list with the specified key value.
- * @see #setProperty
- * @see #defaults
+ *
+ * @param key the hashtable key.
+ * @param defaultValue a default value.
+ *
+ * @return the value in this property list with the specified key value.
+ * @see #setProperty
+ * @see #defaults
*/
public String getProperty(String key, String defaultValue) {
String val = getProperty(key);
@@ -605,11 +543,11 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Returns an enumeration of all the keys in this property list, including
* the keys in the default property list.
- *
- * @return an enumeration of all the keys in this property list, including
- * the keys in the default property list.
- * @see java.util.Enumeration
- * @see java.util.Properties#defaults
+ *
+ * @return an enumeration of all the keys in this property list, including
+ * the keys in the default property list.
+ * @see java.util.Enumeration
+ * @see java.util.Properties#defaults
*/
public Enumeration<String> propertyNames() {
Hashtable<String, String> h = new Hashtable<String, String>();
@@ -621,8 +559,8 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Prints this property list out to the specified output stream.
* This method is useful for debugging.
- *
- * @param out an output stream.
+ *
+ * @param out an output stream.
*/
public void list(PrintStream out) {
out.println("-- listing properties --");
@@ -630,8 +568,8 @@ class CMSProperties extends Hashtable<String,String> {
enumerate(h);
for (Enumeration<String> e = h.keys(); e.hasMoreElements();) {
- String key = e.nextElement();
- String val = h.get(key);
+ String key = e.nextElement();
+ String val = h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
@@ -643,11 +581,11 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Prints this property list out to the specified output stream.
* This method is useful for debugging.
- *
- * @param out an output stream.
- * @since JDK1.1
+ *
+ * @param out an output stream.
+ * @since JDK1.1
*/
-
+
/*
* Rather than use an anonymous inner class to share common code, this
* method is duplicated in order to ensure that a non-1.1 compiler can
@@ -659,8 +597,8 @@ class CMSProperties extends Hashtable<String,String> {
enumerate(h);
for (Enumeration<String> e = h.keys(); e.hasMoreElements();) {
- String key = e.nextElement();
- String val = h.get(key);
+ String key = e.nextElement();
+ String val = h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
@@ -671,6 +609,7 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Enumerates all key/value pairs in the specified hastable.
+ *
* @param h the hashtable
*/
private synchronized void enumerate(Hashtable<String, String> h) {
@@ -678,7 +617,7 @@ class CMSProperties extends Hashtable<String,String> {
defaults.enumerate(h);
}
for (Enumeration<String> e = keys(); e.hasMoreElements();) {
- String key = e.nextElement();
+ String key = e.nextElement();
h.put(key, get(key));
}
@@ -686,7 +625,8 @@ class CMSProperties extends Hashtable<String,String> {
/**
* Convert a nibble to a hex character
- * @param nibble the nibble to convert.
+ *
+ * @param nibble the nibble to convert.
*/
private static char toHex(int nibble) {
return hexDigit[(nibble & 0xF)];
@@ -694,7 +634,7 @@ class CMSProperties extends Hashtable<String,String> {
/** A table of hex digits */
private static final char[] hexDigit = {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
- 'E', 'F'
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
+ 'E', 'F'
};
}
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSTask.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSTask.java
index 593de383..4b6c75ba 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSTask.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSTask.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -24,10 +25,9 @@ import java.io.InputStreamReader;
import com.netscape.pkisilent.argparser.ArgParser;
import com.netscape.pkisilent.argparser.StringHolder;
-
/**
* CS Test framework .
- * This class starts and stops CS server from command line
+ * This class starts and stops CS server from command line
*/
public class CMSTask {
@@ -38,7 +38,7 @@ public class CMSTask {
private Process p = null;
/**
- * Constructor . Takes CMS server root as parameter
+ * Constructor . Takes CMS server root as parameter
* for example (/export/qa/cert-jupiter2)
**/
@@ -63,7 +63,7 @@ public class CMSTask {
try {
while ((s = br.readLine()) != null) {
- if (s.indexOf("started") > 0) {
+ if (s.indexOf("started") > 0) {
return true;
}
// do something
@@ -175,7 +175,7 @@ public class CMSTask {
// set variables
serverRoot = x_instance_root.value;
operation = x_operation.value;
-
+
boolean st = prof.task();
if (!st) {
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CertificateRecord.java b/pki/base/silent/src/com/netscape/pkisilent/common/CertificateRecord.java
index c636b0a1..9599eb6d 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/CertificateRecord.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/CertificateRecord.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,8 +18,6 @@ package com.netscape.pkisilent.common;
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
-
-
public class CertificateRecord {
public String revokedOn = null;
@@ -42,7 +41,4 @@ public class CertificateRecord {
public CertificateRecord() {// Do nothing
}
-}
-
-
-;
+};
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java b/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
index 46bd9664..9881aa2c 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -64,13 +65,11 @@ import org.mozilla.jss.util.Password;
import com.netscape.osutil.OSUtil;
-
/**
* CMS Test framework .
* Use this class to initalize,add a certificate ,generate a certificate request from certificate database.
*/
-
public class ComCrypto {
private String cdir, certnickname, keysize, keytype, tokenpwd;
@@ -98,19 +97,19 @@ public class ComCrypto {
private String certprefix = null;
- public ComCrypto() {}
- ;
+ public ComCrypto() {
+ };
/**
* Constructor . Takes the parameter certificatedbdirectory , passwordfor cert database, certificatenickname,keysize, keytype(RSA/DSA)
+ *
* @param certdbdirectory.
- * @param certdbpassword
- * @param certnickname
+ * @param certdbpassword
+ * @param certnickname
* @param keysize (1024/2048/4096)
* @param keytype (RSA/DSA)
*/
-
public ComCrypto(String cd, String tpwd, String cn, String ks, String kt) {
cdir = cd;
tokenpwd = tpwd;
@@ -190,10 +189,9 @@ public class ComCrypto {
}
/**
- * Finds and returns Certificate . Takes certificatenickname as parameter.
+ * Finds and returns Certificate . Takes certificatenickname as parameter.
*/
-
public X509Certificate findCert(String certname) {
try {
@@ -212,7 +210,6 @@ public class ComCrypto {
* Imports a certificate to Certificate Database. Takes certificate and nickname as parameters.
*/
-
public boolean importCert(X509Certificate xcert, String nickname) {
try {
@@ -235,7 +232,6 @@ public class ComCrypto {
* Imports a certificate to Certificate Database. Takes certificate and nickname as parameters.
*/
-
public boolean importCert(String cpack, String cn) {
System.out.println("importCert string: importing with nickname: " + cn);
@@ -243,7 +239,7 @@ public class ComCrypto {
String tmp = normalize(cpack);
- if (DBlogin) {
+ if (DBlogin) {
System.out.println("Already logged into to DB");
}
@@ -272,10 +268,10 @@ public class ComCrypto {
try {
String tmp = normalize(cpack);
- if (DBlogin) {
+ if (DBlogin) {
System.out.println("Already logged into to DB");
}
-
+
if (manager == null) {
System.out.println("Manager object is null");
}
@@ -296,7 +292,6 @@ public class ComCrypto {
* Normalizes a given certificate string . Removes the extra \\ in the certificate returned by CMS server.
*/
-
public String normalize(String s) {
String val = "";
@@ -321,7 +316,6 @@ public class ComCrypto {
* Normalizes a given certificate string . Removes the extra \\ in the certificate returned by CMS server.
*/
-
public String normalizeForLDAP(String s) {
String val = "";
@@ -346,7 +340,6 @@ public class ComCrypto {
* Convert to pkcs7 format
*/
-
public String pkcs7Convertcert(String s) {
String val = "";
@@ -396,14 +389,13 @@ public class ComCrypto {
* Creates a new certificate database
**/
-
public boolean CreateCertDB() {
return loginDB();
}
/**
- * Login to cert database
+ * Login to cert database
**/
public boolean loginDB() {
@@ -439,15 +431,15 @@ public class ComCrypto {
token.login(pass1);
pass1.clear();
- } catch (AlreadyInitializedException e) {
+ } catch (AlreadyInitializedException e) {
if (debug) {
System.out.println("Crypto manager already initialized");
}
} catch (Exception e) {
- try {
+ try {
if (!token.isLoggedIn()) {
token.initPassword(pass1, pass1);
- }
+ }
return true;
} catch (Exception er) {
System.err.println("some exception:" + e);
@@ -507,14 +499,14 @@ public class ComCrypto {
int num = 1;
long total_time = 0;
KeyPair pair = null;
-
- System.out.println("Debug : initialize crypto Manager");
+
+ System.out.println("Debug : initialize crypto Manager");
try {
// Step 1. initialize crypto Manager
- try {
+ try {
CryptoManager.initialize(cdir);
- } catch (Exception e) {
+ } catch (Exception e) {
// it is ok if it is already initialized
System.out.println("INITIALIZATION ERROR: " + e.toString());
System.out.println("cdir = " + cdir);
@@ -525,17 +517,17 @@ public class ComCrypto {
System.out.println("Debug : before getInstance");
- manager = CryptoManager.getInstance();
+ manager = CryptoManager.getInstance();
String token_pwd = tokenpwd;
System.out.println("Debug : before get token");
- token = manager.getInternalKeyStorageToken();
- password = new Password(token_pwd.toCharArray());
+ token = manager.getInternalKeyStorageToken();
+ password = new Password(token_pwd.toCharArray());
System.out.println("Debug : before login password");
- token.login(password);
+ token.login(password);
System.out.println("Debug : after login password");
} catch (Exception e) {
@@ -548,7 +540,7 @@ public class ComCrypto {
// Generating CRMF request
- KeyPairGenerator kg = token.getKeyPairGenerator(KeyPairAlgorithm.RSA);
+ KeyPairGenerator kg = token.getKeyPairGenerator(KeyPairAlgorithm.RSA);
Integer x = new Integer(keysize);
int key_len = x.intValue();
@@ -556,7 +548,7 @@ public class ComCrypto {
kg.initialize(key_len);
// 1st key pair
- pair = kg.genKeyPair();
+ pair = kg.genKeyPair();
// create CRMF
CertTemplate certTemplate = new CertTemplate();
@@ -565,7 +557,7 @@ public class ComCrypto {
if (certnickname != null) {
X500Name name = new X500Name(certnickname);
- ByteArrayInputStream cs = new ByteArrayInputStream(name.getEncoded());
+ ByteArrayInputStream cs = new ByteArrayInputStream(name.getEncoded());
Name n = (Name) Name.getTemplate().decode(cs);
certTemplate.setSubject(n);
}
@@ -575,7 +567,7 @@ public class ComCrypto {
SEQUENCE seq = new SEQUENCE();
CertRequest certReq = new CertRequest(new INTEGER(1), certTemplate,
seq);
- byte popdata[] = { 0x0, 0x3, 0x0};
+ byte popdata[] = { 0x0, 0x3, 0x0 };
ProofOfPossession pop = ProofOfPossession.createKeyEncipherment(
POPOPrivKey.createThisMessage(new BIT_STRING(popdata, 3)));
@@ -583,24 +575,24 @@ public class ComCrypto {
CertReqMsg crmfMsg = new CertReqMsg(certReq, pop, null);
SEQUENCE s1 = new SEQUENCE();
-
+
// 1st : Encryption key
s1.addElement(crmfMsg);
// 2nd : Signing Key
-
+
if (dualkey) {
System.out.println("dualkey = true");
SEQUENCE seq1 = new SEQUENCE();
CertRequest certReqSigning = new CertRequest(new INTEGER(1),
certTemplate, seq1);
- CertReqMsg signingMsg = new CertReqMsg(certReqSigning, pop, null);
+ CertReqMsg signingMsg = new CertReqMsg(certReqSigning, pop, null);
s1.addElement(signingMsg);
- }
+ }
- byte encoded[] = ASN1Util.encode(s1);
+ byte encoded[] = ASN1Util.encode(s1);
// BASE64Encoder encoder = new BASE64Encoder();
// String Req1 = encoder.encodeBuffer(encoded);
@@ -611,7 +603,7 @@ public class ComCrypto {
System.out.println("CRMF_REQUEST = " + CRMF_REQUEST);
- } catch (Exception e) {
+ } catch (Exception e) {
System.out.println("ERROR: " + e.toString());
e.printStackTrace();
return null;
@@ -636,9 +628,9 @@ public class ComCrypto {
try {
// Step 1. initialize crypto Manager
- try {
+ try {
CryptoManager.initialize(cdir);
- } catch (Exception e) {
+ } catch (Exception e) {
// it is ok if it is already initialized
System.out.println("INITIALIZATION ERROR: " + e.toString());
System.out.println("cdir = " + cdir);
@@ -648,18 +640,18 @@ public class ComCrypto {
try {
System.out.println("Debug : before getInstance");
-
- manager = CryptoManager.getInstance();
+
+ manager = CryptoManager.getInstance();
String token_pwd = tokenpwd;
-
+
System.out.println("Debug : before get token");
-
- token = manager.getInternalKeyStorageToken();
- password = new Password(token_pwd.toCharArray());
+
+ token = manager.getInternalKeyStorageToken();
+ password = new Password(token_pwd.toCharArray());
System.out.println("Debug : before login password");
- token.login(password);
+ token.login(password);
System.out.println("Debug : after login password");
} catch (Exception e) {
@@ -669,7 +661,7 @@ public class ComCrypto {
token.initPassword(password, password);
}
}
-
+
// Key Pair Generation
KeyPairGenerator kg = token.getKeyPairGenerator(KeyPairAlgorithm.RSA);
Integer x = new Integer(keysize);
@@ -686,7 +678,7 @@ public class ComCrypto {
X509Certificate tcert = manager.importCACertPackage(transport);
- byte iv[] = { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1};
+ byte iv[] = { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 };
KeyGenerator kg1 = token.getKeyGenerator(KeyGenAlgorithm.DES3);
SymmetricKey sk = kg1.generate();
@@ -742,7 +734,7 @@ public class ComCrypto {
seq);
// Adding proof of possesion data
- byte popdata[] = { 0x0, 0x3, 0x0};
+ byte popdata[] = { 0x0, 0x3, 0x0 };
ProofOfPossession pop = ProofOfPossession.createKeyEncipherment(
POPOPrivKey.createThisMessage(new BIT_STRING(popdata, 3)));
@@ -754,19 +746,19 @@ public class ComCrypto {
s1.addElement(crmfMsg);
// 2nd : Signing Key
-
+
if (dualkey) {
System.out.println("dualkey = true");
SEQUENCE seq1 = new SEQUENCE();
CertRequest certReqSigning = new CertRequest(new INTEGER(1),
certTemplate, seq1);
- CertReqMsg signingMsg = new CertReqMsg(certReqSigning, pop, null);
+ CertReqMsg signingMsg = new CertReqMsg(certReqSigning, pop, null);
s1.addElement(signingMsg);
- }
+ }
byte encoded[] = ASN1Util.encode(s1);
-
+
// BASE64Encoder encoder = new BASE64Encoder();
// CRMF_REQUEST = encoder.encodeBuffer(encoded);
@@ -781,7 +773,7 @@ public class ComCrypto {
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
}
-
+
return CRMF_REQUEST;
}
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java b/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java
index 6be4daf4..8071dcb2 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -35,7 +36,6 @@ import org.mozilla.jss.ssl.SSLClientCertificateSelectionCallback;
import org.mozilla.jss.ssl.SSLSocket;
import org.mozilla.jss.util.Password;
-
/**
* CMS Test framework .
* Submits a requests to agent port with sslclient authentication.
@@ -51,18 +51,19 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
private BufferedReader stdin = null;
private StringBuffer stdout = new StringBuffer();
- public Con2Agent() {}
+ public Con2Agent() {
+ }
/**
- *Constructor. Takes hostname , portnumber , certificate nickname, token password ,client certdb directory
- * @param hostname
+ * Constructor. Takes hostname , portnumber , certificate nickname, token password ,client certdb directory
+ *
+ * @param hostname
* @param portnumber
* @param agent cert nickname
- * @param token password
+ * @param token password
* @param certdb directory
*/
-
public Con2Agent(String hs, int p, String cname, String tpwd, String cdir) {
host = hs;
port = p;
@@ -168,7 +169,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
try {
- if (!loginCertDB()) {
+ if (!loginCertDB()) {
return false;
}
@@ -184,7 +185,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
OutputStream rawos = socket.getOutputStream();
BufferedOutputStream os = new BufferedOutputStream(rawos);
PrintStream ps = new PrintStream(os);
-
+
System.out.println(ACTIONURL);
System.out.println("Query :" + query);
ps.println("POST " + ACTIONURL + " HTTP/1.0");
@@ -239,12 +240,12 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
try {
System.out.println("Step 1: Initializing CryptoManager");
CryptoManager.initialize(certdir);
-
- System.out.println("Step 2: Login to Cert Database");
+
+ System.out.println("Step 2: Login to Cert Database");
manager = CryptoManager.getInstance();
CryptoToken token = (PK11Token) manager.getInternalKeyStorageToken();
- if (token.isLoggedIn()) {
+ if (token.isLoggedIn()) {
System.out.println("Con2Agent: Logged in incorrect");
}
@@ -256,12 +257,12 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
pass1 = new Password((char[]) passchar1.clone());
token.login(pass1);
- X509Certificate cert2 = manager.findCertByNickname(certnickname);
+ X509Certificate cert2 = manager.findCertByNickname(certnickname);
certname = cert2.getNickname();
return true;
- } catch (AlreadyInitializedException e) {
+ } catch (AlreadyInitializedException e) {
System.out.println("Crypto manager already initialized");
return true;
} catch (NumberFormatException e) {
@@ -276,7 +277,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
e.printStackTrace();
return false;
}
-
+
}
public boolean Send_withGET() {
@@ -285,7 +286,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
try {
- if (!loginCertDB()) {
+ if (!loginCertDB()) {
return false;
}
@@ -297,7 +298,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
OutputStream rawos = socket.getOutputStream();
BufferedOutputStream os = new BufferedOutputStream(rawos);
PrintStream ps = new PrintStream(os);
-
+
System.out.println("Query in con2agent :" + query);
System.out.println("ACTIONURL in con2agent : " + ACTIONURL);
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/DirEnroll.java b/pki/base/silent/src/com/netscape/pkisilent/common/DirEnroll.java
index 59820fe7..f82c7c8f 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/DirEnroll.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/DirEnroll.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,7 +18,6 @@ package com.netscape.pkisilent.common;
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
-
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -29,15 +29,12 @@ import java.util.GregorianCalendar;
import org.mozilla.jss.ssl.SSLSocket;
-
-
/**
- * CMS Test framework - Legacyenrollment forms for Directory based enrollmnet and Portal based enrollment .
- * Certificate issuance through Legacy Directory based enrollment and Portal based enrollment form.
- *<P>
+ * CMS Test framework - Legacyenrollment forms for Directory based enrollmnet and Portal based enrollment .
+ * Certificate issuance through Legacy Directory based enrollment and Portal based enrollment form.
+ * <P>
*/
-
public class DirEnroll extends TestClient {
private int i;
@@ -53,7 +50,8 @@ public class DirEnroll extends TestClient {
/**
* Constructor . Takes the parameter for Properties file name
* <p>
- * @param propfilename name of the parameter file
+ *
+ * @param propfilename name of the parameter file
*/
public DirEnroll(String pfile) {
@@ -63,6 +61,7 @@ public class DirEnroll extends TestClient {
/**
* Constructor. Takes hostname , EESSLportnumber as parameter
* <p>
+ *
* @param hostname
* @param portnumber
*/
@@ -73,8 +72,9 @@ public class DirEnroll extends TestClient {
}
/**
- * Constructor. Takes hostname,EESSLportnumber,uid,password,certdbdirectorypath,certdbpassword,certificatenickname,keysize,teytype
+ * Constructor. Takes hostname,EESSLportnumber,uid,password,certdbdirectorypath,certdbpassword,certificatenickname,keysize,teytype
* <p>
+ *
* @param hostname
* @param portnumber
* @param subjectdn
@@ -82,7 +82,6 @@ public class DirEnroll extends TestClient {
* @param adminpassword
*/
-
public DirEnroll(String hs, String p, String uid, String pw, String certdir, String certtokenpwd, String nickname, String ksz, String kt) {
host = hs;
@@ -99,15 +98,15 @@ public class DirEnroll extends TestClient {
// Set and Get functions
/**
- * Use this method to set User Info
- */
+ * Use this method to set User Info
+ */
public void setUIDInfo(String uid, String pw) {
UID = uid;
PWD = pw;
}
/**
- * Returns a string "UserDir" / "Portal"
+ * Returns a string "UserDir" / "Portal"
*/
public String getAuthenticator() {
@@ -115,16 +114,16 @@ public class DirEnroll extends TestClient {
}
/**
- * Valid values for s - UserDir for Directory based Authntication
- * Portal for Portal based Authentication
+ * Valid values for s - UserDir for Directory based Authntication
+ * Portal for Portal based Authentication
*/
- public void setAuthenticator(String s) {
+ public void setAuthenticator(String s) {
Authenticator = s;
}
public boolean enroll_load() {
buildquery();
- return(Send());
+ return (Send());
}
private boolean pkcs10() {
@@ -134,7 +133,7 @@ public class DirEnroll extends TestClient {
cCrypt.setKeySize(keysize);
cCrypt.setKeyType(keytype);
cCrypt.setTokenPWD(tokenpwd);
-
+
cCrypt.setDebug(debug);
cCrypt.setGenerateRequest(true);
if (!cCrypt.generateRequest()) {
@@ -147,7 +146,7 @@ public class DirEnroll extends TestClient {
buildquery();
System.out.println(query);
setStatusString("Congratulations, your certificate has been issued.");
- return(Send());
+ return (Send());
} catch (Exception e) {
System.err.println("some exception:" + e);
}
@@ -157,10 +156,10 @@ public class DirEnroll extends TestClient {
}
/**
- * Enroll for certificate . Before calling this mentod SetAuthenticator and setUIDInfo
+ * Enroll for certificate . Before calling this mentod SetAuthenticator and setUIDInfo
*/
public boolean enroll() {
- return(pkcs10());
+ return (pkcs10());
}
private boolean readProperties() {
@@ -310,7 +309,7 @@ public class DirEnroll extends TestClient {
}
if (line.indexOf("record.base64Cert=") > -1) {
- String baseCert = line;
+ String baseCert = line;
System.out.println("BaseCert : " + baseCert);
if (importcert.equals("true")) {
@@ -352,13 +351,13 @@ public class DirEnroll extends TestClient {
}
return st;
-
+
}
private void buildquery() {
StringBuffer queryStrBuf = new StringBuffer();
-
+
queryStrBuf.append("certType=client");
queryStrBuf.append("&importCert=off");
queryStrBuf.append("&non_repudiation=true");
@@ -376,7 +375,7 @@ public class DirEnroll extends TestClient {
queryStrBuf.append(URLEncoder.encode(UID));
queryStrBuf.append("&pwd=");
queryStrBuf.append(URLEncoder.encode(PWD));
- queryStrBuf.append("&email=true");
+ queryStrBuf.append("&email=true");
queryStrBuf.append("&cryptprovider=1");
}
@@ -412,7 +411,7 @@ public class DirEnroll extends TestClient {
queryStrBuf.append("&l=");
queryStrBuf.append(URLEncoder.encode(L));
- queryStrBuf.append("&email=true");
+ queryStrBuf.append("&email=true");
}
@@ -423,7 +422,7 @@ public class DirEnroll extends TestClient {
queryStrBuf.append(URLEncoder.encode(UID));
queryStrBuf.append("&pwd=");
queryStrBuf.append(URLEncoder.encode(PWD));
- queryStrBuf.append("&email=true");
+ queryStrBuf.append("&email=true");
}
@@ -432,25 +431,25 @@ public class DirEnroll extends TestClient {
query = queryStrBuf.toString();
System.out.println(query);
-
+
}
public static void main(String args[]) {
// Exit Status - (0) for error/Fail
// - requestId Pass
boolean st;
-
+
System.out.println(args.length);
if (args.length < 1) {
System.out.println("Usage : propertiesfile");
System.exit(0);
- }
+ }
DirEnroll t = new DirEnroll(args[0]);
t.readProperties();
st = t.enroll();
- if (st) {
+ if (st) {
System.out.println(
t.getAuthenticator() + " based enrollment successfull. ");
System.exit(1);
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java b/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java
index 79be5c35..22c1c402 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -31,7 +32,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-
public class ParseXML {
Document dom = null;
@@ -77,7 +77,7 @@ public class ParseXML {
// get the root elememt
Element docEle = dom.getDocumentElement();
-
+
// get a nodelist of <employee> elements
NodeList nl = docEle.getElementsByTagName(tag);
@@ -107,9 +107,10 @@ public class ParseXML {
XMLSerializer serializer = new XMLSerializer(System.out, format);
serializer.serialize(dom);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
}
-
+
private String getTextValue(Element ele, String tagName) {
String textVal = null;
NodeList nl = ele.getElementsByTagName(tagName);
@@ -132,7 +133,7 @@ public class ParseXML {
try {
// get the root elememt
Element docEle = dom.getDocumentElement();
-
+
// get a nodelist of <employee> elements
NodeList nl = docEle.getElementsByTagName(first);
@@ -163,10 +164,8 @@ public class ParseXML {
px.parse(fiscfg);
px.prettyprintxml();
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
}
-}
-
-
-; // end class
+}; // end class
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/PostQuery.java b/pki/base/silent/src/com/netscape/pkisilent/common/PostQuery.java
index 87fcf500..64e49d90 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/PostQuery.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/PostQuery.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -33,8 +34,6 @@ import com.netscape.osutil.OSUtil;
* This class submits request to admin server after authenticating with UID and Password. You can get back the response by calling the method. getPage().
*/
-
-
public class PostQuery {
private boolean st;
@@ -45,10 +44,10 @@ public class PostQuery {
private StringBuffer stdout = new StringBuffer();
/**
- * Constructor . Takes the parameters urlstring("http://hostname:<portnumber> , Id for authenticating to the server, password for authentication to the server and query which needs to be submitted to the server
+ * Constructor . Takes the parameters urlstring("http://hostname:<portnumber> , Id for authenticating to the server, password for authentication to the server and query which needs to be submitted to the server
*/
- public PostQuery(String urlstr, String authid, String authpwd, String querystring) {
+ public PostQuery(String urlstr, String authid, String authpwd, String querystring) {
URLString = urlstr;
adminID = authid;
@@ -82,7 +81,7 @@ public class PostQuery {
try {
- BufferedReader mbufferedReader = null;
+ BufferedReader mbufferedReader = null;
URL myUrl = new URL(URLString);
String userPassword = adminID + ":" + adminPWD;
@@ -103,7 +102,7 @@ public class PostQuery {
// URLCon.setRequestMethod("POST");
System.out.println("After post");
- DataOutputStream os = new DataOutputStream(URLCon.getOutputStream());
+ DataOutputStream os = new DataOutputStream(URLCon.getOutputStream());
System.out.println("Query: " + postQuery);
@@ -112,7 +111,7 @@ public class PostQuery {
os.writeBytes(postQuery);
os.flush();
os.close();
-
+
InputStream Content = (InputStream) URLCon.getInputStream();
System.out.println("Configuring Cert Instance : Return Response");
@@ -127,12 +126,12 @@ public class PostQuery {
if (st) {
break;
}
- }
+ }
URLCon.disconnect();
} // try
catch (MalformedURLException e) {
System.out.println(URLString + " is not a valid URL.");
-
+
} catch (IOException e) {
System.out.println("exception : " + e.getMessage());
}
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java
index 9ddc9970..0cb08577 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,21 +18,17 @@ package com.netscape.pkisilent.common;
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
-
import java.net.URLEncoder;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Vector;
-
-
/**
* CMS Test framework .
* Submits List,Approve,Reject,cancel requests to agent port
*/
-
public class Request extends TestClient {
private String validityperiod;
@@ -63,18 +60,19 @@ public class Request extends TestClient {
/**
* Constructor . Takes the parameter for Properties file name
- * @param propfileName name of the parameter file.
+ *
+ * @param propfileName name of the parameter file.
*/
-
public Request(String pfile) {
propfileName = pfile;
}
/**
- * Constructor . Takes the parameter host , port and "angent type - ca/ra"
+ * Constructor . Takes the parameter host , port and "angent type - ca/ra"
+ *
* @param hostname.
- * @param port
+ * @param port
* @param agenttype Whether ca or ra agent
*/
@@ -85,9 +83,10 @@ public class Request extends TestClient {
}
/**
- * Constructor . Takes the following parmaters
- * @param hostName .
- * @param port
+ * Constructor . Takes the following parmaters
+ *
+ * @param hostName .
+ * @param port
* @param adminuid
* @param adminpwd
* @param agentcertnickname
@@ -97,13 +96,12 @@ public class Request extends TestClient {
* @param ApproveSequenceNumberFrom
* @param ApproveSequnceNumberTo
* @param type
- * @param reqtype enrollment/revoked
- * @param requestState complete/pending
- * @param agentType ra/ca
- * @param trustedManager true/false
+ * @param reqtype enrollment/revoked
+ * @param requestState complete/pending
+ * @param agentType ra/ca
+ * @param trustedManager true/false
*/
-
public Request(String h, String p, String aid, String apwd, String cname, String cd, String ctpwd, String snum, String sfrom, String sto, String ty, String rty, String rstate, String aty, String tm) {
host = h;
ports = p;
@@ -142,7 +140,7 @@ public class Request extends TestClient {
}
/**
- * Set Agent Cert nick name
+ * Set Agent Cert nick name
*/
public void setAgentCertName(String s) {
certnickname = s;
@@ -150,7 +148,8 @@ public class Request extends TestClient {
/**
* List all pending enrollment request. Takes parameters fromRequestNumber,toRequestNumber
- * @param fromrequest number
+ *
+ * @param fromrequest number
* @param endrequestnumber.
*/
@@ -165,11 +164,11 @@ public class Request extends TestClient {
/**
* List all pending request. Takes parameters fromRequestNumber,toRequestNumber
- * @param fromrequest number
+ *
+ * @param fromrequest number
* @param endrequestnumber.
*/
-
public Vector<String> ListAllRequests(String fromRequestNumber, String toRequestNumber) {
reqState = "showAll";
reqType = "enrollment";
@@ -181,10 +180,10 @@ public class Request extends TestClient {
/**
* Approve pending enrollment request. Takes parameters RequestNumber
- * @param request number
+ *
+ * @param request number
*/
-
public int ApproveRequests(String requestNumber) {
reqState = "showWaiting";
reqType = "enrollment";
@@ -202,7 +201,8 @@ public class Request extends TestClient {
/**
* Approve profile based pending enrollment request. Takes parameters RequestNumber
- * @param request number
+ *
+ * @param request number
*/
public int ApproveProfileRequests(String RequestNumber) {
@@ -222,7 +222,7 @@ public class Request extends TestClient {
}
public boolean Approve_cadualcert_Profile_Request(String RequestNumber, String name) {
-
+
approveseqnum = RequestNumber;
approveseqnumFrom = RequestNumber;
approveseqnumTo = RequestNumber;
@@ -237,7 +237,7 @@ public class Request extends TestClient {
buildquery();
- if (!Send()) {
+ if (!Send()) {
System.out.println("Error: Approving request " + approveseqnum);
return false;
}
@@ -248,10 +248,10 @@ public class Request extends TestClient {
/**
* Reject profile based pending enrollment request. Takes parameters RequestNumber
- * @param request number
+ *
+ * @param request number
*/
-
public int RejectProfileRequests(String RequestNumber) {
approveseqnum = RequestNumber;
@@ -270,7 +270,8 @@ public class Request extends TestClient {
/**
* Cancel profile based pending enrollment request. Takes parameters RequestNumber
- * @param request number
+ *
+ * @param request number
*/
public int CancelProfileRequests(String RequestNumber) {
@@ -354,14 +355,14 @@ public class Request extends TestClient {
AUTH_ID = res.substring(ret + AUTHID.length() + 1,
res.indexOf(";", ret) - 1);
while (ret > 0) {
- if ((ret = res.indexOf(seqnum, ret)) > -1) {
- int bi = ret + seqnum.length() + 2;
+ if ((ret = res.indexOf(seqnum, ret)) > -1) {
+ int bi = ret + seqnum.length() + 2;
int be = res.indexOf(";", ret) - 1;
seqNum.addElement(res.substring(bi, be));
ret++;
- }
-
+ }
+
}
}
@@ -481,7 +482,6 @@ public class Request extends TestClient {
}
// System.out.println("Debug : Retrieving cert details ");
-
ret = res.indexOf("header.ext_ssl_client =");
if (ret > 0) {
clientcert = res.substring(
@@ -587,17 +587,17 @@ public class Request extends TestClient {
"requestStatus")) {
i = t;
break;
- }
+ }
}
-
+
String req = "header.SERVER_ATTRS[" + i + "].value=";
ret = res.indexOf(req);
reqStatus = res.substring(ret + req.length() + 1,
res.indexOf(";", ret) - 1);
- if (reqStatus != null) {
+ if (reqStatus != null) {
reqStatus.toLowerCase();
if (reqStatus.equals("complete")) {
return true;
@@ -627,7 +627,7 @@ public class Request extends TestClient {
con.setQueryString(query);
con.setActionURL(ACTION_STRING);
con.Send();
- StringBuffer s = new StringBuffer();
+ StringBuffer s = new StringBuffer();
s = con.getPage();
String line;
@@ -645,7 +645,7 @@ public class Request extends TestClient {
break;
case 3:
- st = approveRequestStatus(s);
+ st = approveRequestStatus(s);
break;
case 4:
@@ -665,7 +665,7 @@ public class Request extends TestClient {
break;
default:
- System.out.println("reqtype not recognized");
+ System.out.println("reqtype not recognized");
}
} catch (Exception e) {
System.err.println("exception: in Send routine" + e);
@@ -685,7 +685,7 @@ public class Request extends TestClient {
query += "&reqState=" + reqState;
}
-
+
if (reqtype == 2) { // get cert details
ACTION_PROCESS_CERT_REQUEST = "/" + AUTH_ID + "/processCertReq";
ACTION_STRING = ACTION_PROCESS_CERT_REQUEST;
@@ -699,7 +699,7 @@ public class Request extends TestClient {
Integer x = new Integer(validityperiod);
validperiod = x.intValue();
- } else {
+ } else {
validperiod = 180;
}
@@ -719,7 +719,7 @@ public class Request extends TestClient {
if (csrRequestorPhone != null) {
query += "&csrRequestorPhone=" + csrRequestorPhone;
}
-
+
if (csrRequestorEmail != null) {
query += "&csrRequestorEmail=" + csrRequestorEmail;
}
@@ -746,7 +746,7 @@ public class Request extends TestClient {
query += "&certTypeSSLServer=" + servercert;
}
- if (emailcert.equals("true")) {
+ if (emailcert.equals("true")) {
query += "&certTypeEmail=" + emailcert;
}
@@ -764,7 +764,7 @@ public class Request extends TestClient {
Integer x = new Integer(validityperiod);
validperiod = x.intValue();
- } else {
+ } else {
validperiod = 180;
}
@@ -872,18 +872,18 @@ public class Request extends TestClient {
+ "&keyUsageKeyCertSign=false" + "&keyUsageCrlSign=false"
+ "&keyUsageEncipherOnly=false"
+ "&keyUsageDecipherOnly=false" + /* -- For Older CMS 6.x servers use these
- "&nsCertCritical=false" +
- "&nsCertSSLClient=true" +
- "&nsCertSSLServer=false" +
- "&nsCertEmail=true" +
- "&nsCertObjectSigning=false" +
- "&nsCertSSLCA=false" +
- "&nsCertEmailCA=false" +
- "&nsCertObjectSigningCA=false" +
- "&subjAltNameExtCritical=false" +
- "&subjAltNames=RFC822Name: null" +
- "&signingAlg=MD5withRSA" +
- */ // For newer CS 7.x servers use these
+ "&nsCertCritical=false" +
+ "&nsCertSSLClient=true" +
+ "&nsCertSSLServer=false" +
+ "&nsCertEmail=true" +
+ "&nsCertObjectSigning=false" +
+ "&nsCertSSLCA=false" +
+ "&nsCertEmailCA=false" +
+ "&nsCertObjectSigningCA=false" +
+ "&subjAltNameExtCritical=false" +
+ "&subjAltNames=RFC822Name: null" +
+ "&signingAlg=MD5withRSA" +
+ */// For newer CS 7.x servers use these
"&exKeyUsageCritical=false"
+ "&exKeyUsageOIDs=1.3.6.1.5.5.7.3.2,1.3.6.1.5.5.7.3.4"
+ "&subjAltNameExtCritical=false"
@@ -892,7 +892,7 @@ public class Request extends TestClient {
+ "&op=approve" + "&submit=submit";
}
-
+
}
private void readProperties() {
@@ -968,14 +968,14 @@ public class Request extends TestClient {
maxCount = 50;
} else {
maxCount = y.intValue() - x.intValue();
- }
+ }
if (maxCount == 0) {
maxCount = 1;
- }
+ }
reqtype = 1;
buildquery();
- return(Send());
+ return (Send());
}
private boolean approveRequest() {
@@ -989,7 +989,7 @@ public class Request extends TestClient {
return false;
}
- if (approveseqnum.length() > 0) {
+ if (approveseqnum.length() > 0) {
if (seqNum.contains(approveseqnum)) {
seqNum.removeAllElements();
seqNum.addElement(approveseqnum);
@@ -1002,7 +1002,7 @@ public class Request extends TestClient {
System.out.println(
" Seq num not specified . Approving all pending request From : "
+ approveseqnumFrom + " To : " + approveseqnumTo);
- }
+ }
boolean flag = true;
@@ -1023,44 +1023,43 @@ public class Request extends TestClient {
i++;
continue;
}
-
+
if (debug) {
System.out.println(
csrRequestorName + " " + csrRequestorPhone + " "
- + csrRequestorEmail + " " + requestID + " "
- + subject);
+ + csrRequestorEmail + " " + requestID + " "
+ + subject);
}
// Now for pending status - approve the request
reqtype = 3;
buildquery();
if (!Send()) {
System.out.println(
- "Error: Approving request " + approveseqnum);
+ "Error: Approving request " + approveseqnum);
i++;
continue;
}
System.out.println("Request " + approveseqnum + " is approved ");
totalNumApproved++;
- i++;
+ i++;
}
Integer x = new Integer(approveseqnum);
- if (x.intValue() >= torequest) {
+ if (x.intValue() >= torequest) {
flag = false;
- } else {
+ } else {
listRequest(approveseqnum, approveseqnumTo);
}
-
+
}
return st;
}
/**
- * Use this method when you need to use properties file.
+ * Use this method when you need to use properties file.
*/
-
- public int processRequest() {
+ public int processRequest() {
if (propfileName != null) {
readProperties();
}
@@ -1090,7 +1089,7 @@ public class Request extends TestClient {
} else {
return 0;
}
- } else {
+ } else {
return -1;
}
@@ -1103,11 +1102,11 @@ public class Request extends TestClient {
// Exit Status - (0) for error
// - any number > 0 Pass
int st = 0;
-
+
if (args.length < 1) {
System.out.println("Usage : propertiesfile");
System.exit(0);
- }
+ }
Request t = new Request(args[0]);
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/ServerInfo.java b/pki/base/silent/src/com/netscape/pkisilent/common/ServerInfo.java
index c353c4ae..617fb583 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/ServerInfo.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/ServerInfo.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -23,13 +24,11 @@ import java.io.FileReader;
import java.net.InetAddress;
import java.util.StringTokenizer;
-
/**
* CMS Test framework .
* This class fetches all the necssary ServerInformation to run the test . For example AdminServer information linke port , hsotname, Config LDAP server port, CMS servers Agentport,AdminPort, EESSL port, EE port etc..
*/
-
public class ServerInfo {
public String serverRoot, instanceRoot, instanceID;
@@ -45,7 +44,8 @@ public class ServerInfo {
private int i;
public String CMSConfigFile, AdminConfigFile;
- public ServerInfo() {}
+ public ServerInfo() {
+ }
/**
* Constructor. Takes Server root as parameter for example ( /export/qa). Reads and collects information about adminserver and Config LDAP server.
@@ -61,7 +61,6 @@ public class ServerInfo {
* Constructor. Takes Serverroot ( /export/qa) and instanceRoot (/export/qa/cert-jupiter2) as parameters . Reads and collects information about Admin Server , Config LDAP server and CMS server .
*/
-
public ServerInfo(String sroot, String instRoot) {
serverRoot = sroot;
instanceRoot = instRoot;
@@ -82,10 +81,10 @@ public class ServerInfo {
return ldapPort;
}
- public String GetHostName() {
+ public String GetHostName() {
if (domain.indexOf(".") > 0) {
return domain.substring(0, domain.indexOf("."));
- } else {
+ } else {
return domain;
}
}
@@ -98,8 +97,8 @@ public class ServerInfo {
return CMSConfigFile;
}
- public String GetDomainName() {
- return ldapHost.substring(ldapHost.indexOf(".") + 1);
+ public String GetDomainName() {
+ return ldapHost.substring(ldapHost.indexOf(".") + 1);
}
public String GetAgentPort() {
@@ -151,12 +150,12 @@ public class ServerInfo {
// Private functions
private void SystemInfo() {
try {
- domain = InetAddress.getLocalHost().getHostName();
+ domain = InetAddress.getLocalHost().getHostName();
System.out.println("Debu:SystemInfo " + domain);
} catch (Exception e) {
System.out.println("Exception InetAddress : " + e.getMessage());
}
-
+
}
private void parseServerXML() {
@@ -165,7 +164,7 @@ public class ServerInfo {
int EE_SSL = 3;
int EE_NON_SSL = 4;
int IP = 5;
- int PORT = 6;
+ int PORT = 6;
BufferedReader in = null;
try {
@@ -209,11 +208,11 @@ public class ServerInfo {
} else if (token.equals(" port=")) {
index2 = PORT;
}
-
+
if (index1 != 5 && index2 == IP && !token.equals(" ip=")) {
String ip = token;
} else if (index2 == PORT && !token.equals(" port=")) {
-
+
switch (index1) {
case 1:
CMSAgentPort = token;
@@ -232,7 +231,7 @@ public class ServerInfo {
break;
default:
- break;
+ break;
}
@@ -247,10 +246,11 @@ public class ServerInfo {
if (in != null) {
try {
in.close();
- } catch (Exception ex) {}
+ } catch (Exception ex) {
+ }
}
}
- }
+ }
private String stripSpace(String s) {
@@ -260,7 +260,7 @@ public class ServerInfo {
if ((s.charAt(i) == ' ')) {
i++;
continue;
- } else {
+ } else {
val += s.charAt(i);
}
}
@@ -280,7 +280,7 @@ public class ServerInfo {
if (fis.read(b) != b.length) {
System.out.println("Could not read ");
- } else {
+ } else {
String tmpstr = new String(b, 0, b.length);
int ret;
@@ -305,7 +305,7 @@ public class ServerInfo {
}
}
-
+
fis.close();
} catch (Exception e) {
System.out.println("exception " + e.getMessage());
@@ -333,7 +333,7 @@ public class ServerInfo {
ServerCertNickName = "Server-Cert cert-" + instanceID;
}
IDBPort = CMSprops.getProperty("internaldb.ldapconn.port");
-
+
fis.close();
} catch (Exception e) {
System.out.println("exception " + e.getMessage());
@@ -347,17 +347,17 @@ public class ServerInfo {
System.out.println(" Admin Port : " + s.GetAdminPort());
System.out.println(" LDAP Port : " + s.GetConfigLDAPPort());
System.out.println("Hostname " + s.GetHostName());
- System.out.println("InstanceID" + s.GetInstanceID());
- System.out.println(" doamin name : " + s.GetDomainName());
+ System.out.println("InstanceID" + s.GetInstanceID());
+ System.out.println(" doamin name : " + s.GetDomainName());
System.out.println("AgentPort " + s.GetAgentPort());
System.out.println("EESSLPort " + s.GetEESSLPort());
System.out.println("EEPort " + s.GetEEPort());
- System.out.println("CMSAdminPort :" + s.GetCMSAdminPort());
+ System.out.println("CMSAdminPort :" + s.GetCMSAdminPort());
System.out.println("CAAuthority : " + s.GetCertAuthority());
System.out.println("CASigningCert:" + s.GetCASigningCert());
System.out.println("RASigningCert:" + s.GetRASigningCert());
System.out.println("ServerCert" + s.GetServerCertNickName());
-
+
}// end of function main
} // end of class
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java b/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java
index d711e409..b0840c90 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -26,15 +27,11 @@ import java.util.Properties;
import org.mozilla.jss.crypto.X509Certificate;
import org.mozilla.jss.ssl.SSLCertificateApprovalCallback;
-
-
/**
* CMS Test framework .
* Before createing an instance of this class make sure you havae set an environment variable TEST_CONFIG_FILE.
*/
-
-
public class TestClient implements SSLCertificateApprovalCallback {
public int port;
@@ -54,16 +51,16 @@ public class TestClient implements SSLCertificateApprovalCallback {
private int i;
private String testConfigFile;
- public String caAgentCertName = "ca-agent";
- public String raAgentCertName = "ra-agent";
- public String ocspAgentCertName = "ocsp-agent";
- public String kraAgentCertName = "kra-agent";
- public String tksAgentCertName = "tks-agent";
- public String singleSignOnPWD = "secret12";
+ public String caAgentCertName = "ca-agent";
+ public String raAgentCertName = "ra-agent";
+ public String ocspAgentCertName = "ocsp-agent";
+ public String kraAgentCertName = "kra-agent";
+ public String tksAgentCertName = "tks-agent";
+ public String singleSignOnPWD = "secret12";
public String adminCertName = "cn=admin";
private String ldapBaseSuffix = "dc=netscape,dc=com";
- private String admDN = "admin";
- private String admDNPW = "admin";
+ private String admDN = "admin";
+ private String admDNPW = "admin";
private String TmpDir;
private String TestLogFile;
private String startupTests, cleanupTests;
@@ -82,11 +79,11 @@ public class TestClient implements SSLCertificateApprovalCallback {
public String ErrorDetail;
- private String serverKeyType, serverKeySize, serverKeyAlgo;
+ private String serverKeyType, serverKeySize, serverKeyAlgo;
private String unauth[] = {
- "Unauthorized Access", "Server Error",
- "Not Found", "Generic Unauthorized"};
+ "Unauthorized Access", "Server Error",
+ "Not Found", "Generic Unauthorized" };
public boolean approve(X509Certificate x509, SSLCertificateApprovalCallback.ValidityStatus status) {
SSLServerCert = x509;
@@ -95,22 +92,21 @@ public class TestClient implements SSLCertificateApprovalCallback {
// Constructor
-
public TestClient() {
keysize = "1024";
keytype = "RSA";
}
/**
- * Constructor . Takes the parameter for keysize and keytype .
- * Before creating a new instance of this class make sure you have set TEST_CONFIG_FILE variable in your environnemt.
- * Reads the TEST_CONFIG_FILE . Initializes the certificate database. See engage.cfg file for example.
+ * Constructor . Takes the parameter for keysize and keytype .
+ * Before creating a new instance of this class make sure you have set TEST_CONFIG_FILE variable in your environnemt.
+ * Reads the TEST_CONFIG_FILE . Initializes the certificate database. See engage.cfg file for example.
+ *
* @param keysize
- * @param keytype
+ * @param keytype
*/
-
- public TestClient(String ks, String kt) {
+ public TestClient(String ks, String kt) {
testConfigFile = ReadEnv("TEST_CONFIG_FILE");
@@ -175,7 +171,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
* This function returns true if you choose to executeCleanupTests
*/
-
public boolean executeCleanupTests() {
if (cleanupTests == null) {
@@ -214,7 +209,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
public String GetLDAPDNPW() {
return ldaprootDNPW;
- }
+ }
public String GetLDAPBASE() {
return ldapBaseSuffix;
@@ -298,10 +293,10 @@ public class TestClient implements SSLCertificateApprovalCallback {
public void setTestLogFile(String s) {
TestLogFile = s;
- }
+ }
/**
- * parses a http page and returns true if any error is returned by server
+ * parses a http page and returns true if any error is returned by server
**/
public boolean getError(String line) {
@@ -352,7 +347,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
ErrorDetail = line.substring(ret + ("errorReason=").length());
return true;
}
-
+
return false;
}
@@ -372,7 +367,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
- public String ReadEnv(String str) {
+ public String ReadEnv(String str) {
try {
Process p = null;
Runtime r = Runtime.getRuntime();
@@ -467,7 +462,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
/**
- * returns FreePort in this machine . Takes a parmater portnumber. For example getFreePort("4026").
+ * returns FreePort in this machine . Takes a parmater portnumber. For example getFreePort("4026").
*/
public String getFreePort(String s) {
Integer x = new Integer(s);
@@ -501,7 +496,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
/**
- * Reads a file and returns the cert request as string
+ * Reads a file and returns the cert request as string
**/
public String readRequest(String filename) {
@@ -533,14 +528,12 @@ public class TestClient implements SSLCertificateApprovalCallback {
*******************************************************************
*/
-
/*
********************************************************************
* To Test AutoInstaller
*******************************************************************
*/
-
/*
AutoInstaller a = new AutoInstaller(t.GetServerRoot());
@@ -589,12 +582,10 @@ public class TestClient implements SSLCertificateApprovalCallback {
******************************************************
*/
-
-
ServerInfo s = new ServerInfo(t.GetServerRoot(), t.GetInstanceRoot());
t.setHostName(s.GetHostName());
-
+
System.out.println("AgentPort " + s.GetAgentPort());
System.out.println("EESSLPort " + s.GetEESSLPort());
System.out.println("EEPort " + s.GetEEPort());
@@ -604,8 +595,8 @@ public class TestClient implements SSLCertificateApprovalCallback {
System.out.println("CASigningCert:" + s.GetCASigningCert());
System.out.println("RASigningCert:" + s.GetRASigningCert());
System.out.println("ServerCert" + s.GetServerCertNickName());
- System.out.println("------------------------------------------");
- System.out.println(" Internal Database Test:");
+ System.out.println("------------------------------------------");
+ System.out.println(" Internal Database Test:");
System.out.println(" LDAP Port : " + s.GetConfigLDAPPort());
System.out.println("Hostname " + s.GetHostName());
@@ -641,7 +632,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
pr.clientCertEnroll();
*/
-
/* ****************************************************************
* OCSP Client stuff
************************************************************
@@ -655,7 +645,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
ocspclient.SendOCSPRequest();
*/
-
/*
*****************************************************
* Test CRMFcleint and KRA REcovery and Archival
@@ -668,7 +657,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
*********************************************************
*/
-
/* Retrieval rtr = new Retrieval(s.GetHostName(),s.GetEESSLPort());
rtr.getCACert();
System.out.println("CA Cert chain" + rtr.getCert());
@@ -682,7 +670,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
ocspAgent.addCA();
*/
-
/*
***************************************************************
Submit Profile based request
@@ -747,8 +734,8 @@ public class TestClient implements SSLCertificateApprovalCallback {
*************************************************************
* Example to Connect oto Config Directory port
*************************************************************
- */
-
+ */
+
/*
CMSLDAP cmsldap = new CMSLDAP(s.GetHostName(),s.GetConfigLDAPPort(),t.GetLDAPDN(),t.GetLDAPDNPW());
if(cmsldap.connect())
@@ -762,14 +749,14 @@ public class TestClient implements SSLCertificateApprovalCallback {
*/
-
/*
*************************************************************
* Example to Submit a CRMFCleint request to CA
*************************************************************
- */
+ */
- String TransportCert = "MIICJTCCAY6gAwIBAgIBBTANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVzdDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTgyMjMwMDhaFw0wNDA0MTcxMDI2MDhaMDkxETAPBgNVBAoTCHRlc3QxMDI0MRcwFQYDVQQLEw5hY2NlcHRhbmNldGVzdDELMAkGA1UEAxMCcmEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAN6sQ3mSU8mL6i6gTZIXDLzOZPhYOkQLpnJjit5hcPZ0JMn0CQVXo4QjKN1xvuZv8qVlZoQw9czmzp/knTa0sCDgFKd0r+u0TnLeZkJMSimgFnma9CnChlaDHnBd8Beu4vyaHmo7rJ0xA4etn7HjhmKbaQZOcv/aP0SW9JXRga7ZAgMBAAGjMzAxMA4GA1UdDwEB/wQEAwIFIDAfBgNVHSMEGDAWgBSC3fsQHb7fddr2vL0UdkM2dAmUWzANBgkqhkiG9w0BAQQFAAOBgQBkAGbgd9HIqwoLKAr+V6bj9oWesDmDH80gPPxj10qyWSQYIs8PofOs/75yGS9nxhydtgSMFoBgCPdroUI31kZQQlFzxtudGoKD+5MWSXho79XzPwpjheOBYgpX6ch+L4tMLFDpqeraB1yZESO5EEeKm20DGVBOKVWxHhddO1BenA==";
+ String TransportCert =
+ "MIICJTCCAY6gAwIBAgIBBTANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVzdDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTgyMjMwMDhaFw0wNDA0MTcxMDI2MDhaMDkxETAPBgNVBAoTCHRlc3QxMDI0MRcwFQYDVQQLEw5hY2NlcHRhbmNldGVzdDELMAkGA1UEAxMCcmEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAN6sQ3mSU8mL6i6gTZIXDLzOZPhYOkQLpnJjit5hcPZ0JMn0CQVXo4QjKN1xvuZv8qVlZoQw9czmzp/knTa0sCDgFKd0r+u0TnLeZkJMSimgFnma9CnChlaDHnBd8Beu4vyaHmo7rJ0xA4etn7HjhmKbaQZOcv/aP0SW9JXRga7ZAgMBAAGjMzAxMA4GA1UdDwEB/wQEAwIFIDAfBgNVHSMEGDAWgBSC3fsQHb7fddr2vL0UdkM2dAmUWzANBgkqhkiG9w0BAQQFAAOBgQBkAGbgd9HIqwoLKAr+V6bj9oWesDmDH80gPPxj10qyWSQYIs8PofOs/75yGS9nxhydtgSMFoBgCPdroUI31kZQQlFzxtudGoKD+5MWSXho79XzPwpjheOBYgpX6ch+L4tMLFDpqeraB1yZESO5EEeKm20DGVBOKVWxHhddO1BenA==";
/*
CRMFClient CrmfClient = new CRMFClient(s.GetHostName(),s.GetEEPort());
@@ -782,7 +769,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
if(!CrmfClient.Enroll())
{System.out.println("CRMFClient : could not submit request");}
*/
-
+
/* KRA Agent list archived request */
/* ServerInfo KRAsvrInfo = new ServerInfo(t.GetServerRoot());
@@ -803,7 +790,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
*/
-
// cmsldap.disconnect();
@@ -900,7 +886,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
*/
-
/*
*************************************************************
* Example agent ro revoke request
@@ -951,8 +936,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
task.CMSStart();
*/
-
-
}// end of function main
}
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java b/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java
index cd6ebd87..216465a4 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,7 +18,6 @@ package com.netscape.pkisilent.common;
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
-
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -29,15 +29,12 @@ import java.util.GregorianCalendar;
import org.mozilla.jss.ssl.SSLSocket;
-
-
/**
* CMS Test framework .
* Submits Legacy Manual User Enrollment request from EESSL port. Parses the response from server and return RequestID.
- *<P>
+ * <P>
*/
-
public class UserEnroll extends TestClient {
private int i;
@@ -46,15 +43,14 @@ public class UserEnroll extends TestClient {
private long elapsedTime;
// Constructor
- public UserEnroll() {}
+ public UserEnroll() {
+ }
/**
- * Constructor . Takes the parameter hostname and EESSLport
+ * Constructor . Takes the parameter hostname and EESSLport
* <p>
*/
-
-
public UserEnroll(String h, String p) {
host = h;
ports = p;
@@ -63,10 +59,10 @@ public class UserEnroll extends TestClient {
/**
* Constructor . Takes the parameter for Properties file name
* <p>
- * @param propfilename name of the parameter file
+ *
+ * @param propfilename name of the parameter file
*/
-
public UserEnroll(String pfile) {
propfileName = pfile;
}
@@ -75,11 +71,11 @@ public class UserEnroll extends TestClient {
* Constructor . Takes the parameter for hostname, EESSLportnumber, subjectdn, E, CN,UID,OU,O, CertdbDirecrory(fullpath) , certdbPassword, keysize, keytype, requestorName,requestorEmail and Certtype.
* valid values for Certtype - "ca","ra","ocsp"
* <p>
- * @param propfilename name of the parameter file
+ *
+ * @param propfilename name of the parameter file
*/
-
- public UserEnroll(String h, String p, String dn, String e, String cn, String uid, String ou, String o, String cd, String tpwd, String sslcl, String ksize, String keyty, String reqname, String reqemail, String ctype) {
+ public UserEnroll(String h, String p, String dn, String e, String cn, String uid, String ou, String o, String cd, String tpwd, String sslcl, String ksize, String keyty, String reqname, String reqemail, String ctype) {
host = h;
ports = p;
@@ -115,7 +111,7 @@ public class UserEnroll extends TestClient {
}
/**
- * Set Certificate Request information. Takes parameters - subjectdn,E,CN,UID,OU,O
+ * Set Certificate Request information. Takes parameters - subjectdn,E,CN,UID,OU,O
*/
public void setUserInfo(String dn, String e, String cn, String uid, String ou, String o) {
@@ -158,7 +154,7 @@ public class UserEnroll extends TestClient {
public boolean enroll_load() {
buildquery();
setStatusString("");
- return(Send());
+ return (Send());
}
private boolean pkcs10() {
@@ -171,7 +167,7 @@ public class UserEnroll extends TestClient {
cCrypt.setKeyType(keytype);
cCrypt.setTokenPWD(tokenpwd);
cCrypt.setDebug(true);
- if (pkcs10request != null) {
+ if (pkcs10request != null) {
cCrypt.setGenerateRequest(false);
cCrypt.loginDB();
} else {
@@ -190,12 +186,12 @@ public class UserEnroll extends TestClient {
System.out.println(query);
}
setStatusString("");
- return(Send());
+ return (Send());
} catch (Exception e) {
System.err.println("some exception:" + e);
}
- return(false);
+ return (false);
}
@@ -222,7 +218,7 @@ public class UserEnroll extends TestClient {
try {
- if (debug) {
+ if (debug) {
System.out.println("Step 3 : Socket initialize");
}
@@ -268,7 +264,7 @@ public class UserEnroll extends TestClient {
if (line.indexOf("fixed.requestId = ") != -1) {
requestId = line.substring("fixed.requestId = ".length() + 1,
line.indexOf(";") - 1);
- }
+ }
if (getError(line)) {
st = false;
@@ -296,7 +292,7 @@ public class UserEnroll extends TestClient {
}
return st;
-
+
}
private void buildquery() {
@@ -331,12 +327,12 @@ public class UserEnroll extends TestClient {
queryStrBuf.append("&csrRequestorEmail=");
queryStrBuf.append(URLEncoder.encode(requestorEmail));
queryStrBuf.append("&email=true");
-
+
} else {
queryStrBuf.append("&email=false");
}
-
- if (requestorPhone.length() > 0) {
+
+ if (requestorPhone.length() > 0) {
queryStrBuf.append("&csrRequestorPhone=");
queryStrBuf.append(URLEncoder.encode(requestorPhone));
}
@@ -344,7 +340,7 @@ public class UserEnroll extends TestClient {
queryStrBuf.append("&csrRequestorComments=");
queryStrBuf.append(URLEncoder.encode(requestorComments));
}
- System.out.println("buidlquery client E ");
+ System.out.println("buidlquery client E ");
if (E.length() > 0) {
queryStrBuf.append("&E=");
queryStrBuf.append(E);
@@ -412,7 +408,7 @@ public class UserEnroll extends TestClient {
query = queryStrBuf.toString();
System.out.println(query);
- queryStrBuf = null;
+ queryStrBuf = null;
}
public int getRequestId() {
@@ -430,16 +426,16 @@ public class UserEnroll extends TestClient {
certType = "client";
ssl_client = "true";
debug = true;
- return(pkcs10());
+ return (pkcs10());
}
public boolean Enroll() {
debug = true;
- return(pkcs10());
+ return (pkcs10());
}
/**
- * Read the properties file
+ * Read the properties file
**/
public boolean readProperties() {
@@ -493,12 +489,12 @@ public class UserEnroll extends TestClient {
debug = false;
} else if (de.equals("true")) {
debug = true;
- } else {
+ } else {
debug = false;
}
// Enroll using a pkscks10 request
- return(pkcs10());
+ return (pkcs10());
}
public static void main(String args[]) {
@@ -512,7 +508,7 @@ public class UserEnroll extends TestClient {
"secret12", "true", "1024", "RSA", "rn", "re", "client");
e.clientCertEnroll();
-
+
/* if ( args.length < 1)
{
System.out.println("Usage : propertiesfile");
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java b/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java
index 3d90c841..9aaf6c4d 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -79,7 +80,7 @@ public class Utilities {
StringBuffer buf = new StringBuffer();
int end = token.length();
int begin = 0;
-
+
if (token.endsWith(";")) {
end--;
}
@@ -175,7 +176,7 @@ public class Utilities {
}
tempBuffer.append(temp);
}
-
+
return tempBuffer.toString();
} catch (Exception e) {
System.out.println("ERROR: getcertfromfile" + e.toString());
@@ -222,7 +223,7 @@ public class Utilities {
tempBuffer.append(temp);
}
-
+
return tempBuffer.toString();
} catch (Exception e) {
System.out.println("ERROR: getcrlfromfile" + e.toString());
@@ -249,7 +250,7 @@ public class Utilities {
tempBuffer.append(temp);
}
-
+
return tempBuffer.toString();
} catch (Exception e) {
System.out.println("ERROR: getcafromfile" + e.toString());
@@ -264,7 +265,7 @@ public class Utilities {
*/
public static String escapeBinaryData(byte data[]) {
String result = "";
-
+
for (int i = 0; i < data.length; i++) {
String s = Integer.toHexString((int) (0xff & data[i]));
@@ -321,7 +322,7 @@ public class Utilities {
CertificateSubjectName csn1 = (CertificateSubjectName)
certinfo.get(X509CertInfo.SUBJECT);
-
+
X500Name dname = (X500Name) csn1.get(CertificateSubjectName.DN_NAME);
String pp = "";
@@ -343,7 +344,4 @@ public class Utilities {
}
-}
-
-
-; // end class
+}; // end class
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java b/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java
index c67689e4..3b06d3d2 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java
@@ -1,4 +1,5 @@
package com.netscape.pkisilent.common;
+
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,7 +18,6 @@ package com.netscape.pkisilent.common;
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
-
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileOutputStream;
@@ -29,15 +29,12 @@ import java.util.GregorianCalendar;
import org.mozilla.jss.ssl.SSLSocket;
-
-
/**
* CMS Test framework .
- * Submits a checkRequestStatus request to the server. parses the response from server and can import cert to the specified client database.
- *<P>
+ * Submits a checkRequestStatus request to the server. parses the response from server and can import cert to the specified client database.
+ * <P>
*/
-
public class checkRequest extends TestClient {
private int i;
@@ -62,27 +59,26 @@ public class checkRequest extends TestClient {
/**
* Constructor . Takes the parameter for Properties file name
* <p>
- * @param propfilename name of the parameter file
+ *
+ * @param propfilename name of the parameter file
*/
-
public checkRequest(String pfile) {
propfileName = pfile;
}
/**
- * Constructor . Takes the parameter for hostname and EESSLportnumber
+ * Constructor . Takes the parameter for hostname and EESSLportnumber
* <p>
*/
public checkRequest(String h, String p) {
host = h;
ports = p;
- }
- ;
+ };
/**
- * Constructor . Takes the parameter for hostname , EESSLportnumber , Requestnumber and ImportCert ( true/false)
+ * Constructor . Takes the parameter for hostname , EESSLportnumber , Requestnumber and ImportCert ( true/false)
* <p>
*/
@@ -94,11 +90,10 @@ public class checkRequest extends TestClient {
}
/**
- * Constructor . Takes the parameter for hostname , EESSLportnumber , certdbdir, certdbpassword, Requestnumber ,certnickname and ImportCert ( true/false)
+ * Constructor . Takes the parameter for hostname , EESSLportnumber , certdbdir, certdbpassword, Requestnumber ,certnickname and ImportCert ( true/false)
* <p>
*/
-
public checkRequest(String hs, String pt, String certdir, String certtokenpwd, String seqnum, String nickname, String impc) {
host = hs;
ports = pt;
@@ -154,11 +149,10 @@ public class checkRequest extends TestClient {
}
/**
- * returns the hex serial number of the certificate
+ * returns the hex serial number of the certificate
**/
-
- public String getSerialNumberHex() {
+ public String getSerialNumberHex() {
return serialNumber;
}
@@ -166,7 +160,7 @@ public class checkRequest extends TestClient {
* returns the serial number as interger
**/
- public int getSerialNumber() {
+ public int getSerialNumber() {
if (serialNumber != null) {
Integer y = new Integer(Integer.parseInt(serialNumber, 16));
@@ -189,9 +183,9 @@ public class checkRequest extends TestClient {
cCrypt.setTokenPWD(tokenpwd);
cCrypt.setDebug(debug);
- if (!cCrypt.loginDB()) {
- System.out.println("Error : Login certdb failed ");
- System.err.println("FAIL : Login certdb failed ");
+ if (!cCrypt.loginDB()) {
+ System.out.println("Error : Login certdb failed ");
+ System.err.println("FAIL : Login certdb failed ");
return false;
}
@@ -235,8 +229,6 @@ public class checkRequest extends TestClient {
return false;
}
-
-
// Private functions
private void setElapsedTime(long dif) {
@@ -271,12 +263,12 @@ public class checkRequest extends TestClient {
tmp = cCrypt.normalizeForLDAP(getCert());
if (debug) {
System.out.println(tmp);
- }
+ }
fos.write(("usercertificate:: ").getBytes());
fos.write(tmp.getBytes());
fos.close();
} else {
- String tmp = cCrypt.normalize(getCert());
+ String tmp = cCrypt.normalize(getCert());
if (debug) {
System.out.println(tmp);
@@ -285,21 +277,21 @@ public class checkRequest extends TestClient {
fos.close();
}
-
+
} catch (Exception e) {
System.out.println(
"exception in writeCert2File: " + e.getMessage());
return false;
}
- }
+ }
return true;
}
private boolean importCert(String certpack) {
- if (importcert.equals("false")) {
+ if (importcert.equals("false")) {
return true;
}
@@ -380,8 +372,8 @@ public class checkRequest extends TestClient {
boolean st = true;
String retriveStr[] = {
- "record.base64Cert=", "record.certPrettyPrint=",
- "header.certChainBase64 = ", "header.certPrettyPrint = "};
+ "record.base64Cert=", "record.certPrettyPrint=",
+ "header.certChainBase64 = ", "header.certPrettyPrint = " };
String baseCertStr, certPrettyprintStr;
if (AUTH.equals("ra")) {
@@ -391,19 +383,19 @@ public class checkRequest extends TestClient {
baseCertStr = retriveStr[2];
certPrettyprintStr = retriveStr[3];
}
-
+
if (line.indexOf(baseCertStr) != -1) {
// if status is complete retrieve cert
baseCert = line.substring(baseCertStr.length() + 1,
line.indexOf(";", 10) - 1);
if (importcert.equals("true")) {
- if (importCert(baseCert)) {
+ if (importCert(baseCert)) {
st = true;
}
} else {
st = true;
- }
+ }
}
if (line.indexOf(certPrettyprintStr) != -1) {
@@ -475,9 +467,9 @@ public class checkRequest extends TestClient {
while ((line = stdin.readLine()) != null) {
switch (type) {
- case 1:
+ case 1:
RetrieveRequestDetail(line);
- st = true;
+ st = true;
break;
case 2:
@@ -488,7 +480,7 @@ public class checkRequest extends TestClient {
System.out.println("invalid format");
}
-
+
}
stdin.close();
socket.close();
@@ -517,9 +509,9 @@ public class checkRequest extends TestClient {
if (debug) {
System.out.println(serialNumber);
}
-
+
return st;
-
+
}
private void buildquery() {
@@ -527,7 +519,7 @@ public class checkRequest extends TestClient {
StringBuffer queryStrBuf = new StringBuffer();
if (type == 1) {
- ACTION_STRING = "/checkRequest";
+ ACTION_STRING = "/checkRequest";
queryStrBuf.append("requestId=");
queryStrBuf.append(requestId);
queryStrBuf.append("&importCert=true");
@@ -592,23 +584,23 @@ public class checkRequest extends TestClient {
}
// Enroll using a pkscks10 request
- return(checkRequestStatus());
+ return (checkRequestStatus());
}
public static void main(String args[]) {
// Exit Status - (0) for error/Fail
// - requestId Pass
boolean st;
-
+
if (args.length < 1) {
System.out.println("Usage : propertiesfile");
System.exit(0);
- }
+ }
checkRequest t = new checkRequest(args[0]);
st = t.readProperties();
- if (st) {
+ if (st) {
System.exit(t.getSerialNumber());
} else {