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.java809
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/BaseState.java42
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSConfig.java133
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSInstance.java118
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java195
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java377
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/CMSTask.java23
-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.java228
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/Con2Agent.java78
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/DirEnroll.java104
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/ParseXML.java22
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/PostQuery.java44
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/Request.java335
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/ServerInfo.java88
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java705
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java153
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java63
-rw-r--r--pki/base/silent/src/com/netscape/pkisilent/common/checkRequest.java124
19 files changed, 1885 insertions, 1764 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 a16a6cc53..028df6c15 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,38 +27,45 @@ 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.
- * This simulartes the installation wizard functions and helps to configure a CMS 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;
- // Admin Server and InternalDB varialbes
- private String adminDomain, adminID, adminPWD, adminPort, machineName, host, serverID, instanceID, serverRoot, sieURL, dbConnPort, dbConnHost, dbInstanceName, dbPassword, dbLDAPauthDN, dbmode, ldapServerDB;
+ // Admin Server and InternalDB varialbes
+ private String adminDomain, adminID, adminPWD, adminPort, machineName,
+ host, serverID, instanceID, serverRoot, sieURL, dbConnPort,
+ dbConnHost, dbInstanceName, dbPassword, dbLDAPauthDN, dbmode,
+ ldapServerDB;
// CMS Subsystem info
- private String certAdminName, certAdminUid, certAdminPWD, kra, subsystems, ca, ra, ocsp, remoteKRA, wirelessSupport, eeHttpPort, eeHttpsPort, agentHttpsPort, radminHttpsPort, tokenName, tokenPWD, certType, keyType, keyLength, SingleSignOnPWD, subjectName, aki, isCA, ski, sslCABit, objectSigningCABit, mailCABit, hashType, caOComponent, certValidityDays, signingCert, tks;
+ private String certAdminName, certAdminUid, certAdminPWD, kra, subsystems,
+ ca, ra, ocsp, remoteKRA, wirelessSupport, eeHttpPort, eeHttpsPort,
+ agentHttpsPort, radminHttpsPort, tokenName, tokenPWD, certType,
+ keyType, keyLength, SingleSignOnPWD, subjectName, aki, isCA, ski,
+ sslCABit, objectSigningCABit, mailCABit, hashType, caOComponent,
+ certValidityDays, signingCert, tks;
// CA info
- private String caHostname, caPortnum, caTimeout, caEEPort, enpropfile, cdir, tokenpwd, CAadminId, CAadminPwd, CAcertnickname, caAgentPortnum, cloneInstanceId;
+ private String caHostname, caPortnum, caTimeout, caEEPort, enpropfile,
+ cdir, tokenpwd, CAadminId, CAadminPwd, CAcertnickname,
+ caAgentPortnum, cloneInstanceId;
- // Program variables
+ // Program variables
private int i;
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";
@@ -68,9 +76,10 @@ public class AutoInstaller {
private boolean subca = false;
- // / Constructors
+ // / Constructors
- public AutoInstaller() {}
+ public AutoInstaller() {
+ }
/**
* Constructor . Takes parameter Server Root .
@@ -81,10 +90,13 @@ 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) {
+ public void setInternalDBInfo(String dbh, String dbp, String dbname,
+ String dbdn, String dbpswd) {
dbConnPort = dbp;
dbConnHost = dbh;
dbInstanceName = dbname;
@@ -94,14 +106,14 @@ public class AutoInstaller {
ldapServerDB = "userRoot";
}
- // Create Password file
+ // Create Password file
private boolean CreatePasswordFile() {
String s = "internal: " + SingleSignOnPWD;
OutputStream f0 = null;
try {
- f0 = new FileOutputStream(
- serverRoot + "/" + instanceID + "/config/password.conf");
+ f0 = new FileOutputStream(serverRoot + "/" + instanceID
+ + "/config/password.conf");
f0.write(s.getBytes());
f0.close();
@@ -109,7 +121,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());
}
@@ -122,8 +135,8 @@ public class AutoInstaller {
FileInputStream f1 = null;
OutputStream f2 = null;
try {
- f1 = new FileInputStream(
- serverRoot + "/" + instanceID + "/config/CS.cfg");
+ f1 = new FileInputStream(serverRoot + "/" + instanceID
+ + "/config/CS.cfg");
int size = f1.available();
byte b[] = new byte[size];
@@ -131,32 +144,34 @@ public class AutoInstaller {
f1.close();
return false;
}
- f2 = new FileOutputStream(
- serverRoot + "/" + instanceID + "/config/CS.cfg.org");
+ f2 = new FileOutputStream(serverRoot + "/" + instanceID
+ + "/config/CS.cfg.org");
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
+ // Get RaSigning Cert
public String getRASigningCert() {
return raSigningCert;
@@ -170,9 +185,11 @@ public class AutoInstaller {
// Set Admin Server Info
/**
- * Set Admin Server Information . Takes parameters : hostname, adminserver portnumber , adminId , adminPassword
+ * Set Admin Server Information . Takes parameters : hostname, adminserver
+ * portnumber , adminId , adminPassword
*/
- public void setAdminInfo(String h, String p, String adDN, String id, String adpwd) {
+ public void setAdminInfo(String h, String p, String adDN, String id,
+ String adpwd) {
adminDomain = adDN;
adminID = id;
adminPWD = adpwd;
@@ -181,12 +198,14 @@ public class AutoInstaller {
}
- // Set CA Server Info
+ // Set CA Server Info
/**
- * Set CA server Information . Takes parametrers :CAhostname, CAEEPORT, CAAGENTPORT , CAAdminUID, CAAdminPassword
+ * Set CA server Information . Takes parametrers :CAhostname, CAEEPORT,
+ * CAAGENTPORT , CAAdminUID, CAAdminPassword
*/
- public void setCAInfo(String cah, String caeep, String caagp, String caaduid, String caadpwd) {
+ public void setCAInfo(String cah, String caeep, String caagp,
+ String caaduid, String caadpwd) {
caHostname = cah;
caPortnum = caagp;
caTimeout = "30";
@@ -199,8 +218,9 @@ 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) {
@@ -220,13 +240,19 @@ public class AutoInstaller {
}
- // Set Subsystem Information for Configuring
+ // 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) {
+ 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) {
serverID = sID;
instanceID = "cert-" + sID;
@@ -243,12 +269,14 @@ public class AutoInstaller {
caOComponent = "test";
}
- // // Configure CMS Subsystems
+ // // Configure CMS Subsystems
/**
- * Confiures a CA Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
+ * Confiures a CA Subsystem .Takes parameter : adminSubjectDN, adminUID,
+ * AdminPasswd, SingleSignonPasswd
*/
- public boolean ConfigureCA(String adn, String aduid, String adp, String ssonpwd) {
+ public boolean ConfigureCA(String adn, String aduid, String adp,
+ String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
certAdminPWD = adp;
@@ -280,13 +308,14 @@ public class AutoInstaller {
}
- public boolean ConfigureTKS(String adn, String aduid, String adp, String ssonpwd) {
+ public boolean ConfigureTKS(String adn, String aduid, String adp,
+ String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
certAdminPWD = adp;
SingleSignOnPWD = ssonpwd;
- signingCert = "raSigningCert";
+ signingCert = "raSigningCert";
certType = signingCert;
subsystems = "tks";
ra = "false";
@@ -314,13 +343,13 @@ public class AutoInstaller {
}
private boolean ConfTKS() {
- // Start Configuring
+ // Start Configuring
// Step 1. Start Deamon
if (!startDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to start deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to start deamon");
return false;
}
@@ -334,37 +363,37 @@ public class AutoInstaller {
// Step 1a: Initialize Token ( Changed in 6.0)jjj
if (!initializePWD()) {
- System.out.println(
- "Configuring Cert Instance: error initializing pwd token");
+ System.out
+ .println("Configuring Cert Instance: error initializing pwd token");
return false;
}
// Step 2. Configure Internal DB
if (!configInternalDB()) {
- System.out.println(
- "Configuring Cert Instance: error configuring internal db");
+ System.out
+ .println("Configuring Cert Instance: error configuring internal db");
return false;
}
- // Step 3. Create Admin Values
+ // Step 3. Create Admin Values
if (!createAdminValues()) {
- System.out.println(
- "Configuring Cert Instance: error configuring admin values ");
+ System.out
+ .println("Configuring Cert Instance: error configuring admin values ");
return false;
}
- // Step 4. SubSystems
+ // Step 4. SubSystems
if (!selectSubSystem()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
// Step 5. Network Configuration
if (!networkConfig()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
@@ -383,53 +412,53 @@ public class AutoInstaller {
signingCert = "server";
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 8 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
- // Step 9 : CheckDN
+ // Step 9 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
// Step 10 :
if (!certRequest(false)) {
- System.out.println(
- "Configuring Cert Instance: error creating Request");
+ System.out
+ .println("Configuring Cert Instance: error creating Request");
return false;
}
- // After creating ssl cert
+ // After creating ssl cert
tokenPWD = mtokenPWD;
- // Step 11
+ // Step 11
if (!singleSignON()) {
- System.out.println(
- "Configuring Cert Instance: error setting up singlesignon");
+ System.out
+ .println("Configuring Cert Instance: error setting up singlesignon");
return false;
}
- // Step 11
+ // Step 11
if (!doMisc()) {
- System.out.println(
- "Configuring Cert Instance: error setting up miscell");
+ System.out
+ .println("Configuring Cert Instance: error setting up miscell");
return false;
}
- // Step 12
+ // Step 12
if (!exitDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to exit deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to exit deamon");
return false;
}
@@ -437,11 +466,12 @@ public class AutoInstaller {
}
/**
- * Confiures a RA Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
+ * Confiures a RA Subsystem .Takes parameter : adminSubjectDN, adminUID,
+ * AdminPasswd, SingleSignonPasswd
*/
-
- public boolean ConfigureRA(String adn, String aduid, String adp, String ssonpwd) {
+ public boolean ConfigureRA(String adn, String aduid, String adp,
+ String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
certAdminPWD = adp;
@@ -474,11 +504,12 @@ public class AutoInstaller {
}
/**
- * Confiures a OCSP Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
+ * Confiures a OCSP Subsystem .Takes parameter : adminSubjectDN, adminUID,
+ * AdminPasswd, SingleSignonPasswd
*/
-
- public boolean ConfigureOCSP(String adn, String aduid, String adp, String ssonpwd) {
+ public boolean ConfigureOCSP(String adn, String aduid, String adp,
+ String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
certAdminPWD = adp;
@@ -510,11 +541,12 @@ public class AutoInstaller {
}
/**
- * Confiures a KRA Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
+ * Confiures a KRA Subsystem .Takes parameter : adminSubjectDN, adminUID,
+ * AdminPasswd, SingleSignonPasswd
*/
-
- public boolean ConfigureKRA(String adn, String aduid, String adp, String ssonpwd) {
+ public boolean ConfigureKRA(String adn, String aduid, String adp,
+ String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
certAdminPWD = adp;
@@ -545,11 +577,12 @@ public class AutoInstaller {
}
/**
- * Confiures a SubCA Subsystem .Takes parameter : adminSubjectDN, adminUID, AdminPasswd, SingleSignonPasswd
+ * Confiures a SubCA Subsystem .Takes parameter : adminSubjectDN, adminUID,
+ * AdminPasswd, SingleSignonPasswd
*/
-
- public boolean ConfigureSubCA(String adn, String aduid, String adp, String ssonpwd) {
+ public boolean ConfigureSubCA(String adn, String aduid, String adp,
+ String ssonpwd) {
certAdminName = adn;
certAdminUid = aduid;
certAdminPWD = adp;
@@ -594,7 +627,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());
}
@@ -618,8 +652,8 @@ public class AutoInstaller {
}
private boolean Connect(String myStringUrl) {
- // / This functions connects to the URL and POST HTTP Request .
- // It compares with NMC_STATUS and return the status.
+ // / This functions connects to the URL and POST HTTP Request .
+ // It compares with NMC_STATUS and return the status.
System.out.println(myStringUrl);
st = false;
@@ -629,10 +663,12 @@ 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");
+ // Set StringURL to connect , set the query string and Connect .Get the
+ // result
+ System.out
+ .println("Log Info - configuring Cert Instance : Start Deamon");
setDeamonURL();
String myStringUrl = "http://" + host + "." + adminDomain + ":"
+ adminPort + deamonURL;
@@ -649,8 +685,8 @@ public class AutoInstaller {
private boolean configInternalDB() {
- System.out.println(
- "Log Info - configuring Cert Instance : configureInternalDB");
+ System.out
+ .println("Log Info - configuring Cert Instance : configureInternalDB");
setConfigURL();
String myStringUrl = "http://" + host + ":" + adminPort + configURL;
@@ -726,13 +762,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;
@@ -765,7 +801,7 @@ public class AutoInstaller {
query += "&kra=false";
query += "&subsystems=ca";
query += "&cloning=true";
- query += "&cloningInstance=" + URLEncoder.encode(cloneInstanceId);
+ query += "&cloningInstance=" + URLEncoder.encode(cloneInstanceId);
query += "&claTimeout=" + URLEncoder.encode("60");
query += "&internaldb.ldapauth.bindDN="
+ URLEncoder.encode(dbLDAPauthDN);
@@ -1051,8 +1087,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");
@@ -1086,7 +1122,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)) {
@@ -1103,9 +1139,9 @@ public class AutoInstaller {
int ReqId = 0;
- UserEnroll e = new UserEnroll(caHostname, caEEPort, subjectName, "test",
- "test", null, "test", "test", cdir, tokenpwd, ssl_clientcert,
- keyLength, keyType, null, null, signingCert);
+ UserEnroll e = new UserEnroll(caHostname, caEEPort, subjectName,
+ "test", "test", null, "test", "test", cdir, tokenpwd,
+ ssl_clientcert, keyLength, keyType, null, null, signingCert);
e.setpkcs10Request(certRequestStr);
if (e.Enroll()) {
@@ -1128,8 +1164,8 @@ public class AutoInstaller {
null, null, "approve", "enrollment", "showWaiting", null, trm);
if (r.ApproveRequests(getString(ReqId)) <= -1) {
- System.out.println(
- "Error : Agent request approval was not successful");
+ System.out
+ .println("Error : Agent request approval was not successful");
return false;
}
@@ -1155,7 +1191,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";
@@ -1175,8 +1211,9 @@ public class AutoInstaller {
+ "-----END CERTIFICATE-----\n";
// install cert
- System.out.println(
- "configuring Cert Instance : install cert :" + cert);
+ System.out
+ .println("configuring Cert Instance : install cert :"
+ + cert);
setConfigURL();
myStringUrl = "http://" + host + ":" + adminPort + configURL;
System.out.println(myStringUrl);
@@ -1188,7 +1225,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";
@@ -1201,30 +1238,31 @@ 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) {
@@ -1236,19 +1274,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 += "&";
@@ -1259,33 +1297,39 @@ public class AutoInstaller {
query += "&certType=" + URLEncoder.encode(certType);
query += "&beginYear="
- + URLEncoder.encode(getString(begin.get(GregorianCalendar.YEAR)));
+ + URLEncoder
+ .encode(getString(begin.get(GregorianCalendar.YEAR)));
query += "&beginMonth="
- + URLEncoder.encode(
- getString(begin.get(GregorianCalendar.MONTH)));
+ + URLEncoder.encode(getString(begin
+ .get(GregorianCalendar.MONTH)));
query += "&beginDate="
- + URLEncoder.encode(getString(begin.get(GregorianCalendar.DATE)));
+ + URLEncoder
+ .encode(getString(begin.get(GregorianCalendar.DATE)));
query += "&beginHour="
- + URLEncoder.encode(getString(begin.get(GregorianCalendar.HOUR)));
+ + URLEncoder
+ .encode(getString(begin.get(GregorianCalendar.HOUR)));
query += "&beginMin="
- + URLEncoder.encode(
- getString(begin.get(GregorianCalendar.MINUTE)));
+ + URLEncoder.encode(getString(begin
+ .get(GregorianCalendar.MINUTE)));
query += "&beginSec="
- + URLEncoder.encode(
- getString(begin.get(GregorianCalendar.SECOND)));
+ + URLEncoder.encode(getString(begin
+ .get(GregorianCalendar.SECOND)));
query += "&afterYear="
+ URLEncoder.encode(getString(end.get(GregorianCalendar.YEAR)));
query += "&afterMonth="
- + URLEncoder.encode(getString(end.get(GregorianCalendar.MONTH)));
+ + URLEncoder
+ .encode(getString(end.get(GregorianCalendar.MONTH)));
query += "&afterDate="
+ URLEncoder.encode(getString(end.get(GregorianCalendar.DATE)));
query += "&afterHour="
+ URLEncoder.encode(getString(end.get(GregorianCalendar.HOUR)));
query += "&afterMin="
- + URLEncoder.encode(getString(end.get(GregorianCalendar.MINUTE)));
+ + URLEncoder
+ .encode(getString(end.get(GregorianCalendar.MINUTE)));
query += "&afterSec="
- + URLEncoder.encode(getString(end.get(GregorianCalendar.SECOND)));
+ + URLEncoder
+ .encode(getString(end.get(GregorianCalendar.SECOND)));
query += "&keyType=" + URLEncoder.encode(keyType);
query += "&keyLength=" + URLEncoder.encode(keyLength);
@@ -1298,7 +1342,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");
@@ -1310,7 +1354,7 @@ public class AutoInstaller {
query += "&mailCABit=" + URLEncoder.encode(mailCABit);
query += "&objectSigningCABit="
+ URLEncoder.encode(objectSigningCABit);
-
+
}
query += "&hashType=" + URLEncoder.encode(hashType);
@@ -1344,7 +1388,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";
@@ -1381,7 +1425,7 @@ public class AutoInstaller {
}
private boolean exitDeamon() {
-
+
System.out.println("configuring Cert Instance : Exit Deamon");
setDeamonURL();
String myStringUrl = "http://" + host + ":" + adminPort + configURL;
@@ -1404,8 +1448,8 @@ public class AutoInstaller {
// Step 1. Start Deamon
if (!startDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to start deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to start deamon");
return false;
}
@@ -1419,62 +1463,62 @@ public class AutoInstaller {
// Step 1a: Initialize Token ( Changed in 6.0)jjj
if (!initializePWD()) {
- System.out.println(
- "Configuring Cert Instance: error initializing pwd token");
+ System.out
+ .println("Configuring Cert Instance: error initializing pwd token");
return false;
}
// Step 2. Configure Internal DB
if (!configInternalDB()) {
- System.out.println(
- "Configuring Cert Instance: error configuring internal db");
+ System.out
+ .println("Configuring Cert Instance: error configuring internal db");
return false;
}
// Step 3. Create Admin Values
if (!createAdminValues()) {
- System.out.println(
- "Configuring Cert Instance: error configuring admin values ");
+ System.out
+ .println("Configuring Cert Instance: error configuring admin values ");
return false;
}
// Step 4. SubSystems
if (!selectSubSystem()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
// Step 5. Network Configuration
if (!networkConfig()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
// Step 6: Initialize Token This has been moved to step 1a
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 7 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
// Step 8 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
- // Step 9 : certRequest and Install
+ // Step 9 : certRequest and Install
if (!certRequest(false)) {
System.out.println("Configuring Cert Instance: error getting cert");
return false;
@@ -1495,29 +1539,29 @@ public class AutoInstaller {
signingCert = "server";
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 8 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
// Step 9 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
// Step 10 :
if (!certRequest(false)) {
- System.out.println(
- "Configuring Cert Instance: error creating Request");
+ System.out
+ .println("Configuring Cert Instance: error creating Request");
return false;
}
@@ -1526,22 +1570,22 @@ public class AutoInstaller {
// Step 11
if (!singleSignON()) {
- System.out.println(
- "Configuring Cert Instance: error setting up singlesignon");
+ System.out
+ .println("Configuring Cert Instance: error setting up singlesignon");
return false;
}
// Step 11
if (!doMisc()) {
- System.out.println(
- "Configuring Cert Instance: error setting up miscell");
+ System.out
+ .println("Configuring Cert Instance: error setting up miscell");
return false;
}
// Step 12
if (!exitDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to exit deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to exit deamon");
return false;
}
@@ -1597,13 +1641,13 @@ public class AutoInstaller {
}
private boolean ConfRA() {
- // Start Configuring
+ // Start Configuring
// Step 1. Start Deamon
if (!startDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to start deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to start deamon");
return false;
}
@@ -1617,62 +1661,63 @@ public class AutoInstaller {
// Step 1a: Initialize Token ( Changed in 6.0)jjj
if (!initializePWD()) {
- System.out.println(
- "Configuring Cert Instance: error initializing pwd token");
+ System.out
+ .println("Configuring Cert Instance: error initializing pwd token");
return false;
}
// Step 2. Configure Internal DB
if (!configInternalDB()) {
- System.out.println(
- "Configuring Cert Instance: error configuring internal db");
+ System.out
+ .println("Configuring Cert Instance: error configuring internal db");
return false;
}
- // Step 3. Create Admin Values
+ // Step 3. Create Admin Values
if (!createAdminValues()) {
- System.out.println(
- "Configuring Cert Instance: error configuring admin values ");
+ System.out
+ .println("Configuring Cert Instance: error configuring admin values ");
return false;
}
- // Step 4. SubSystems
+ // Step 4. SubSystems
if (!selectSubSystem()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
// Step 5. Network Configuration
if (!networkConfig()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
// Step 6: Initialize Token This has been moved to step 1a
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 7 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
- // Step 8 : CheckDN
+ // Step 8 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
- // Step 9 : certRequest and Install i.e approve the request as a trusted manager
+ // Step 9 : certRequest and Install i.e approve the request as a trusted
+ // manager
if (!certRequest(true)) {
System.out.println("Configuring Cert Instance: error getting cert");
return false;
@@ -1693,53 +1738,53 @@ public class AutoInstaller {
signingCert = "server";
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 8 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
- // Step 9 : CheckDN
+ // Step 9 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
// Step 10 :
if (!certRequest(false)) {
- System.out.println(
- "Configuring Cert Instance: error creating Request");
+ System.out
+ .println("Configuring Cert Instance: error creating Request");
return false;
}
- // After creating ssl cert
+ // After creating ssl cert
tokenPWD = mtokenPWD;
- // Step 11
+ // Step 11
if (!singleSignON()) {
- System.out.println(
- "Configuring Cert Instance: error setting up singlesignon");
+ System.out
+ .println("Configuring Cert Instance: error setting up singlesignon");
return false;
}
- // Step 11
+ // Step 11
if (!doMisc()) {
- System.out.println(
- "Configuring Cert Instance: error setting up miscell");
+ System.out
+ .println("Configuring Cert Instance: error setting up miscell");
return false;
}
- // Step 12
+ // Step 12
if (!exitDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to exit deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to exit deamon");
return false;
}
@@ -1747,13 +1792,13 @@ public class AutoInstaller {
}
private boolean ConfKRA() {
- // Start Configuring
+ // Start Configuring
// Step 1. Start Deamon
if (!startDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to start deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to start deamon");
return false;
}
@@ -1767,77 +1812,79 @@ public class AutoInstaller {
// Step 1a: Initialize Token ( Changed in 6.0)jjj
if (!initializePWD()) {
- System.out.println(
- "Configuring Cert Instance: error initializing pwd token");
+ System.out
+ .println("Configuring Cert Instance: error initializing pwd token");
return false;
}
// Step 2. Configure Internal DB
if (!configInternalDB()) {
- System.out.println(
- "Configuring Cert Instance: error configuring internal db");
+ System.out
+ .println("Configuring Cert Instance: error configuring internal db");
return false;
}
- // Step 3. Create Admin Values
+ // Step 3. Create Admin Values
if (!createAdminValues()) {
- System.out.println(
- "Configuring Cert Instance: error configuring admin values ");
+ System.out
+ .println("Configuring Cert Instance: error configuring admin values ");
return false;
}
- // Step 4. SubSystems
+ // Step 4. SubSystems
if (!selectSubSystem()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
// Step 5. Network Configuration
if (!networkConfig()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
// Step 6: Initialize Token This has been moved to step 1a
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 7 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
- // Step 8 : CheckDN
+ // Step 8 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
- // Step 9 : certRequest and Install i.e approve the request as a trusted manager
+ // Step 9 : certRequest and Install i.e approve the request as a trusted
+ // manager
if (!certRequest(true)) {
System.out.println("Configuring Cert Instance: error getting cert");
return false;
}
if (!setupStorageKey()) {
- System.out.println(
- "Configuring Cert Instance: error configuring storage key");
+ System.out
+ .println("Configuring Cert Instance: error configuring storage key");
return false;
}
// no need to do this from 7.1 due to new acl based key recovery
/*
- if (!setupKRAAgents())
- { System.out.println("Configuring Cert Instance: error configuring storage key"); return false;}
+ * if (!setupKRAAgents()) { System.out.println(
+ * "Configuring Cert Instance: error configuring storage key"); return
+ * false;}
*/
// Create a SSL signing cert
@@ -1855,53 +1902,53 @@ public class AutoInstaller {
signingCert = "server";
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 8 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
- // Step 9 : CheckDN
+ // Step 9 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
// Step 10 :
if (!certRequest(false)) {
- System.out.println(
- "Configuring Cert Instance: error creating Request");
+ System.out
+ .println("Configuring Cert Instance: error creating Request");
return false;
}
- // After creating ssl cert
+ // After creating ssl cert
tokenPWD = mtokenPWD;
- // Step 11
+ // Step 11
if (!singleSignON()) {
- System.out.println(
- "Configuring Cert Instance: error setting up singlesignon");
+ System.out
+ .println("Configuring Cert Instance: error setting up singlesignon");
return false;
}
- // Step 11
+ // Step 11
if (!doMisc()) {
- System.out.println(
- "Configuring Cert Instance: error setting up miscell");
+ System.out
+ .println("Configuring Cert Instance: error setting up miscell");
return false;
}
- // Step 12
+ // Step 12
if (!exitDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to exit deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to exit deamon");
return false;
}
@@ -1916,8 +1963,8 @@ public class AutoInstaller {
// Step 1. Start Deamon
if (!startDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to start deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to start deamon");
return false;
}
@@ -1931,62 +1978,63 @@ public class AutoInstaller {
// Step 1a: Initialize Token ( Changed in 6.0)jjj
if (!initializePWD()) {
- System.out.println(
- "Configuring Cert Instance: error initializing pwd token");
+ System.out
+ .println("Configuring Cert Instance: error initializing pwd token");
return false;
}
// Step 2. Configure Internal DB
if (!configInternalDB()) {
- System.out.println(
- "Configuring Cert Instance: error configuring internal db");
+ System.out
+ .println("Configuring Cert Instance: error configuring internal db");
return false;
}
// Step 3. Create Admin Values
if (!createAdminValues()) {
- System.out.println(
- "Configuring Cert Instance: error configuring admin values ");
+ System.out
+ .println("Configuring Cert Instance: error configuring admin values ");
return false;
}
// Step 4. SubSystems
if (!selectSubSystem()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
// Step 5. Network Configuration
if (!networkConfig()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
// Step 6: Initialize Token This has been moved to step 1a
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 7 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
// Step 8 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
- // Step 9 : certRequest and Install i.e approve the request as a trusted manager
+ // Step 9 : certRequest and Install i.e approve the request as a trusted
+ // manager
if (!certRequest(false)) {
System.out.println("Configuring Cert Instance: error getting cert");
return false;
@@ -2007,29 +2055,29 @@ public class AutoInstaller {
signingCert = "server";
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 8 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
// Step 9 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
// Step 10 :
if (!certRequest(false)) {
- System.out.println(
- "Configuring Cert Instance: error creating Request");
+ System.out
+ .println("Configuring Cert Instance: error creating Request");
return false;
}
@@ -2038,22 +2086,22 @@ public class AutoInstaller {
// Step 11
if (!singleSignON()) {
- System.out.println(
- "Configuring Cert Instance: error setting up singlesignon");
+ System.out
+ .println("Configuring Cert Instance: error setting up singlesignon");
return false;
}
// Step 11
if (!doMisc()) {
- System.out.println(
- "Configuring Cert Instance: error setting up miscell");
+ System.out
+ .println("Configuring Cert Instance: error setting up miscell");
return false;
}
// Step 12
if (!exitDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to exit deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to exit deamon");
return false;
}
@@ -2064,13 +2112,13 @@ public class AutoInstaller {
// org
private boolean ConfCA() {
- // Start Configuring
+ // Start Configuring
// Step 1. Start Deamon
if (!startDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to start deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to start deamon");
return false;
}
@@ -2084,82 +2132,85 @@ public class AutoInstaller {
// Step 1a: Initialize Token ( Changed in 6.0)jjj
if (!initializePWD()) {
- System.out.println(
- "Configuring Cert Instance: error initializing pwd token");
+ System.out
+ .println("Configuring Cert Instance: error initializing pwd token");
return false;
}
// Step 2. Configure Internal DB
if (!configInternalDB()) {
- System.out.println(
- "Configuring Cert Instance: error configuring internal db");
+ System.out
+ .println("Configuring Cert Instance: error configuring internal db");
return false;
}
- // Step 3. Create Admin Values
+ // Step 3. Create Admin Values
if (!createAdminValues()) {
- System.out.println(
- "Configuring Cert Instance: error configuring admin values ");
+ System.out
+ .println("Configuring Cert Instance: error configuring admin values ");
return false;
}
- // Step 4. SubSystems
+ // Step 4. SubSystems
if (!selectSubSystem()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
- // SetSerial Number
+ // SetSerial Number
if (!setSerial("1", "1000000")) {
- System.out.println(
- "Configuring Cert Instance: error setting serial number");
+ System.out
+ .println("Configuring Cert Instance: error setting serial number");
return false;
}
if (!setOCSP()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
// Step 5. Network Configuration
if (!networkConfig()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
- // Step 6. setting up Server Migration
+ // Step 6. setting up Server Migration
// if (!serverMigration())
- // { System.out.println("Configuring Cert Instance: error configuring server migration"); return false;}
+ // {
+ // System.out.println("Configuring Cert Instance: error configuring server migration");
+ // return false;}
// Step 7: Initialize Token
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 8 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
- // Step 9 : CheckDN
+ // Step 9 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
// Step 10 :
if (!createCert()) {
- System.out.println("Configuring Cert Instance: error creating cert");
+ System.out
+ .println("Configuring Cert Instance: error creating cert");
return false;
}
@@ -2176,59 +2227,60 @@ public class AutoInstaller {
tokenPWD = "";
if (!initializeToken()) {
- System.out.println(
- "Configuring Cert Instance: error initializing token");
+ System.out
+ .println("Configuring Cert Instance: error initializing token");
return false;
}
// Step 8 : keyLenth
if (!keyLength()) {
- System.out.println(
- "Configuring Cert Instance: error configuring KeyLength");
+ System.out
+ .println("Configuring Cert Instance: error configuring KeyLength");
return false;
}
- // Step 9 : CheckDN
+ // Step 9 : CheckDN
if (!checkDN()) {
- System.out.println(
- "Configuring Cert Instance: error checking deamon");
+ System.out
+ .println("Configuring Cert Instance: error checking deamon");
return false;
}
// Step 10 :
if (!createCert()) {
- System.out.println("Configuring Cert Instance: error creating cert");
+ System.out
+ .println("Configuring Cert Instance: error creating cert");
return false;
}
- // After creating ssl cert
+ // After creating ssl cert
tokenPWD = mtokenPWD;
- // Step 11
+ // Step 11
if (!singleSignON()) {
- System.out.println(
- "Configuring Cert Instance: error setting up singlesignon");
+ System.out
+ .println("Configuring Cert Instance: error setting up singlesignon");
return false;
}
- // Step 11
+ // Step 11
if (!doMisc()) {
- System.out.println(
- "Configuring Cert Instance: error setting up miscell");
+ System.out
+ .println("Configuring Cert Instance: error setting up miscell");
return false;
}
- // Step 12
+ // Step 12
if (!exitDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to exit deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to exit deamon");
return false;
}
return true;
}
- // Configure Clone
+ // Configure Clone
private boolean ConfClone() {
// Start Configuring
@@ -2236,8 +2288,8 @@ public class AutoInstaller {
// Step 1. Start Deamon
if (!startDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to start deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to start deamon");
return false;
}
@@ -2251,30 +2303,30 @@ public class AutoInstaller {
// Step 1a: Initialize Token ( Changed in 6.0)jjj
if (!initializePWD()) {
- System.out.println(
- "Configuring Cert Instance: error initializing pwd token");
+ System.out
+ .println("Configuring Cert Instance: error initializing pwd token");
return false;
}
// Step 2. Configure Internal DB
if (!configInternalDB()) {
- System.out.println(
- "Configuring Cert Instance: error configuring internal db");
+ System.out
+ .println("Configuring Cert Instance: error configuring internal db");
return false;
}
// Step 3. Create Admin Values
if (!createAdminValues()) {
- System.out.println(
- "Configuring Cert Instance: error configuring admin values ");
+ System.out
+ .println("Configuring Cert Instance: error configuring admin values ");
return false;
}
// Step 4. SubSystems
if (!selectSubSystem()) {
- System.out.println(
- "Configuring Cert Instance: error selecting subsystems");
+ System.out
+ .println("Configuring Cert Instance: error selecting subsystems");
return false;
}
@@ -2291,19 +2343,20 @@ public class AutoInstaller {
// Step 5. Network Configuration
if (!networkConfig()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
if (!taskCloning()) {
- System.out.println("Configuring Cert Instance: error Task Cloning ");
+ System.out
+ .println("Configuring Cert Instance: error Task Cloning ");
return false;
}
if (!taskCloneMaster()) {
- System.out.println(
- "Configuring Cert Instance: error configuring network ports ");
+ System.out
+ .println("Configuring Cert Instance: error configuring network ports ");
return false;
}
@@ -2311,28 +2364,29 @@ public class AutoInstaller {
certType = "serverCert";
if (!taskCloning()) {
- System.out.println("Configuring Cert Instance: error Task Cloning ");
+ System.out
+ .println("Configuring Cert Instance: error Task Cloning ");
return false;
}
- // Step 11
+ // Step 11
if (!singleSignON()) {
- System.out.println(
- "Configuring Cert Instance: error setting up singlesignon");
+ System.out
+ .println("Configuring Cert Instance: error setting up singlesignon");
return false;
}
- // Step 11
+ // Step 11
if (!doMisc()) {
- System.out.println(
- "Configuring Cert Instance: error setting up miscell");
+ System.out
+ .println("Configuring Cert Instance: error setting up miscell");
return false;
}
- // Step 12
+ // Step 12
if (!exitDeamon()) {
- System.out.println(
- "Configuring Cert Instance: Unable to exit deamon");
+ System.out
+ .println("Configuring Cert Instance: Unable to exit deamon");
return false;
}
@@ -2345,11 +2399,11 @@ public class AutoInstaller {
try {
getProperties(propFileName);
} catch (Exception e) {
- System.out.println(
- "exception reading Properties File " + e.getMessage());
+ System.out.println("exception reading Properties File "
+ + e.getMessage());
}
- // read all properties
+ // read all properties
adminDomain = props.getProperty("inst.admin.domain");
adminID = props.getProperty("inst.admin.uid");
@@ -2421,12 +2475,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();
}
@@ -2436,9 +2490,8 @@ public class AutoInstaller {
public static void main(String args[]) {
// Exit Status - (-1) for error
- // - 1 Configured and server Alive
- // - 0 Configured bur could not sart server
-
+ // - 1 Configured and server Alive
+ // - 0 Configured bur could not sart server
AutoInstaller t = new AutoInstaller();
@@ -2448,13 +2501,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 {
@@ -2464,5 +2517,5 @@ public class AutoInstaller {
}
}
-} // end of class
+} // end of class
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 a3ceec31a..b9740ee4a 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,42 +18,41 @@ 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.
+ * 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.
*/
-
-
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) {
+ public void setLDAPInfo(String h, String p, String dn, String pw,
+ String base, boolean sc) {
ldaphost = h;
ldapport = p;
ldapdn = dn;
@@ -63,8 +63,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 +79,8 @@ 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 +99,10 @@ 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 +115,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 6913a1440..88d9ac849 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
+ * CMS Test framework . 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)
+ * Constructor . Reads the CS.cfg file .Takes the parameter for Configfile (
+ * Provide fullpath)
*/
-
public CMSConfig(String confFile) {
CMSConfigFile = confFile;
System.out.println(CMSConfigFile);
@@ -71,7 +69,7 @@ public class CMSConfig extends ServerInfo {
}
/**
- * Saves the config file
+ * Saves the config file
**/
public void saveCMSConfig() {
@@ -97,15 +95,16 @@ public class CMSConfig extends ServerInfo {
}
- // Authentication
-
+ // Authentication
// Enable DirectoryBased Authentication
/**
- * Takes parameters : secureConnection( true/false), basedn, ldaphostname, lapdaportnumber ( in case of secured connection give ldap secured port)
+ * Takes parameters : secureConnection( true/false), basedn, ldaphostname,
+ * lapdaportnumber ( in case of secured connection give ldap secured port)
*/
- public void EnableDirEnrollment(boolean secureConn, String ldapbase, String lhost, String lport) {
+ public void EnableDirEnrollment(boolean secureConn, String ldapbase,
+ String lhost, String lport) {
CMSprops.setProperty("auths.instance.UserDirEnrollment.dnpattern",
"UID=$attr.uid,E=$attr.mail.1,CN=$attr.cn,OU=$dn.ou.2,O=$dn.o,C=US");
CMSprops.setProperty("auths.instance.UserDirEnrollment.ldap.basedn",
@@ -128,14 +127,16 @@ public class CMSConfig extends ServerInfo {
"auths.instance.UserDirEnrollment.ldap.ldapconn.secureConn",
"true");
CMSprops.setProperty(
- "auths.instance.UserDirEnrollment.ldap.ldapconn.port", lport);
+ "auths.instance.UserDirEnrollment.ldap.ldapconn.port",
+ lport);
} else {
CMSprops.setProperty(
"auths.instance.UserDirEnrollment.ldap.ldapconn.secureConn",
"false");
CMSprops.setProperty(
- "auths.instance.UserDirEnrollment.ldap.ldapconn.port", lport);
+ "auths.instance.UserDirEnrollment.ldap.ldapconn.port",
+ lport);
}
}
@@ -145,8 +146,7 @@ public class CMSConfig extends ServerInfo {
CMSprops.remove("auths.instance.UserDirEnrollment.ldap.basedn");
CMSprops.remove("auths.instance.UserDirEnrollment.ldap.ldapconn.host");
CMSprops.remove("auths.instance.UserDirEnrollment.ldap.ldapconn.port");
- CMSprops.remove(
- "auths.instance.UserDirEnrollment.ldap.ldapconn.secureConn");
+ CMSprops.remove("auths.instance.UserDirEnrollment.ldap.ldapconn.secureConn");
CMSprops.remove("auths.instance.UserDirEnrollment.ldap.ldapconn.version");
CMSprops.remove("auths.instance.UserDirEnrollment.ldap.maxConns");
CMSprops.remove("auths.instance.UserDirEnrollment.ldap.minConns");
@@ -163,10 +163,13 @@ public class CMSConfig extends ServerInfo {
}
/**
- * Takes parameters : secureConnection( true/false), ldapbinddn, ldapbindnpassword,ldaphostname, lapdaportnumber ( in case of secured connection give ldap secured port), basedn (e.g ou=people,o=mcom.com)
+ * Takes parameters : secureConnection( true/false), ldapbinddn,
+ * ldapbindnpassword,ldaphostname, lapdaportnumber ( in case of secured
+ * connection give ldap secured port), basedn (e.g ou=people,o=mcom.com)
*/
- void EnablePortalAuth(boolean secureConn, String ldaprootDN, String ldaprootDNPW, String lhost, String lport, String lbsuffix) {
+ void EnablePortalAuth(boolean secureConn, String ldaprootDN,
+ String ldaprootDNPW, String lhost, String lport, String lbsuffix) {
String certnickname = null;
CMSprops.setProperty("auths.instance.PortalEnrollment.pluginName",
@@ -179,7 +182,8 @@ public class CMSConfig extends ServerInfo {
"3");
CMSprops.setProperty("auths.instance.PortalEnrollment.ldap.minConns",
"2");
- CMSprops.setProperty("auths.instance.PortalEnrollment.ldap.objectclass",
+ CMSprops.setProperty(
+ "auths.instance.PortalEnrollment.ldap.objectclass",
"inetOrgPerson");
CMSprops.setProperty(
"auths.instance.PortalEnrollment.ldap.ldapauth.bindDN",
@@ -221,12 +225,15 @@ public class CMSConfig extends ServerInfo {
}
- // Publishing
+ // Publishing
/**
- * Takes parameters : secureConnection( true/false), ldapbinddn, ldapbindnpassword,ldaphostname, lapdaportnumber ( in case of secured connection give ldap secured port)
+ * Takes parameters : secureConnection( true/false), ldapbinddn,
+ * ldapbindnpassword,ldaphostname, lapdaportnumber ( in case of secured
+ * connection give ldap secured port)
*/
- public void EnablePublishing(boolean secureConn, String ldaprootDN, String ldaprootDNPW, String lhost, String lport) {
+ public void EnablePublishing(boolean secureConn, String ldaprootDN,
+ String ldaprootDNPW, String lhost, String lport) {
CMSprops.setProperty("ca.publish.enable", "true");
CMSprops.setProperty("ca.publish.ldappublish.enable", "true");
@@ -236,27 +243,32 @@ public class CMSConfig extends ServerInfo {
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.port",
lport);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.authtype",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.authtype",
"SslClientAuth");
} else {
CMSprops.setProperty(
"ca.publish.ldappublish.ldap.ldapconn.secureConn", "false");
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.port",
lport);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.authtype",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.authtype",
"BasicAuth");
}
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.bindDN",
ldaprootDN);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.bindPassword",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.bindPassword",
ldaprootDNPW);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.bindPWPrompt",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.bindPWPrompt",
"CA LDAP Publishing");
// set the hostname with fully qulified name if you are using SSL
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.host", lhost);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.version", "3");
+ CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.version",
+ "3");
CMSprops.setProperty("ca.publish.mapper.impl.LdapCaSimpleMap.class",
"com.netscape.cms.publish.mappers.LdapCaSimpleMap");
CMSprops.setProperty("ca.publish.mapper.impl.LdapDNCompsMap.class",
@@ -270,7 +282,8 @@ public class CMSConfig extends ServerInfo {
CMSprops.setProperty("ca.publish.mapper.impl.LdapSubjAttrMap.class",
"com.netscape.cms.publish.mappers.LdapCertSubjMap");
CMSprops.setProperty(
- "ca.publish.mapper.instance.LdapCaCertMap.createCAEntry", "true");
+ "ca.publish.mapper.instance.LdapCaCertMap.createCAEntry",
+ "true");
CMSprops.setProperty(
"ca.publish.mapper.instance.LdapCaCertMap.dnPattern",
"UID=CManager,OU=people,O=mcom.com");
@@ -281,7 +294,8 @@ public class CMSConfig extends ServerInfo {
"ca.publish.mapper.instance.LdapCrlMap.createCAEntry", "true");
CMSprops.setProperty("ca.publish.mapper.instance.LdapCrlMap.dnPattern",
"UID=CManager,OU=people,O=mcom.com");
- CMSprops.setProperty("ca.publish.mapper.instance.LdapCrlMap.pluginName",
+ CMSprops.setProperty(
+ "ca.publish.mapper.instance.LdapCrlMap.pluginName",
"LdapCaSimpleMap");
CMSprops.setProperty(
"ca.publish.mapper.instance.LdapUserCertMap.dnPattern",
@@ -295,7 +309,8 @@ public class CMSConfig extends ServerInfo {
CMSprops.setProperty(
"ca.publish.publisher.impl.LdapCaCertPublisher.class",
"com.netscape.cms.publish.publishers.LdapCaCertPublisher");
- CMSprops.setProperty("ca.publish.publisher.impl.LdapCrlPublisher.class",
+ CMSprops.setProperty(
+ "ca.publish.publisher.impl.LdapCrlPublisher.class",
"com.netscape.cms.publish.publishers.LdapCrlPublisher");
CMSprops.setProperty(
"ca.publish.publisher.impl.LdapUserCertPublisher.class",
@@ -325,7 +340,8 @@ public class CMSConfig extends ServerInfo {
"LdapUserCertPublisher");
}
- public void DisablePublishing(boolean secureConn, String ldaprootDN, String ldaprootDNPW, String lhost, String lport, String base) {
+ public void DisablePublishing(boolean secureConn, String ldaprootDN,
+ String ldaprootDNPW, String lhost, String lport, String base) {
CMSprops.setProperty("ca.publish.enable", "false");
CMSprops.setProperty("ca.publish.ldappublish.enable", "false");
@@ -335,27 +351,32 @@ public class CMSConfig extends ServerInfo {
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.port",
lport);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.authtype",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.authtype",
"SslClientAuth");
} else {
CMSprops.setProperty(
"ca.publish.ldappublish.ldap.ldapconn.secureConn", "false");
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.port",
lport);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.authtype",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.authtype",
"BasicAuth");
}
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.bindDN",
ldaprootDN);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.bindPassword",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.bindPassword",
ldaprootDNPW);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapauth.bindPWPrompt",
+ CMSprops.setProperty(
+ "ca.publish.ldappublish.ldap.ldapauth.bindPWPrompt",
"CA LDAP Publishing");
// set the hostname with fully qulified name if you are using SSL
CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.host", lhost);
- CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.version", "3");
+ CMSprops.setProperty("ca.publish.ldappublish.ldap.ldapconn.version",
+ "3");
CMSprops.setProperty("ca.publish.mapper.impl.LdapCaSimpleMap.class",
"com.netscape.cms.publish.mappers.LdapCaSimpleMap");
CMSprops.setProperty("ca.publish.mapper.impl.LdapDNCompsMap.class",
@@ -381,7 +402,8 @@ public class CMSConfig extends ServerInfo {
"ca.publish.mapper.instance.LdapCrlMap.createCAEntry", "false");
CMSprops.setProperty("ca.publish.mapper.instance.LdapCrlMap.dnPattern",
"UID=CManager,OU=people," + base);
- CMSprops.setProperty("ca.publish.mapper.instance.LdapCrlMap.pluginName",
+ CMSprops.setProperty(
+ "ca.publish.mapper.instance.LdapCrlMap.pluginName",
"LdapCaSimpleMap");
CMSprops.setProperty(
"ca.publish.mapper.instance.LdapUserCertMap.dnPattern",
@@ -395,7 +417,8 @@ public class CMSConfig extends ServerInfo {
CMSprops.setProperty(
"ca.publish.publisher.impl.LdapCaCertPublisher.class",
"com.netscape.cms.publish.publishers.LdapCaCertPublisher");
- CMSprops.setProperty("ca.publish.publisher.impl.LdapCrlPublisher.class",
+ CMSprops.setProperty(
+ "ca.publish.publisher.impl.LdapCrlPublisher.class",
"com.netscape.cms.publish.publishers.LdapCrlPublisher");
CMSprops.setProperty(
"ca.publish.publisher.impl.LdapUserCertPublisher.class",
@@ -425,8 +448,9 @@ public class CMSConfig extends ServerInfo {
"LdapUserCertPublisher");
}
- public void CreateOCSPPublisher(String OCSPHost, String OCSPPort, String OCSPEEPort) {
- // Set host nmae with fully qualified hostname
+ public void CreateOCSPPublisher(String OCSPHost, String OCSPPort,
+ String OCSPEEPort) {
+ // Set host nmae with fully qualified hostname
String location = "http://" + OCSPHost + ":" + OCSPEEPort + "/ocsp";
CMSprops.setProperty("ca.crl.MasterCRL.alwaysUpdate", "true");
@@ -445,14 +469,15 @@ public class CMSConfig extends ServerInfo {
CMSprops.setProperty(
"ca.publish.rule.instance.OCSPPublishingRule.mapper", "");
CMSprops.setProperty(
- "ca.publish.rule.instance.OCSPPublishingRule.pluginName", "Rule");
+ "ca.publish.rule.instance.OCSPPublishingRule.pluginName",
+ "Rule");
CMSprops.setProperty(
"ca.publish.rule.instance.OCSPPublishingRule.predicate", "");
CMSprops.setProperty(
"ca.publish.rule.instance.OCSPPublishingRule.publisher",
"CAOCSPPublisher");
- CMSprops.setProperty("ca.publish.rule.instance.OCSPPublishingRule.type",
- "crl");
+ CMSprops.setProperty(
+ "ca.publish.rule.instance.OCSPPublishingRule.type", "crl");
CMSprops.setProperty("ca.Policy.rule.AuthInfoAccessExt.ad0_location",
location);
CMSprops.setProperty(
@@ -500,7 +525,8 @@ public class CMSConfig extends ServerInfo {
}
- public void SetupKRAConnectorInCA(String certInstanceID, String KRAHost, String KRAPort) {
+ public void SetupKRAConnectorInCA(String certInstanceID, String KRAHost,
+ String KRAPort) {
String certNickName = "Server-Cert " + certInstanceID;
CMSprops.setProperty("ca.connector.KRA.enable", "true");
@@ -562,8 +588,9 @@ public class CMSConfig extends ServerInfo {
}
- // Policies
- public void DefaultValidityRule(String SubsystemType, String lagtime, String leadtime, String maxValidity) {
+ // Policies
+ public void DefaultValidityRule(String SubsystemType, String lagtime,
+ String leadtime, String maxValidity) {
if (SubsystemType.equals("ca")) {
CMSprops.setProperty("ca.Policy.rule.DefaultValidityRule.enable",
"true");
@@ -580,8 +607,8 @@ public class CMSConfig extends ServerInfo {
"ca.Policy.rule.DefaultValidityRule.minValidity", "1");
CMSprops.setProperty(
"ca.Policy.rule.DefaultValidityRule.notBeforeSkew", "5");
- CMSprops.setProperty("ca.Policy.rule.DefaultValidityRule.predicate",
- null);
+ CMSprops.setProperty(
+ "ca.Policy.rule.DefaultValidityRule.predicate", null);
} else {
CMSprops.setProperty("ra.Policy.rule.DefaultValidityRule.enable",
@@ -599,8 +626,8 @@ public class CMSConfig extends ServerInfo {
"ra.Policy.rule.DefaultValidityRule.minValidity", "1");
CMSprops.setProperty(
"ra.Policy.rule.DefaultValidityRule.notBeforeSkew", "5");
- CMSprops.setProperty("ra.Policy.rule.DefaultValidityRule.predicate",
- null);
+ CMSprops.setProperty(
+ "ra.Policy.rule.DefaultValidityRule.predicate", null);
}
}
@@ -617,10 +644,10 @@ public class CMSConfig extends ServerInfo {
CMSConfig s = new CMSConfig(args[0]);
boolean secureC = false;
- // s.EnableDirEnrollment(secureC);
+ // s.EnableDirEnrollment(secureC);
s.saveCMSConfig();
-
+
}// end of function main
-} // end of class
+} // 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 0687bc2aa..75e7e438d 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,26 +26,34 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URLEncoder;
-
public class CMSInstance {
private int i;
private boolean st;
- private String host, port, AdminDN, AdminDNPW, serverRoot, instanceID, sieurl, adminDomain, machineName;
+ private String host, port, AdminDN, AdminDNPW, serverRoot, instanceID,
+ sieurl, adminDomain, machineName;
/**
- * CMS Test framework .
- * This class Creates and Removes a CMS server instance
+ * CMS Test framework . 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"
+ * 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"
*/
- private String cs_server_root, cs_tps_root, tps_hostname, tps_fqdn, tps_instanceid, tps_ee_port, tps_agent_port, tps_auth_ldap_host, tps_auth_ldap_port, tps_auth_ldap_suffix, ca_hostname, ca_ee_port, tks_hostname, tks_agent_port, token_db_hostname, token_db_port, token_db_suffix, token_db_passwd;
+ private String cs_server_root, cs_tps_root, tps_hostname, tps_fqdn,
+ tps_instanceid, tps_ee_port, tps_agent_port, tps_auth_ldap_host,
+ tps_auth_ldap_port, tps_auth_ldap_suffix, ca_hostname, ca_ee_port,
+ tks_hostname, tks_agent_port, token_db_hostname, token_db_port,
+ token_db_suffix, token_db_passwd;
- public CMSInstance(String h, String p, String AdDN, String pwd, String domain, String sroot, String insID, String mname, String sieURL) {
+ public CMSInstance(String h, String p, String AdDN, String pwd,
+ String domain, String sroot, String insID, String mname,
+ String sieURL) {
host = h;
port = p;
@@ -57,24 +66,11 @@ public class CMSInstance {
sieurl = sieURL;
}
- public CMSInstance(String croot,
- String troot,
- String th,
- String tfqdn,
- String tid,
- String tep,
- String tagp,
- String tldaphost,
- String tldapport,
- String tldapsuffix,
- String ch,
- String ceep,
- String tkh,
- String tkagp,
- String toh,
- String toagp,
- String tosuffix,
- String topasswd) {
+ public CMSInstance(String croot, String troot, String th, String tfqdn,
+ String tid, String tep, String tagp, String tldaphost,
+ String tldapport, String tldapsuffix, String ch, String ceep,
+ String tkh, String tkagp, String toh, String toagp,
+ String tosuffix, String topasswd) {
cs_server_root = croot;
cs_tps_root = troot;
@@ -101,9 +97,9 @@ 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");
+
+ FileOutputStream out = new FileOutputStream(cs_server_root
+ + "/tps_auto_config.cfg");
BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
@@ -150,27 +146,28 @@ public class CMSInstance {
try {
Process p = null;
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" };
+ // 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" };
System.out.println(se);
- p = r.exec(se);
+ p = r.exec(se);
p.waitFor();
String line;
if (p.exitValue() == 0) {
- BufferedReader br = new BufferedReader(
- new InputStreamReader(p.getInputStream()));
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ p.getInputStream()));
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} else {
- BufferedReader br = new BufferedReader(
- new InputStreamReader(p.getErrorStream()));
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ p.getErrorStream()));
while ((line = br.readLine()) != null) {
System.out.println(line);
@@ -192,7 +189,7 @@ public class CMSInstance {
+ startURL;
System.out.println(myStringUrl);
-
+
String query = "serverRoot=" + URLEncoder.encode(serverRoot);
query += "&instanceID=" + URLEncoder.encode(instanceID);
@@ -205,7 +202,7 @@ public class CMSInstance {
PostQuery sm = new PostQuery(myStringUrl, AdminDN, AdminDNPW, query);
return (sm.Send());
-
+
}
public boolean RemoveInstance() {
@@ -214,11 +211,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 +230,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,50 +247,51 @@ 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.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.out
+ .println("Error: Server Instance could not be created");
System.exit(0);
}
break;
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);
}
@@ -306,5 +304,5 @@ public class CMSInstance {
} // end of switch
}// end of function main
-} // end of class
+} // end of class
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 51dbd2127..62d8b185f 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,12 @@ 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.
+ * 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.
*/
-
public class CMSLDAP {
private String HOST, DN, BASEDN, PASSWORD;
@@ -47,7 +45,8 @@ public class CMSLDAP {
private LDAPConnection conn = new LDAPConnection();
- public CMSLDAP() {}
+ public CMSLDAP() {
+ }
/**
* Constructor. Takes parametes ldaphost, ldapport
@@ -58,7 +57,8 @@ public class CMSLDAP {
}
/**
- * Cosntructor. Takes parameters ldaphost,ldapport,ldapbinddn, ldapbindnpassword.
+ * Cosntructor. Takes parameters ldaphost,ldapport,ldapbinddn,
+ * ldapbindnpassword.
*/
public CMSLDAP(String h, String p, String dn, String pwd) {
HOST = h;
@@ -68,7 +68,7 @@ public class CMSLDAP {
}
/**
- * Connect to ldap server
+ * Connect to ldap server
*/
public boolean connect() {
@@ -110,12 +110,13 @@ public class CMSLDAP {
}
/**
- * Search for certificaterevocationList attribute. Takes basedn and filter as parameters
- */
+ * 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);
@@ -127,8 +128,8 @@ public class CMSLDAP {
LDAPEntry entry = (LDAPEntry) results.nextElement();
System.out.println(entry.getDN());
- LDAPAttribute anAttr = entry.getAttribute(
- "certificateRevocationList;binary");
+ LDAPAttribute anAttr = entry
+ .getAttribute("certificateRevocationList;binary");
if (anAttr == null) {
System.out.println("Attribute not found ");
@@ -146,11 +147,10 @@ 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);
@@ -177,18 +177,17 @@ public class CMSLDAP {
}
/**
- * Adds a user to direcrtory server . Takes parameters basedn, cn,sn,uid and passwd
+ * Adds a user to direcrtory server . Takes parameters basedn, cn,sn,uid and
+ * passwd
*/
- public boolean userAdd(String basedn, String cn, String sn, String uid, String pwd) {
+ public boolean userAdd(String basedn, String cn, String sn, String uid,
+ String pwd) {
try {
LDAPAttributeSet attrSet = new LDAPAttributeSet();
- attrSet.add(
- new LDAPAttribute("objectclass",
- new String[] {
- "top", "person", "organizationalPerson",
- "inetorgperson"}));
+ attrSet.add(new LDAPAttribute("objectclass", 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));
@@ -216,8 +215,8 @@ public class CMSLDAP {
ByteArrayInputStream s = new ByteArrayInputStream(cpack);
System.out.println("Building certificate :" + cpack);
- java.security.cert.X509Certificate the_cert = (
- java.security.cert.X509Certificate) cf.generateCertificate(s);
+ java.security.cert.X509Certificate the_cert = (java.security.cert.X509Certificate) cf
+ .generateCertificate(s);
return the_cert;
} catch (Exception e) {
@@ -236,7 +235,7 @@ public class CMSLDAP {
val += ',';
i++;
continue;
- } else {
+ } else {
val += s.charAt(i);
}
}
@@ -244,8 +243,8 @@ public class CMSLDAP {
}
/**
- * Returns the SerialNumber;issuerDN;SubjectDN string.
- * Takes certificate as parameter
+ * Returns the SerialNumber;issuerDN;SubjectDN string. Takes certificate as
+ * parameter
*/
public String getCertificateString(X509Certificate cert) {
@@ -269,19 +268,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) {
+ 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"}));
+ attrSet.add(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));
@@ -290,8 +289,8 @@ public class CMSLDAP {
attrSet.add(new LDAPAttribute("usertype", "sub"));
attrSet.add(new LDAPAttribute("userstate", "1"));
- attrSet.add(
- new LDAPAttribute("description", getCertificateString(cert)));
+ attrSet.add(new LDAPAttribute("description",
+ getCertificateString(cert)));
LDAPAttribute attrCertBin = new LDAPAttribute("usercertificate");
attrCertBin.addValue(cert.getEncoded());
@@ -312,19 +311,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, X509Certificate cert) {
+ public boolean CMSuserAdd(String cn, String sn, String uid, String pwd,
+ X509Certificate cert) {
try {
LDAPAttributeSet attrSet = new LDAPAttributeSet();
- attrSet.add(
- new LDAPAttribute("objectclass",
- new String[] {
- "top", "person", "organizationalPerson",
- "inetorgperson", "cmsuser"}));
+ attrSet.add(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));
@@ -333,8 +332,8 @@ public class CMSLDAP {
attrSet.add(new LDAPAttribute("usertype", "sub"));
attrSet.add(new LDAPAttribute("userstate", "1"));
- attrSet.add(
- new LDAPAttribute("description", getCertificateString(cert)));
+ attrSet.add(new LDAPAttribute("description",
+ getCertificateString(cert)));
LDAPAttribute attrCertBin = new LDAPAttribute("usercertificate");
@@ -356,14 +355,14 @@ 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) {
try {
LDAPAttributeSet attrSet = new LDAPAttributeSet();
- LDAPAttribute um = new LDAPAttribute("uniquemember",
- "uid=" + uid + ",ou=People,o=NetscapeCertificateServer");
+ LDAPAttribute um = new LDAPAttribute("uniquemember", "uid=" + uid
+ + ",ou=People,o=NetscapeCertificateServer");
attrSet.add(um);
LDAPModification gr = new LDAPModification(LDAPModification.ADD, um);
@@ -381,7 +380,8 @@ 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) {
@@ -405,11 +405,11 @@ public class CMSLDAP {
}
LDAPAttributeSet attrSet = new LDAPAttributeSet();
- LDAPAttribute um = new LDAPAttribute("uniquemember",
- "uid=" + uid + ",ou=People,o=NetscapeCertificateServer");
+ LDAPAttribute um = new LDAPAttribute("uniquemember", "uid=" + uid
+ + ",ou=People,o=NetscapeCertificateServer");
- System.out.println(
- "uid=" + uid + ",ou=People,o=NetscapeCertificateServer");
+ System.out.println("uid=" + uid
+ + ",ou=People,o=NetscapeCertificateServer");
attrSet.add(um);
LDAPModification gr = new LDAPModification(LDAPModification.ADD, um);
@@ -426,7 +426,7 @@ public class CMSLDAP {
}
/**
- * Will trun of SSL in LDAP server
+ * Will trun of SSL in LDAP server
**/
public boolean TurnOffSSL() {
@@ -437,10 +437,10 @@ public class CMSLDAP {
LDAPAttribute ssl3ciphers = new LDAPAttribute("nsssl3ciphers", "");
LDAPAttribute kfile = new LDAPAttribute("nskeyfile", "alias/");
LDAPAttribute cfile = new LDAPAttribute("nscertfile", "alias/");
- LDAPAttribute cauth = new LDAPAttribute("nssslclientauth", "allowed");
-
- // conn.delete("cn=RSA,cn=encryption,cn=config");
+ LDAPAttribute cauth = new LDAPAttribute("nssslclientauth",
+ "allowed");
+ // conn.delete("cn=RSA,cn=encryption,cn=config");
mods.add(LDAPModification.REPLACE, ssl3);
mods.add(LDAPModification.DELETE, ssl3ciphers);
@@ -473,9 +473,10 @@ public class CMSLDAP {
}
/**
- * Will Turn ON SSL in LDAP server . Takes certPrefix, certificatenickanme and sslport as parameters.
+ * 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";
@@ -483,8 +484,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);
@@ -492,17 +493,18 @@ 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");
LDAPAttribute ssl3ciphers = new LDAPAttribute("nsssl3ciphers",
CIPHERS);
- LDAPAttribute kfile = new LDAPAttribute("nskeyfile",
- "alias/" + certPrefix + "-key3.db");
- LDAPAttribute cfile = new LDAPAttribute("nscertfile",
- "alias/" + certPrefix + "-cert7.db");
- LDAPAttribute cauth = new LDAPAttribute("nssslclientauth", "allowed");
+ LDAPAttribute kfile = new LDAPAttribute("nskeyfile", "alias/"
+ + certPrefix + "-key3.db");
+ LDAPAttribute cfile = new LDAPAttribute("nscertfile", "alias/"
+ + certPrefix + "-cert7.db");
+ LDAPAttribute cauth = new LDAPAttribute("nssslclientauth",
+ "allowed");
mods.add(LDAPModification.REPLACE, ssl3);
mods.add(LDAPModification.REPLACE, ssl3ciphers);
@@ -511,14 +513,14 @@ 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);
i--;
}
- // conn.delete("cn=RSA,cn=encryption,cn=config");
+ // conn.delete("cn=RSA,cn=encryption,cn=config");
try {
LDAPSearchResults results = conn.search(
"cn=RSA,cn=encryption,cn=config", searchScope, null,
@@ -541,16 +543,15 @@ public class CMSLDAP {
} catch (Exception e1) {
LDAPAttributeSet attrSet = new LDAPAttributeSet();
- attrSet.add(
- new LDAPAttribute("objectclass",
- new String[] { "top", "nsEncryptionModule"}));
+ attrSet.add(new LDAPAttribute("objectclass", new String[] {
+ "top", "nsEncryptionModule" }));
attrSet.add(new LDAPAttribute("cn", "RSA"));
- attrSet.add(
- new LDAPAttribute("nsssltoken", "internal (software)"));
+ attrSet.add(new LDAPAttribute("nsssltoken",
+ "internal (software)"));
attrSet.add(new LDAPAttribute("nssslactivation", "on"));
attrSet.add(new LDAPAttribute("nssslpersonalityssl", certName));
- LDAPEntry entry = new LDAPEntry("cn=RSA,cn=encryption,cn=config",
- attrSet);
+ LDAPEntry entry = new LDAPEntry(
+ "cn=RSA,cn=encryption,cn=config", attrSet);
conn.add(entry);
}
@@ -582,13 +583,13 @@ public class CMSLDAP {
System.out.println(HOST + PORT + DN + PASSWORD + BASEDN);
CMSLDAP caIdb = new CMSLDAP(HOST, PORT, DN, PASSWORD);
- /* FileInputStream fis = new FileInputStream("t1");
- DataInputStream dis = new DataInputStream(fis);
-
- byte[] bytes = new byte[dis.available()];
- dis.readFully(bytes);
-
- // bytes=s.getBytes();
+ /*
+ * FileInputStream fis = new FileInputStream("t1"); DataInputStream
+ * dis = new DataInputStream(fis);
+ *
+ * byte[] bytes = new byte[dis.available()]; dis.readFully(bytes);
+ *
+ * // bytes=s.getBytes();
*/
if (!caIdb.connect()) {
@@ -601,17 +602,22 @@ 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))
+
+ // if (!caIdb.CMSuserAdd("ra-trust"
+ // ,"ra-trust","ra-trust","netscape",bytes))
// {System.out.println("Trusted MAnager user Could not be add ");}
// if(!caIdb.addCMSUserToTMGroup("ra-trust"))
- // {System.out.println("CMS user Could not be added to Trusted manager group "); }
+ // {System.out.println("CMS user Could not be added to Trusted manager group ");
+ // }
// if(!caIdb.addCMSUserToAgentGroup("ra","ra-agent"))
- // {System.out.println("CMS user Could not be added to Trusted manager group "); }
- /* if(!caIdb.userAdd(BASEDN,"raeetest1","raeetest1","raeetest1","netscape"))
- {System.out.println("CMS user Could not be added to Trusted manager group "); }
+ // {System.out.println("CMS user Could not be added to Trusted manager group ");
+ // }
+ /*
+ * if(!caIdb.userAdd(BASEDN,"raeetest1","raeetest1","raeetest1",
+ * "netscape")) {System.out.println(
+ * "CMS user Could not be added to Trusted manager group "); }
*/
} catch (Exception e) {
@@ -620,4 +626,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 bae3e4202..90e3aef79 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,44 @@ 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.
+ * 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
+ * <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.
+ * <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
+ * @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
* @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
@@ -86,9 +86,9 @@ class CMSProperties extends Hashtable<String,String> {
private static final long serialVersionUID = 4112578634029874840L;
/**
- * A property list that contains default values for any keys not
- * found in this property list.
- *
+ * A property list that contains default values for any keys not found in
+ * this property list.
+ *
* @serial
*/
protected CMSProperties defaults;
@@ -102,22 +102,22 @@ 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;
}
/**
- * 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.
- *
+ * 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);
@@ -132,83 +132,91 @@ class CMSProperties extends Hashtable<String,String> {
private static final String whiteSpaceChars = " \t\r\n\f";
/**
- * 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.
+ * 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).
+ * 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.
+ * 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>:
* <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.
+ * 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 {
- BufferedReader in = new BufferedReader(
- new InputStreamReader(inStream, "8859_1"));
+ BufferedReader in = new BufferedReader(new InputStreamReader(inStream,
+ "8859_1"));
while (true) {
// Get next line
@@ -229,14 +237,14 @@ class CMSProperties extends Hashtable<String,String> {
if (nextLine == null) {
nextLine = new String("");
}
- String loppedLine = line.substring(0, line.length() - 1);
+ String loppedLine = line
+ .substring(0, line.length() - 1);
// Advance beyond whitespace on new line
int startIndex = 0;
for (startIndex = 0; startIndex < nextLine.length(); startIndex++) {
- if (whiteSpaceChars.indexOf(
- nextLine.charAt(startIndex))
- == -1) {
+ if (whiteSpaceChars.indexOf(nextLine
+ .charAt(startIndex)) == -1) {
break;
}
}
@@ -277,33 +285,29 @@ 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;
}
}
// Skip over one non whitespace key value separators if any
if (valueIndex < len) {
- if (strictKeyValueSeparators.indexOf(
- line.charAt(valueIndex))
- != -1) {
+ if (strictKeyValueSeparators.indexOf(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++;
}
String key = line.substring(keyStart, separatorIndex);
- String value = (separatorIndex < len)
- ? line.substring(valueIndex, len)
- : "";
+ String value = (separatorIndex < len) ? line.substring(
+ valueIndex, len) : "";
// Convert then store key and value
key = loadConvert(key);
@@ -315,8 +319,8 @@ class CMSProperties extends Hashtable<String,String> {
}
/*
- * Returns true if the given line is a line that must
- * be appended to the next line
+ * Returns true if the given line is a line that must be appended to the
+ * next line
*/
private boolean continueLine(String line) {
int slashCount = 0;
@@ -329,8 +333,8 @@ class CMSProperties extends Hashtable<String,String> {
}
/*
- * Converts encoded &#92;uxxxx to unicode chars
- * and changes special saved chars to their original forms
+ * Converts encoded &#92;uxxxx to unicode chars and changes special saved
+ * chars to their original forms
*/
private String loadConvert(String theString) {
char aChar;
@@ -405,9 +409,8 @@ class CMSProperties extends Hashtable<String,String> {
}
/*
- * Converts unicodes to encoded &#92;uxxxx
- * and writes out any of the characters in specialSaveChars
- * with a preceding slash
+ * Converts unicodes to encoded &#92;uxxxx and writes out any of the
+ * characters in specialSaveChars with a preceding slash
*/
private String saveConvert(String theString, boolean escapeSpace) {
int len = theString.length();
@@ -418,7 +421,7 @@ class CMSProperties extends Hashtable<String,String> {
switch (aChar) {
case ' ':
- if (x == 0 || escapeSpace) {
+ if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
@@ -470,53 +473,56 @@ class CMSProperties extends Hashtable<String,String> {
}
/**
- * Calls the <code>store(OutputStream out, String header)</code> method
- * and suppresses IOExceptions that were thrown.
- *
+ * 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.
- * The stream is written using the ISO 8859-1 character encoding.
+ * <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
+ * 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.
+ * <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>=</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
@@ -524,18 +530,19 @@ class CMSProperties extends Hashtable<String,String> {
* <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
+ * 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>.
+ *
+ * @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,12 +551,13 @@ 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);
- /* No need to escape embedded and trailing spaces for value, hence
+ /*
+ * No need to escape embedded and trailing spaces for value, hence
* pass false to flag.
*/
val = saveConvert(val, false);
@@ -568,19 +576,18 @@ 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
* <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
+ *
+ * @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)
- : sval;
+ return ((sval == null) && (defaults != null)) ? defaults
+ .getProperty(key) : sval;
}
/**
@@ -588,13 +595,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 +612,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>();
@@ -619,10 +626,10 @@ 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.
+ * Prints this property list out to the specified output stream. This method
+ * is useful for debugging.
+ *
+ * @param out an output stream.
*/
public void list(PrintStream out) {
out.println("-- listing properties --");
@@ -630,8 +637,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) + "...";
@@ -641,13 +648,13 @@ 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
+ * Prints this property list out to the specified output stream. This method
+ * is useful for debugging.
+ *
+ * @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 +666,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 +678,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 +686,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,15 +694,14 @@ 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)];
}
/** 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'
- };
+ private static final char[] hexDigit = { '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 593de3838..3925dc102 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,8 @@ 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
+ * CS Test framework . This class starts and stops CS server from command line
*/
public class CMSTask {
@@ -38,8 +37,8 @@ public class CMSTask {
private Process p = null;
/**
- * Constructor . Takes CMS server root as parameter
- * for example (/export/qa/cert-jupiter2)
+ * Constructor . Takes CMS server root as parameter for example
+ * (/export/qa/cert-jupiter2)
**/
public CMSTask() {// do nothing
@@ -63,7 +62,7 @@ public class CMSTask {
try {
while ((s = br.readLine()) != null) {
- if (s.indexOf("started") > 0) {
+ if (s.indexOf("started") > 0) {
return true;
}
// do something
@@ -87,8 +86,8 @@ public class CMSTask {
System.out.println("Stopping Certificate System:");
p = r.exec(serverRoot + "/stop-cert");
- BufferedReader br = new BufferedReader(
- new InputStreamReader(p.getInputStream()));
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
@@ -111,8 +110,8 @@ public class CMSTask {
Runtime r = Runtime.getRuntime();
p = r.exec(serverRoot + "/restart-cert");
- BufferedReader br = new BufferedReader(
- new InputStreamReader(p.getInputStream()));
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
@@ -175,7 +174,7 @@ public class CMSTask {
// set variables
serverRoot = x_instance_root.value;
operation = x_operation.value;
-
+
boolean st = prof.task();
if (!st) {
@@ -186,5 +185,5 @@ public class CMSTask {
} // end of function main
-} // end of class
+} // end of class
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 c636b0a19..9599eb6dd 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 46bd96640..4376a1fa2 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.
+ * 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,20 @@ public class ComCrypto {
private String certprefix = null;
- public ComCrypto() {}
- ;
+ public ComCrypto() {
+ };
/**
- * Constructor . Takes the parameter certificatedbdirectory , passwordfor cert database, certificatenickname,keysize, keytype(RSA/DSA)
+ * 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;
@@ -119,7 +119,7 @@ public class ComCrypto {
keytype = kt;
}
- // Set and Get functions
+ // Set and Get functions
public void setCertDir(String cd) {
cdir = cd;
@@ -158,10 +158,9 @@ public class ComCrypto {
}
/*
- * setTransportCert() should only be called when the calling profile
- * needs to do key archivals with the DRM and make sure the function
- * generateCRMFtransport() is called for the CRMF request generation
- * part.
+ * setTransportCert() should only be called when the calling profile needs
+ * to do key archivals with the DRM and make sure the function
+ * generateCRMFtransport() is called for the CRMF request generation part.
*/
public void setTransportCert(String tcert) {
transportcert = tcert;
@@ -176,7 +175,8 @@ public class ComCrypto {
}
/**
- * Parses the Certificate and returns SubjectDN . Takes certificate as parameter
+ * Parses the Certificate and returns SubjectDN . Takes certificate as
+ * parameter
*/
public String getCertificateString(X509Certificate cert) {
@@ -185,15 +185,14 @@ public class ComCrypto {
}
// note that it did not represent a certificate fully
- return cert.getVersion() + ";" + cert.getSerialNumber().toString() + ";"
- + cert.getIssuerDN() + ";" + cert.getSubjectDN();
+ return cert.getVersion() + ";" + cert.getSerialNumber().toString()
+ + ";" + cert.getIssuerDN() + ";" + cert.getSubjectDN();
}
/**
- * Finds and returns Certificate . Takes certificatenickname as parameter.
+ * Finds and returns Certificate . Takes certificatenickname as parameter.
*/
-
public X509Certificate findCert(String certname) {
try {
@@ -209,17 +208,18 @@ public class ComCrypto {
}
/**
- * Imports a certificate to Certificate Database. Takes certificate and nickname as parameters.
+ * Imports a certificate to Certificate Database. Takes certificate and
+ * nickname as parameters.
*/
-
public boolean importCert(X509Certificate xcert, String nickname) {
try {
- System.out.println(
- "importCert x509 : importing with nickname: " + nickname);
+ System.out.println("importCert x509 : importing with nickname: "
+ + nickname);
- InternalCertificate cert2 = manager.importCertToPerm(xcert, nickname);
+ InternalCertificate cert2 = manager.importCertToPerm(xcert,
+ nickname);
cert2.setSSLTrust(2);
return true;
@@ -232,10 +232,10 @@ public class ComCrypto {
}
/**
- * Imports a certificate to Certificate Database. Takes certificate and nickname as parameters.
+ * 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 +243,7 @@ public class ComCrypto {
String tmp = normalize(cpack);
- if (DBlogin) {
+ if (DBlogin) {
System.out.println("Already logged into to DB");
}
@@ -251,20 +251,22 @@ public class ComCrypto {
System.out.println("Manager object is null");
}
- X509Certificate cert = manager.importCertPackage(tmp.getBytes(), cn);
+ X509Certificate cert = manager
+ .importCertPackage(tmp.getBytes(), cn);
return true;
} catch (Exception e) {
- System.out.println(
- "ERROR:exception importing cert " + e.getMessage());
+ System.out.println("ERROR:exception importing cert "
+ + e.getMessage());
e.printStackTrace();
return false;
}
}
- /* imports CA certificate
+ /*
+ * imports CA certificate
*/
public boolean importCACert(String cpack) {
@@ -272,10 +274,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");
}
@@ -285,18 +287,18 @@ public class ComCrypto {
return true;
} catch (Exception e) {
- System.out.println(
- "ERROR:exception importing cert " + e.getMessage());
+ System.out.println("ERROR:exception importing cert "
+ + e.getMessage());
return false;
}
}
/**
- * Normalizes a given certificate string . Removes the extra \\ in the certificate returned by CMS server.
+ * Normalizes a given certificate string . Removes the extra \\ in the
+ * certificate returned by CMS server.
*/
-
public String normalize(String s) {
String val = "";
@@ -318,10 +320,10 @@ public class ComCrypto {
}
/**
- * Normalizes a given certificate string . Removes the extra \\ in the certificate returned by CMS server.
+ * Normalizes a given certificate string . Removes the extra \\ in the
+ * certificate returned by CMS server.
*/
-
public String normalizeForLDAP(String s) {
String val = "";
@@ -346,7 +348,6 @@ public class ComCrypto {
* Convert to pkcs7 format
*/
-
public String pkcs7Convertcert(String s) {
String val = "";
@@ -396,14 +397,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 +439,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,35 +507,35 @@ 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) {
- // it is ok if it is already initialized
+ } catch (Exception e) {
+ // it is ok if it is already initialized
System.out.println("INITIALIZATION ERROR: " + e.toString());
System.out.println("cdir = " + cdir);
}
- // Step 2 log into database
+ // Step 2 log into database
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) {
@@ -546,9 +546,10 @@ public class ComCrypto {
}
}
- // Generating CRMF request
+ // 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 +557,7 @@ public class ComCrypto {
kg.initialize(key_len);
// 1st key pair
- pair = kg.genKeyPair();
+ pair = kg.genKeyPair();
// create CRMF
CertTemplate certTemplate = new CertTemplate();
@@ -565,53 +566,57 @@ 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);
}
- certTemplate.setPublicKey(new SubjectPublicKeyInfo(pair.getPublic()));
+ certTemplate
+ .setPublicKey(new SubjectPublicKeyInfo(pair.getPublic()));
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)));
+ ProofOfPossession pop = ProofOfPossession
+ .createKeyEncipherment(POPOPrivKey
+ .createThisMessage(new BIT_STRING(popdata, 3)));
CertReqMsg crmfMsg = new CertReqMsg(certReq, pop, null);
SEQUENCE s1 = new SEQUENCE();
-
- // 1st : Encryption key
+
+ // 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();
+ // BASE64Encoder encoder = new BASE64Encoder();
// String Req1 = encoder.encodeBuffer(encoded);
String Req1 = OSUtil.BtoA(encoded);
- // Set CRMF_REQUEST variable
+ // Set CRMF_REQUEST variable
CRMF_REQUEST = Req1;
System.out.println("CRMF_REQUEST = " + CRMF_REQUEST);
- } catch (Exception e) {
+ } catch (Exception e) {
System.out.println("ERROR: " + e.toString());
e.printStackTrace();
return null;
@@ -621,10 +626,10 @@ public class ComCrypto {
}
/*
- * This function is used to Generated CRMF requests wrapped with the
- * transport cert so that we can do key archival with the drm.
- * This function expects transportcert variable to be set in this class.
- * Use setTransportCert() to do the same.
+ * This function is used to Generated CRMF requests wrapped with the
+ * transport cert so that we can do key archival with the drm. This function
+ * expects transportcert variable to be set in this class. Use
+ * setTransportCert() to do the same.
*/
public String generateCRMFtransport() {
@@ -636,30 +641,30 @@ public class ComCrypto {
try {
// Step 1. initialize crypto Manager
- try {
+ try {
CryptoManager.initialize(cdir);
- } catch (Exception e) {
- // it is ok if it is already initialized
+ } catch (Exception e) {
+ // it is ok if it is already initialized
System.out.println("INITIALIZATION ERROR: " + e.toString());
System.out.println("cdir = " + cdir);
}
- // Step 2 log into database
+ // Step 2 log into database
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,9 +674,10 @@ public class ComCrypto {
token.initPassword(password, password);
}
}
-
+
// Key Pair Generation
- KeyPairGenerator kg = token.getKeyPairGenerator(KeyPairAlgorithm.RSA);
+ KeyPairGenerator kg = token
+ .getKeyPairGenerator(KeyPairAlgorithm.RSA);
Integer x = new Integer(keysize);
int key_len = x.intValue();
@@ -686,19 +692,19 @@ 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();
// wrap private key using session
- KeyWrapper wrapper1 = token.getKeyWrapper(
- KeyWrapAlgorithm.DES3_CBC_PAD);
+ KeyWrapper wrapper1 = token
+ .getKeyWrapper(KeyWrapAlgorithm.DES3_CBC_PAD);
wrapper1.initWrap(sk, new IVParameterSpec(iv));
- byte key_data[] = wrapper1.wrap((
- org.mozilla.jss.crypto.PrivateKey) pair.getPrivate());
+ byte key_data[] = wrapper1
+ .wrap((org.mozilla.jss.crypto.PrivateKey) pair.getPrivate());
// wrap session using transport
KeyWrapper rsaWrap = token.getKeyWrapper(KeyWrapAlgorithm.RSA);
@@ -714,12 +720,14 @@ 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);
}
- certTemplate.setPublicKey(new SubjectPublicKeyInfo(pair.getPublic()));
+ certTemplate
+ .setPublicKey(new SubjectPublicKeyInfo(pair.getPublic()));
// set extension
AlgorithmIdentifier algS = new AlgorithmIdentifier(
@@ -735,38 +743,40 @@ public class ComCrypto {
SEQUENCE seq = new SEQUENCE();
- seq.addElement(
- new AVA(new OBJECT_IDENTIFIER("1.3.6.1.5.5.7.5.1.4"), opt));
+ seq.addElement(new AVA(
+ new OBJECT_IDENTIFIER("1.3.6.1.5.5.7.5.1.4"), opt));
CertRequest certReq = new CertRequest(new INTEGER(1), certTemplate,
seq);
// Adding proof of possesion data
- byte popdata[] = { 0x0, 0x3, 0x0};
- ProofOfPossession pop = ProofOfPossession.createKeyEncipherment(
- POPOPrivKey.createThisMessage(new BIT_STRING(popdata, 3)));
+ byte popdata[] = { 0x0, 0x3, 0x0 };
+ ProofOfPossession pop = ProofOfPossession
+ .createKeyEncipherment(POPOPrivKey
+ .createThisMessage(new BIT_STRING(popdata, 3)));
CertReqMsg crmfMsg = new CertReqMsg(certReq, pop, null);
SEQUENCE s1 = new SEQUENCE();
- // 1st : Encryption key
+ // 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);
-
+
// BASE64Encoder encoder = new BASE64Encoder();
// CRMF_REQUEST = encoder.encodeBuffer(encoded);
@@ -781,9 +791,9 @@ public class ComCrypto {
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
}
-
+
return CRMF_REQUEST;
}
-} // end of class
+} // end of class
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 6be4daf49..146a4d937 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,10 +36,9 @@ 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.
+ * CMS Test framework . Submits a requests to agent port with sslclient
+ * authentication.
*/
public class Con2Agent implements SSLClientCertificateSelectionCallback,
@@ -51,18 +51,20 @@ 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;
@@ -71,7 +73,8 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
certdir = cdir;
}
- public boolean approve(X509Certificate x509, SSLCertificateApprovalCallback.ValidityStatus status) {
+ public boolean approve(X509Certificate x509,
+ SSLCertificateApprovalCallback.ValidityStatus status) {
return true;
}
@@ -95,10 +98,10 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
}
- // Get and Set methods
+ // Get and Set methods
/*
- * Get the page returned by the server
+ * Get the page returned by the server
*/
public StringBuffer getPage() {
@@ -106,7 +109,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
}
/*
- * Set the query string to be submitted to the server
+ * Set the query string to be submitted to the server
*/
public void setQueryString(String qu) {
@@ -114,7 +117,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
}
/*
- *Set token password
+ * Set token password
*/
public void setTokenPassword(String pwd) {
@@ -138,7 +141,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
}
/*
- * set Agent port number
+ * set Agent port number
*/
public void setPort(int p) {
@@ -146,7 +149,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
}
/*
- * Set Agent cert nickname
+ * Set Agent cert nickname
*/
public void setCertNickName(String cname) {
@@ -154,21 +157,21 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
}
/*
- * Set action URL
+ * Set action URL
*/
public void setActionURL(String url) {
ACTIONURL = url;
}
- // Submit requests
+ // Submit requests
public boolean Send() {
boolean st = false;
try {
- if (!loginCertDB()) {
+ if (!loginCertDB()) {
return false;
}
@@ -176,7 +179,8 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
System.out.println("Con2Agent.java: host = " + host);
System.out.println("Con2Agent.java: port = " + port);
- System.out.println("Con2Agent.java: certnickname = " + certnickname);
+ System.out
+ .println("Con2Agent.java: certnickname = " + certnickname);
socket.setClientCertNickname(certnickname);
System.out.println("Connected to the socket");
@@ -184,7 +188,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");
@@ -196,8 +200,8 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
ps.println("\r");
ps.flush();
os.flush();
- BufferedReader stdin1 = new BufferedReader(
- new InputStreamReader(socket.getInputStream()));
+ BufferedReader stdin1 = new BufferedReader(new InputStreamReader(
+ socket.getInputStream()));
String line;
while ((line = stdin1.readLine()) != null) {
@@ -205,8 +209,9 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
System.out.println(line);
}
- // Send Connection: close to let the server close the connection.
- // Else the socket on the server side continues to remain in TIME_WAIT state
+ // Send Connection: close to let the server close the connection.
+ // Else the socket on the server side continues to remain in
+ // TIME_WAIT state
ps.println("Connection: close");
ps.flush();
@@ -239,12 +244,13 @@ 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();
+ CryptoToken token = (PK11Token) manager
+ .getInternalKeyStorageToken();
- if (token.isLoggedIn()) {
+ if (token.isLoggedIn()) {
System.out.println("Con2Agent: Logged in incorrect");
}
@@ -256,12 +262,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 +282,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
e.printStackTrace();
return false;
}
-
+
}
public boolean Send_withGET() {
@@ -285,7 +291,7 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
try {
- if (!loginCertDB()) {
+ if (!loginCertDB()) {
return false;
}
@@ -297,7 +303,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);
@@ -306,8 +312,8 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
ps.println("\r");
ps.flush();
os.flush();
- BufferedReader stdin2 = new BufferedReader(
- new InputStreamReader(socket.getInputStream()));
+ BufferedReader stdin2 = new BufferedReader(new InputStreamReader(
+ socket.getInputStream()));
String line;
while ((line = stdin2.readLine()) != null) {
@@ -326,4 +332,4 @@ public class Con2Agent implements SSLClientCertificateSelectionCallback,
}
-} // end of class
+} // end of class
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 59820fe7a..ab52d7b49 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,13 @@ 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 +51,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 +62,7 @@ public class DirEnroll extends TestClient {
/**
* Constructor. Takes hostname , EESSLportnumber as parameter
* <p>
+ *
* @param hostname
* @param portnumber
*/
@@ -73,8 +73,11 @@ 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,8 +85,9 @@ 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) {
+ public DirEnroll(String hs, String p, String uid, String pw,
+ String certdir, String certtokenpwd, String nickname, String ksz,
+ String kt) {
host = hs;
ports = p;
@@ -96,18 +100,18 @@ public class DirEnroll extends TestClient {
keytype = "RSA";
}
- // Set and Get functions
+ // 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,26 +119,27 @@ 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() {
- System.out.println(" In pkcs10 Keysize , key type " + keysize + keytype);
+ System.out.println(" In pkcs10 Keysize , key type " + keysize
+ + keytype);
cCrypt.setCertDir(cdir);
cCrypt.setCertnickname("cn=test");
cCrypt.setKeySize(keysize);
cCrypt.setKeyType(keytype);
cCrypt.setTokenPWD(tokenpwd);
-
+
cCrypt.setDebug(debug);
cCrypt.setGenerateRequest(true);
if (!cCrypt.generateRequest()) {
@@ -147,7 +152,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 +162,11 @@ 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() {
@@ -169,8 +175,8 @@ public class DirEnroll extends TestClient {
try {
getProperties(propfileName);
} catch (Exception e) {
- System.out.println(
- "exception reading Properties File " + e.getMessage());
+ System.out.println("exception reading Properties File "
+ + e.getMessage());
return false;
}
@@ -212,7 +218,7 @@ public class DirEnroll extends TestClient {
return true;
}
- // Private functions
+ // Private functions
private boolean importCert(String certpack) {
@@ -226,8 +232,8 @@ public class DirEnroll extends TestClient {
}
if (debug) {
- System.out.println(
- "importing cert" + certpack + "certnick" + certnickname);
+ System.out.println("importing cert" + certpack + "certnick"
+ + certnickname);
}
cCrypt.importCert(certpack, certnickname);
@@ -289,8 +295,8 @@ public class DirEnroll extends TestClient {
ps.println("\r");
ps.flush();
os.flush();
- BufferedReader stdin = new BufferedReader(
- new InputStreamReader(socket.getInputStream()));
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(
+ socket.getInputStream()));
if (debug) {
System.out.println("Step 4: Received the page");
@@ -310,7 +316,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")) {
@@ -319,7 +325,8 @@ public class DirEnroll extends TestClient {
int n = strbase.length() + 1;
baseCert = baseCert.substring(n);
- String tmp = baseCert.substring(0, baseCert.length() - 2);
+ String tmp = baseCert.substring(0,
+ baseCert.length() - 2);
if (importCert(tmp)) {
impStatus = true;
@@ -352,13 +359,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 +383,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 +419,7 @@ public class DirEnroll extends TestClient {
queryStrBuf.append("&l=");
queryStrBuf.append(URLEncoder.encode(L));
- queryStrBuf.append("&email=true");
+ queryStrBuf.append("&email=true");
}
@@ -423,7 +430,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,37 +439,36 @@ 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) {
- System.out.println(
- t.getAuthenticator() + " based enrollment successfull. ");
+ if (st) {
+ System.out.println(t.getAuthenticator()
+ + " based enrollment successfull. ");
System.exit(1);
} else {
- System.out.println(
- t.getAuthenticator()
- + " based enrollment was not successful."
- + "Error: " + t.getErrorDetail());
+ System.out.println(t.getAuthenticator()
+ + " based enrollment was not successful." + "Error: "
+ + t.getErrorDetail());
System.exit(0);
}
}// end of function main
-} // end of class
+} // end of class
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 79be5c35b..36392fd1b 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;
@@ -53,7 +53,8 @@ public class ParseXML {
se.printStackTrace();
try {
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ BufferedReader br = new BufferedReader(
+ new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
@@ -77,7 +78,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 +108,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 +134,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 +165,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 87fcf5002..1e08efd38 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
@@ -29,12 +30,11 @@ import java.net.URL;
import com.netscape.osutil.OSUtil;
/**
- * CMS Test framework .
- * This class submits request to admin server after authenticating with UID and Password. You can get back the response by calling the method. getPage().
+ * CMS Test framework . 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 +45,14 @@ 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;
@@ -75,24 +79,24 @@ public class PostQuery {
}
public boolean Send() {
- // / This functions connects to the URL and POST HTTP Request .
- // It compares with NMC_STATUS and return the status.
+ // / This functions connects to the URL and POST HTTP Request .
+ // It compares with NMC_STATUS and return the status.
System.out.println(URLString);
st = false;
try {
- BufferedReader mbufferedReader = null;
+ BufferedReader mbufferedReader = null;
URL myUrl = new URL(URLString);
String userPassword = adminID + ":" + adminPWD;
System.out.println("adminid=" + adminID);
System.out.println("adminpwd=" + adminPWD);
// String encoding = new sun.misc.BASE64Encoder().encode(
- // userPassword.getBytes());
- String encoding = OSUtil.BtoA(
- userPassword.getBytes());
- HttpURLConnection URLCon = (HttpURLConnection) myUrl.openConnection();
+ // userPassword.getBytes());
+ String encoding = OSUtil.BtoA(userPassword.getBytes());
+ HttpURLConnection URLCon = (HttpURLConnection) myUrl
+ .openConnection();
URLCon.setRequestProperty("Authorization", "Basic " + encoding);
URLCon.setDoOutput(true);
@@ -103,7 +107,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,12 +116,12 @@ public class PostQuery {
os.writeBytes(postQuery);
os.flush();
os.close();
-
+
InputStream Content = (InputStream) URLCon.getInputStream();
System.out.println("Configuring Cert Instance : Return Response");
- BufferedReader in = new BufferedReader(
- new InputStreamReader(Content));
+ BufferedReader in = new BufferedReader(new InputStreamReader(
+ Content));
String line;
while ((line = in.readLine()) != null) {
@@ -127,12 +131,12 @@ public class PostQuery {
if (st) {
break;
}
- }
+ }
URLCon.disconnect();
- } // try
+ } // 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 9ddc99702..b8a476cff 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,28 +18,24 @@ 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
+ * CMS Test framework . Submits List,Approve,Reject,cancel requests to agent
+ * port
*/
-
public class Request extends TestClient {
private String validityperiod;
private String approveseqnum, type, reqType, reqState, agenttype;
private int i;
- // Program variables
+ // Program variables
private String ACTION_PROCESS_CERT_REQUEST = null;
private String ACTION_LISTREQUEST = "/queryReq";
private int reqtype = 1;
@@ -52,29 +49,33 @@ public class Request extends TestClient {
private Vector<String> seqNum = new Vector<String>();
private String AUTH_ID = null;
- // Cert Detail variables
+ // Cert Detail variables
- private String csrRequestorName, csrRequestorPhone, csrRequestorEmail, subject, subjectdn, reqStatus, certType;
- private String requestType, requestID, sslclient, clientcert, servercert, emailcert, objectsigningcert, sslcacert, objectsigningcacert, emailcacert, sigAlgo, totalRecord, validitylength, trustedManager;
+ private String csrRequestorName, csrRequestorPhone, csrRequestorEmail,
+ subject, subjectdn, reqStatus, certType;
+ private String requestType, requestID, sslclient, clientcert, servercert,
+ emailcert, objectsigningcert, sslcacert, objectsigningcacert,
+ emailcacert, sigAlgo, totalRecord, validitylength, trustedManager;
private int totalNumApproved = 0;
- // Constructors
+ // Constructors
/**
* 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 +86,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,14 +99,15 @@ 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) {
+ 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;
adminid = aid;
@@ -142,19 +145,22 @@ public class Request extends TestClient {
}
/**
- * Set Agent Cert nick name
+ * Set Agent Cert nick name
*/
public void setAgentCertName(String s) {
certnickname = s;
}
/**
- * List all pending enrollment request. Takes parameters fromRequestNumber,toRequestNumber
- * @param fromrequest number
+ * List all pending enrollment request. Takes parameters
+ * fromRequestNumber,toRequestNumber
+ *
+ * @param fromrequest number
* @param endrequestnumber.
*/
- public Vector<String> ListPendingRequests(String fromRequestNumber, String toRequestNumber) {
+ public Vector<String> ListPendingRequests(String fromRequestNumber,
+ String toRequestNumber) {
reqState = "showWaiting";
reqType = "enrollment";
approveseqnumFrom = fromRequestNumber;
@@ -164,13 +170,15 @@ public class Request extends TestClient {
}
/**
- * List all pending request. Takes parameters fromRequestNumber,toRequestNumber
- * @param fromrequest number
+ * List all pending request. Takes parameters
+ * fromRequestNumber,toRequestNumber
+ *
+ * @param fromrequest number
* @param endrequestnumber.
*/
-
- public Vector<String> ListAllRequests(String fromRequestNumber, String toRequestNumber) {
+ public Vector<String> ListAllRequests(String fromRequestNumber,
+ String toRequestNumber) {
reqState = "showAll";
reqType = "enrollment";
approveseqnumFrom = fromRequestNumber;
@@ -181,10 +189,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";
@@ -201,8 +209,10 @@ public class Request extends TestClient {
}
/**
- * Approve profile based pending enrollment request. Takes parameters RequestNumber
- * @param request number
+ * Approve profile based pending enrollment request. Takes parameters
+ * RequestNumber
+ *
+ * @param request number
*/
public int ApproveProfileRequests(String RequestNumber) {
@@ -221,23 +231,25 @@ public class Request extends TestClient {
}
- public boolean Approve_cadualcert_Profile_Request(String RequestNumber, String name) {
-
+ public boolean Approve_cadualcert_Profile_Request(String RequestNumber,
+ String name) {
+
approveseqnum = RequestNumber;
approveseqnumFrom = RequestNumber;
approveseqnumTo = RequestNumber;
cadualcert_name = name;
- // reqtype = 7 means cadualcert profile request
- // this is just a convention that we follow within this file to distinguish
+ // reqtype = 7 means cadualcert profile request
+ // this is just a convention that we follow within this file to
+ // distinguish
// bet'n the different requests
reqtype = 7;
buildquery();
- if (!Send()) {
+ if (!Send()) {
System.out.println("Error: Approving request " + approveseqnum);
return false;
}
@@ -247,11 +259,12 @@ public class Request extends TestClient {
}
/**
- * Reject profile based pending enrollment request. Takes parameters RequestNumber
- * @param request number
+ * Reject profile based pending enrollment request. Takes parameters
+ * RequestNumber
+ *
+ * @param request number
*/
-
public int RejectProfileRequests(String RequestNumber) {
approveseqnum = RequestNumber;
@@ -269,8 +282,10 @@ public class Request extends TestClient {
}
/**
- * Cancel profile based pending enrollment request. Takes parameters RequestNumber
- * @param request number
+ * Cancel profile based pending enrollment request. Takes parameters
+ * RequestNumber
+ *
+ * @param request number
*/
public int CancelProfileRequests(String RequestNumber) {
@@ -289,7 +304,7 @@ public class Request extends TestClient {
}
- // private methods
+ // private methods
private boolean RetrieveProfileCancel(StringBuffer s) {
String res = s.toString();
int ret = 0;
@@ -354,20 +369,21 @@ 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++;
- }
-
+ }
+
}
}
ret = res.indexOf("header.totalRecordCount =");
- totalRecord = res.substring(ret + "header.totalRecordCount = ".length(),
+ totalRecord = res.substring(
+ ret + "header.totalRecordCount = ".length(),
res.indexOf(";", ret));
return true;
@@ -390,26 +406,26 @@ public class Request extends TestClient {
String cmp = "header.SERVER_ATTRS[" + t + "].name=";
ret = res.indexOf(cmp);
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "requestId")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("requestId")) {
ret = res.indexOf("header.SERVER_ATTRS[" + t + "].value=");
requestID = res.substring(
ret + "header.SERVER_ATTRS[t].value=".length() + 1,
res.indexOf(";", ret) - 1);
}
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "requestStatus")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("requestStatus")) {
ret = res.indexOf("header.SERVER_ATTRS[" + t + "].value=");
reqStatus = res.substring(
ret + "header.SERVER_ATTRS[t].value=".length() + 1,
res.indexOf(";", ret) - 1);
}
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "requestType")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("requestType")) {
ret = res.indexOf("header.SERVER_ATTRS[" + t + "].value=");
- requestType = res.substring(
- ret + "header.SERVER_ATTRS[t].value=".length() + 1,
+ requestType = res.substring(ret
+ + "header.SERVER_ATTRS[t].value=".length() + 1,
res.indexOf(";", ret) - 1);
}
@@ -422,7 +438,8 @@ public class Request extends TestClient {
}
if (!st) {
- System.out.println("Error in retrieving the record " + approveseqnum);
+ System.out.println("Error in retrieving the record "
+ + approveseqnum);
return false;
}
@@ -432,39 +449,39 @@ public class Request extends TestClient {
String cmp = "header.HTTP_PARAMS[" + t + "].name=";
ret = res.indexOf(cmp);
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "csrRequestorEmail")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("csrRequestorEmail")) {
ret = res.indexOf("header.HTTP_PARAMS[" + t + "].value=");
- csrRequestorEmail = res.substring(
- ret + "header.HTTP_PARAMS[t].value=".length() + 1,
+ csrRequestorEmail = res.substring(ret
+ + "header.HTTP_PARAMS[t].value=".length() + 1,
res.indexOf(";", ret) - 1);
}
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "csrRequestorPhone")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("csrRequestorPhone")) {
ret = res.indexOf("header.HTTP_PARAMS[" + t + "].value=");
- csrRequestorPhone = res.substring(
- ret + "header.HTTP_PARAMS[t].value=".length() + 1,
+ csrRequestorPhone = res.substring(ret
+ + "header.HTTP_PARAMS[t].value=".length() + 1,
res.indexOf(";", ret) - 1);
}
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "csrRequestorName")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("csrRequestorName")) {
ret = res.indexOf("header.HTTP_PARAMS[" + t + "].value=");
- csrRequestorName = res.substring(
- ret + "header.HTTP_PARAMS[t].value=".length() + 1,
+ csrRequestorName = res.substring(ret
+ + "header.HTTP_PARAMS[t].value=".length() + 1,
res.indexOf(";", ret) - 1);
}
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "subject")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("subject")) {
ret = res.indexOf("header.HTTP_PARAMS[" + t + "].value=");
subjectdn = res.substring(
ret + "header.HTTP_PARAMS[t].value=".length() + 1,
res.indexOf(";", ret) - 1);
}
- } // end of for loop
+ } // end of for loop
- // System.out.println("Debug : Retrieving cert details");
+ // System.out.println("Debug : Retrieving cert details");
ret = res.indexOf("header.subject =");
if (ret > 0) {
@@ -481,7 +498,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(
@@ -508,8 +524,8 @@ public class Request extends TestClient {
ret = res.indexOf("header.ext_object_signing =");
if (ret > 0) {
- objectsigningcert = res.substring(
- ret + "header.ext_object_signing = ".length() + 1,
+ objectsigningcert = res.substring(ret
+ + "header.ext_object_signing = ".length() + 1,
res.indexOf(";", ret) - 1);
}
@@ -517,7 +533,8 @@ public class Request extends TestClient {
ret = res.indexOf("header.ext_ssl_ca =");
if (ret > 0) {
- sslcacert = res.substring(ret + "header.ext_ssl_ca = ".length() + 1,
+ sslcacert = res.substring(
+ ret + "header.ext_ssl_ca = ".length() + 1,
res.indexOf(";", ret) - 1);
}
@@ -526,17 +543,16 @@ public class Request extends TestClient {
if (ret > 0) {
ret = res.indexOf("header.ext_object_signing_ca=");
}
- objectsigningcacert = res.substring(
- ret + "header.ext_object_signing_ca = ".length() + 1,
+ objectsigningcacert = res.substring(ret
+ + "header.ext_object_signing_ca = ".length() + 1,
res.indexOf(";", ret) - 1);
// System.out.println("Debug : Retrieving cert details ");
ret = res.indexOf("header.ext_email_ca =");
if (ret > 0) {
- emailcacert = res.substring(
- ret + "header.ext_email_ca = ".length() + 1,
- res.indexOf(";", ret) - 1);
+ emailcacert = res.substring(ret + "header.ext_email_ca = ".length()
+ + 1, res.indexOf(";", ret) - 1);
}
// System.out.println("Debug : Retrieving cert details ");
@@ -574,7 +590,7 @@ public class Request extends TestClient {
System.out.println(res);
}
- // Find th Server_ATTRS paramteter value of reqStatus
+ // Find th Server_ATTRS paramteter value of reqStatus
int i = 1;
int ret;
@@ -583,21 +599,21 @@ public class Request extends TestClient {
String cmp = "header.SERVER_ATTRS[" + t + "].name=";
ret = res.indexOf(cmp);
- if ((res.substring(ret + cmp.length() + 1, res.indexOf(";", ret) - 1)).equals(
- "requestStatus")) {
+ if ((res.substring(ret + cmp.length() + 1,
+ res.indexOf(";", ret) - 1)).equals("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 +643,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 +661,7 @@ public class Request extends TestClient {
break;
case 3:
- st = approveRequestStatus(s);
+ st = approveRequestStatus(s);
break;
case 4:
@@ -665,7 +681,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 +701,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 +715,7 @@ public class Request extends TestClient {
Integer x = new Integer(validityperiod);
validperiod = x.intValue();
- } else {
+ } else {
validperiod = 180;
}
@@ -719,7 +735,7 @@ public class Request extends TestClient {
if (csrRequestorPhone != null) {
query += "&csrRequestorPhone=" + csrRequestorPhone;
}
-
+
if (csrRequestorEmail != null) {
query += "&csrRequestorEmail=" + csrRequestorEmail;
}
@@ -746,7 +762,7 @@ public class Request extends TestClient {
query += "&certTypeSSLServer=" + servercert;
}
- if (emailcert.equals("true")) {
+ if (emailcert.equals("true")) {
query += "&certTypeEmail=" + emailcert;
}
@@ -758,13 +774,15 @@ public class Request extends TestClient {
}
- if ((reqtype == 4) || (reqtype == 5) || (reqtype == 6)) { // profile based cert request
+ if ((reqtype == 4) || (reqtype == 5) || (reqtype == 6)) { // profile
+ // based cert
+ // request
if (validityperiod != null) {
Integer x = new Integer(validityperiod);
validperiod = x.intValue();
- } else {
+ } else {
validperiod = 180;
}
@@ -772,8 +790,8 @@ public class Request extends TestClient {
ACTION_STRING = ACTION_PROCESS_CERT_REQUEST;
query = "requestId=" + approveseqnum;
query += "&name="
- + URLEncoder.encode(
- "UID=test,E=test,CN=test,OU=netscape,O=aol");
+ + URLEncoder
+ .encode("UID=test,E=test,CN=test,OU=netscape,O=aol");
query += "&keyUsageCritical=true";
query += "&keyUsageDigitalSignature=true";
query += "&keyUsageNonRepudiation=true";
@@ -809,9 +827,9 @@ public class Request extends TestClient {
// Date begindate = begin.getTime();
// Date enddate = end.getTime();
String nb = begin.get(Calendar.YEAR) + "-"
- + begin.get(Calendar.MONTH) + "-" + begin.get(Calendar.DATE)
- + " " + begin.get(Calendar.HOUR) + ":"
- + begin.get(Calendar.MINUTE) + ":"
+ + begin.get(Calendar.MONTH) + "-"
+ + begin.get(Calendar.DATE) + " " + begin.get(Calendar.HOUR)
+ + ":" + begin.get(Calendar.MINUTE) + ":"
+ begin.get(Calendar.SECOND);
String nat = end.get(Calendar.YEAR) + "-" + end.get(Calendar.MONTH)
@@ -850,9 +868,9 @@ public class Request extends TestClient {
end.add(GregorianCalendar.DATE, validperiod);
String nb = begin.get(Calendar.YEAR) + "-"
- + begin.get(Calendar.MONTH) + "-" + begin.get(Calendar.DATE)
- + " " + begin.get(Calendar.HOUR) + ":"
- + begin.get(Calendar.MINUTE) + ":"
+ + begin.get(Calendar.MONTH) + "-"
+ + begin.get(Calendar.DATE) + " " + begin.get(Calendar.HOUR)
+ + ":" + begin.get(Calendar.MINUTE) + ":"
+ begin.get(Calendar.SECOND);
String nat = end.get(Calendar.YEAR) + "-" + end.get(Calendar.MONTH)
@@ -862,28 +880,30 @@ public class Request extends TestClient {
query = "requestId=" + approveseqnum + "&name="
+ URLEncoder.encode(cadualcert_name) + "&notBefore=" + nb
- + "&notAfter=" + nat + "&authInfoAccessCritical=false"
- + "&authInfoAccessGeneralNames=" + "&keyUsageCritical=true"
+ + "&notAfter="
+ + nat
+ + "&authInfoAccessCritical=false"
+ + "&authInfoAccessGeneralNames="
+ + "&keyUsageCritical=true"
+ "&keyUsageDigitalSignature=false"
+ "&keyUsageNonRepudiation=false"
+ "&keyUsageKeyEncipherment=true"
+ "&keyUsageDataEncipherment=false"
+ "&keyUsageKeyAgreement=false"
- + "&keyUsageKeyCertSign=false" + "&keyUsageCrlSign=false"
+ + "&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
+ + "&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
"&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 +912,7 @@ public class Request extends TestClient {
+ "&op=approve" + "&submit=submit";
}
-
+
}
private void readProperties() {
@@ -901,8 +921,8 @@ public class Request extends TestClient {
try {
getProperties(propfileName);
} catch (Exception e) {
- System.out.println(
- "exception reading Properties File " + e.getMessage());
+ System.out.println("exception reading Properties File "
+ + e.getMessage());
}
// Read the properties file
@@ -968,14 +988,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,20 +1009,20 @@ public class Request extends TestClient {
return false;
}
- if (approveseqnum.length() > 0) {
+ if (approveseqnum.length() > 0) {
if (seqNum.contains(approveseqnum)) {
seqNum.removeAllElements();
seqNum.addElement(approveseqnum);
} else {
- System.out.println(
- " Seq num " + approveseqnum + " already approved ");
+ System.out.println(" Seq num " + approveseqnum
+ + " already approved ");
return false;
}
} else {
- System.out.println(
- " Seq num not specified . Approving all pending request From : "
+ System.out
+ .println(" Seq num not specified . Approving all pending request From : "
+ approveseqnumFrom + " To : " + approveseqnumTo);
- }
+ }
boolean flag = true;
@@ -1015,7 +1035,7 @@ public class Request extends TestClient {
while (i < seqNum.size()) {
approveseqnum = (seqNum.elementAt(i)).toString();
- // Get request details
+ // Get request details
reqtype = 2;
buildquery();
if (!Send()) {
@@ -1023,44 +1043,43 @@ public class Request extends TestClient {
i++;
continue;
}
-
+
if (debug) {
- System.out.println(
- csrRequestorName + " " + csrRequestorPhone + " "
- + csrRequestorEmail + " " + requestID + " "
- + subject);
+ System.out.println(csrRequestorName + " "
+ + csrRequestorPhone + " " + csrRequestorEmail + " "
+ + requestID + " " + subject);
}
- // Now for pending status - approve the request
+ // Now for pending status - approve the request
reqtype = 3;
buildquery();
if (!Send()) {
- System.out.println(
- "Error: Approving request " + approveseqnum);
+ System.out.println("Error: Approving request "
+ + approveseqnum);
i++;
continue;
}
- System.out.println("Request " + approveseqnum + " is approved ");
+ 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 +1109,7 @@ public class Request extends TestClient {
} else {
return 0;
}
- } else {
+ } else {
return -1;
}
@@ -1103,11 +1122,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]);
@@ -1120,5 +1139,5 @@ public class Request extends TestClient {
}// end of function main
-} // end of class
+} // end of class
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 89fa768ca..363e67418 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,32 +24,36 @@ 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..
+ * 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;
- public String ldapPort, ldapHost, ldapSSLPort, ldapBaseSuffix, adminPort, admDN, admDNPW, singleSignOnPWD, domain;
- public String caSigningCertNickName, raSigningCertNickName, ocspSigningCertNickName, kraTransportCertNickName;
+ public String ldapPort, ldapHost, ldapSSLPort, ldapBaseSuffix, adminPort,
+ admDN, admDNPW, singleSignOnPWD, domain;
+ public String caSigningCertNickName, raSigningCertNickName,
+ ocspSigningCertNickName, kraTransportCertNickName;
public String ServerCertNickName, CertAuthority;
public String CMSAgentPort, CMSEESSLPort, CMSEEPort, CMSAdminPort, IDBPort;
public static CMSProperties props = null;
public static CMSProperties CMSprops = null;
- // Private variables
+ // Private variables
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.
+ * Constructor. Takes Server root as parameter for example ( /export/qa).
+ * Reads and collects information about adminserver and Config LDAP server.
*/
public ServerInfo(String sroot) {
serverRoot = sroot;
@@ -58,10 +63,11 @@ 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 .
+ * 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 +88,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 +104,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() {
@@ -148,15 +154,15 @@ public class ServerInfo {
readCMSConfig();
}
- // Private functions
+ // 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 +171,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 +215,12 @@ public class ServerInfo {
} else if (token.equals(" port=")) {
index2 = PORT;
}
-
- if (index1 != 5 && index2 == IP && !token.equals(" ip=")) {
+
+ 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 +239,7 @@ public class ServerInfo {
break;
default:
- break;
+ break;
}
@@ -247,10 +254,11 @@ public class ServerInfo {
if (in != null) {
try {
in.close();
- } catch (Exception ex) {}
+ } catch (Exception ex) {
+ }
}
}
- }
+ }
private void getProperties(String filePath) throws Exception {
try {
@@ -274,7 +282,7 @@ public class ServerInfo {
if ((s.charAt(i) == ' ')) {
i++;
continue;
- } else {
+ } else {
val += s.charAt(i);
}
}
@@ -294,7 +302,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;
@@ -312,14 +320,14 @@ public class ServerInfo {
// System.out.println(ldapPort);
}
if ((ret = tmpstr.indexOf(adminPortStr)) > -1) {
- adminPort = tmpstr.substring(ret + adminPortStr.length() + 1,
- tmpstr.indexOf("ldapStart", ret) - 1);
+ adminPort = tmpstr.substring(ret + adminPortStr.length()
+ + 1, tmpstr.indexOf("ldapStart", ret) - 1);
adminPort = stripSpace(adminPort);
// System.out.println(adminPort);
}
}
-
+
fis.close();
} catch (Exception e) {
System.out.println("exception " + e.getMessage());
@@ -337,17 +345,17 @@ public class ServerInfo {
System.out.println("Reading CMS Config file successful");
CertAuthority = CMSprops.getProperty("subsystem.0.id");
if (CertAuthority.equals("ca")) {
- caSigningCertNickName = CMSprops.getProperty(
- "ca.signing.cacertnickname");
+ caSigningCertNickName = CMSprops
+ .getProperty("ca.signing.cacertnickname");
ServerCertNickName = "Server-Cert cert-" + instanceID;
}
if (CertAuthority.equals("ra")) {
- raSigningCertNickName = CMSprops.getProperty(
- "ra.signing.cacertnickname");
+ raSigningCertNickName = CMSprops
+ .getProperty("ra.signing.cacertnickname");
ServerCertNickName = "Server-Cert cert-" + instanceID;
}
IDBPort = CMSprops.getProperty("internaldb.ldapconn.port");
-
+
fis.close();
} catch (Exception e) {
System.out.println("exception " + e.getMessage());
@@ -361,18 +369,18 @@ 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
+} // 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 fc2668565..52885c375 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
@@ -28,15 +29,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.
+ * 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;
@@ -44,7 +41,8 @@ public class TestClient implements SSLCertificateApprovalCallback {
// properties file parameters
public static String host, ports, adminid, adminpwd, propfileName, cdir;
public static String certnickname, keysize, keytype, tokenpwd;
- public static String serverRoot, instanceRoot, ldaprootDN, ldaprootDNPW, caInstanceRoot, dataDirectory;
+ public static String serverRoot, instanceRoot, ldaprootDN, ldaprootDNPW,
+ caInstanceRoot, dataDirectory;
// Program variables
public String STATUS;
@@ -52,20 +50,20 @@ public class TestClient implements SSLCertificateApprovalCallback {
public String ACTION_STRING;
public String query;
public boolean debug = false;
- // Certificate nicknames to be used by Test Clients
+ // Certificate nicknames to be used by Test Clients
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;
@@ -76,7 +74,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
public String UID, OU, O, DN, E, CN, C, GN, SN, L, MAIL;
// Enroll
protected String PWD;
- // CRypto
+ // CRypto
public ComCrypto cCrypt = new ComCrypto();
public String pkcs10request = null;
@@ -84,19 +82,18 @@ 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"};
+ private String unauth[] = { "Unauthorized Access", "Server Error",
+ "Not Found", "Generic Unauthorized" };
- public boolean approve(X509Certificate x509, SSLCertificateApprovalCallback.ValidityStatus status) {
+ public boolean approve(X509Certificate x509,
+ SSLCertificateApprovalCallback.ValidityStatus status) {
SSLServerCert = x509;
return true;
}
- // Constructor
-
+ // Constructor
public TestClient() {
keysize = "1024";
@@ -104,15 +101,16 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
/**
- * 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");
@@ -149,7 +147,8 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
/**
- * Imports certificate to cert database.Takes parameters Certpackage and certnickname
+ * Imports certificate to cert database.Takes parameters Certpackage and
+ * certnickname
*/
boolean importCert(String cp, String nickname) {
@@ -177,7 +176,6 @@ public class TestClient implements SSLCertificateApprovalCallback {
* This function returns true if you choose to executeCleanupTests
*/
-
public boolean executeCleanupTests() {
if (cleanupTests == null) {
@@ -216,7 +214,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
public String GetLDAPDNPW() {
return ldaprootDNPW;
- }
+ }
public String GetLDAPBASE() {
return ldapBaseSuffix;
@@ -300,10 +298,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) {
@@ -313,14 +311,14 @@ public class TestClient implements SSLCertificateApprovalCallback {
ret = line.indexOf("fixed.errorDetails");
if (line.indexOf("fixed.errorDetails") == 0) {
- ErrorDetail = line.substring(
- ret + ("fixed.errorDetails = ").length());
+ ErrorDetail = line.substring(ret
+ + ("fixed.errorDetails = ").length());
return true;
}
if (line.indexOf("fixed.errorDetails") >= 0) {
- ErrorDetail = line.substring(
- ret + ("fixed.errorDetails = ").length());
+ ErrorDetail = line.substring(ret
+ + ("fixed.errorDetails = ").length());
return true;
}
@@ -328,8 +326,8 @@ public class TestClient implements SSLCertificateApprovalCallback {
if (line.indexOf("fixed.unexpectedError") == 0) {
System.out.println("Processing unexpectedError");
- ErrorDetail = line.substring(
- ret + ("fixed.unexpectedError = ").length());
+ ErrorDetail = line.substring(ret
+ + ("fixed.unexpectedError = ").length());
return true;
}
@@ -354,7 +352,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
ErrorDetail = line.substring(ret + ("errorReason=").length());
return true;
}
-
+
return false;
}
@@ -374,7 +372,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
- public String ReadEnv(String str) {
+ public String ReadEnv(String str) {
try {
Process p = null;
Runtime r = Runtime.getRuntime();
@@ -386,8 +384,8 @@ public class TestClient implements SSLCertificateApprovalCallback {
p = r.exec("env");
}
- BufferedReader br = new BufferedReader(
- new InputStreamReader(p.getInputStream()));
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
@@ -411,8 +409,8 @@ public class TestClient implements SSLCertificateApprovalCallback {
try {
getProperties(testConfigFile);
} catch (Exception e) {
- System.out.println(
- "exception reading TestConfigFile " + e.getMessage());
+ System.out.println("exception reading TestConfigFile "
+ + e.getMessage());
}
serverRoot = props.getProperty("SROOT");
@@ -426,7 +424,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
}
ldaprootDN = props.getProperty("LDAPROOTDN");
- // Strip of th e quotes "cn=directory manager" string
+ // Strip of th e quotes "cn=directory manager" string
if (ldaprootDN.indexOf("\"") > -1) {
ldaprootDN = ldaprootDN.substring(1, ldaprootDN.length() - 1);
}
@@ -483,7 +481,8 @@ 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);
@@ -506,7 +505,7 @@ public class TestClient implements SSLCertificateApprovalCallback {
return (getString(p));
}
- // This following method doesn't Always get a free port.
+ // This following method doesn't Always get a free port.
// while (st) {
// if(isSocketUnused(host,p) )
// st=false;
@@ -517,7 +516,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) {
@@ -544,73 +543,70 @@ public class TestClient implements SSLCertificateApprovalCallback {
TestClient t = new TestClient("1024", "RSA");
/*
- *******************************************************************
- * Sample programs to initialze calsses
- *******************************************************************
+ * ******************************************************************
+ * Sample programs to initialze calsses
+ * ******************************************************************
*/
-
/*
- ********************************************************************
- * To Test AutoInstaller
- *******************************************************************
+ * *******************************************************************
+ * To Test AutoInstaller
+ * ******************************************************************
*/
-
/*
- AutoInstaller a = new AutoInstaller(t.GetServerRoot());
-
- ServerInfo s = new ServerInfo(t.GetServerRoot());
- System.out.println (" Admin Port : " + s.GetAdminPort());
- System.out.println (" LDAP Port : "+ s.GetConfigLDAPPort());
- System.out.println( "Hostname " + s.GetHostName());
- System.out.println(" doamin name : " + s.GetDomainName());
-
- t.setHostName(s.GetHostName());
- // Set adminServer Info
- a.setAdminInfo(s.GetHostName(),s.GetAdminPort(),s.GetDomainName(),"admin","admin");
- a.setAdminInfo(s.GetHostName(),s.GetAdminPort(),"mcom.com","admin","admin");
-
- // setCAInfo
- a.setCAInfo(s.GetHostName(),"1027","8100","admin","secret12");
- //setInternalDB info
- String dp = t.getFreePort("38900");
- a.setInternalDBInfo(s.GetHostName(),"38907","ca-db","cn=directory manager","secret12" );
-
- // set tokenInfo
-
- a.setTokenInfo("Internal","secret12");
-
- // set Subsystem info
- String agp = t.getFreePort("8100");
- String adp = t.getFreePort("8200");
- String eesp = t.getFreePort("1027");
- String eep = t.getFreePort("1100");
-
- System.out.println(agp);
-
- a.setSubSystemInfo("testra",t.GetServerRoot(),"RSA","1024","MD5","365","cn=certificate manager,ou=test,o=test",adp,agp,eesp,eep);
-
- a.setClientDBInfo(t.GetClientCertDB(),"secret12",t.GetAdminCertName());
-
- a.ConfigureCA("admin","admin","secret12","secret12");
-
- // a.ConfigureRA("admin","admin","secret12","secret12");
-
+ * AutoInstaller a = new AutoInstaller(t.GetServerRoot());
+ *
+ * ServerInfo s = new ServerInfo(t.GetServerRoot()); System.out.println
+ * (" Admin Port : " + s.GetAdminPort()); System.out.println
+ * (" LDAP Port : "+ s.GetConfigLDAPPort()); System.out.println(
+ * "Hostname " + s.GetHostName()); System.out.println(" doamin name : "
+ * + s.GetDomainName());
+ *
+ * t.setHostName(s.GetHostName()); // Set adminServer Info
+ * a.setAdminInfo
+ * (s.GetHostName(),s.GetAdminPort(),s.GetDomainName(),"admin","admin");
+ * a
+ * .setAdminInfo(s.GetHostName(),s.GetAdminPort(),"mcom.com","admin","admin"
+ * );
+ *
+ * // setCAInfo
+ * a.setCAInfo(s.GetHostName(),"1027","8100","admin","secret12");
+ * //setInternalDB info String dp = t.getFreePort("38900");
+ * a.setInternalDBInfo
+ * (s.GetHostName(),"38907","ca-db","cn=directory manager","secret12" );
+ *
+ * // set tokenInfo
+ *
+ * a.setTokenInfo("Internal","secret12");
+ *
+ * // set Subsystem info String agp = t.getFreePort("8100"); String adp
+ * = t.getFreePort("8200"); String eesp = t.getFreePort("1027"); String
+ * eep = t.getFreePort("1100");
+ *
+ * System.out.println(agp);
+ *
+ * a.setSubSystemInfo("testra",t.GetServerRoot(),"RSA","1024","MD5","365"
+ * ,"cn=certificate manager,ou=test,o=test",adp,agp,eesp,eep);
+ *
+ * a.setClientDBInfo(t.GetClientCertDB(),"secret12",t.GetAdminCertName())
+ * ;
+ *
+ * a.ConfigureCA("admin","admin","secret12","secret12");
+ *
+ * // a.ConfigureRA("admin","admin","secret12","secret12");
*/
/*
- ******************************************************
- * Example to Get Server Details
- ******************************************************
+ * *****************************************************
+ * Example to Get Server Details
+ * *****************************************************
*/
-
-
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());
@@ -620,8 +616,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());
@@ -633,341 +629,318 @@ public class TestClient implements SSLCertificateApprovalCallback {
/* ****************************************************************
* CMC Enroll
- ***************************************************************
+ * **************************************************************
*/
- /* CMSUtils cmsutils = new CMSUtils(t.GetServerRoot());
- String requestfile="/u/lgopal/work/tetCMS/ns/tetframework/testcases/CMS/6.0/acceptance/data/basic/cmcreq/cmctest1.req";
- cmsutils.runCMCEnroll(t.GetClientCertDB(),"cn=admin",t.GetClientCertDBPW(),requestfile);
- Profiles pr = new Profiles(s.GetHostName(),s.GetEESSLPort());
- pr.setProfileType("caCMCUserCert");
- pr.setCertAuthority("ca");
-
- String request = t.readRequest(requestfile+".out");
- String bstr = "-----BEGIN NEW CERTIFICATE REQUEST-----";
- String estr="-----END NEW CERTIFICATE REQUEST-----";
- String Blob1 = request.substring(bstr.length() + 1);
- String Blob2 = Blob1.substring(0,Blob1.indexOf(estr));
- request=Blob2;
-
-
- pr.setRequest(request);
-
- pr.setUserInfo("UID=test1,Ou=netscape,o=aol","test","test","test","netscape","aol");
- pr.clientCertEnroll();
+ /*
+ * CMSUtils cmsutils = new CMSUtils(t.GetServerRoot()); String
+ * requestfile=
+ * "/u/lgopal/work/tetCMS/ns/tetframework/testcases/CMS/6.0/acceptance/data/basic/cmcreq/cmctest1.req"
+ * ;
+ * cmsutils.runCMCEnroll(t.GetClientCertDB(),"cn=admin",t.GetClientCertDBPW
+ * (),requestfile); Profiles pr = new
+ * Profiles(s.GetHostName(),s.GetEESSLPort());
+ * pr.setProfileType("caCMCUserCert"); pr.setCertAuthority("ca");
+ *
+ * String request = t.readRequest(requestfile+".out"); String bstr =
+ * "-----BEGIN NEW CERTIFICATE REQUEST-----"; String
+ * estr="-----END NEW CERTIFICATE REQUEST-----"; String Blob1 =
+ * request.substring(bstr.length() + 1); String Blob2 =
+ * Blob1.substring(0,Blob1.indexOf(estr)); request=Blob2;
+ *
+ *
+ * pr.setRequest(request);
+ *
+ * pr.setUserInfo("UID=test1,Ou=netscape,o=aol","test","test","test",
+ * "netscape","aol"); pr.clientCertEnroll();
*/
-
/* ****************************************************************
* OCSP Client stuff
- ************************************************************
+ * ***********************************************************
*/
/*
- String ip= "10.169.25.26";
- OCSPClient ocspclient= new OCSPClient(s.GetHostName(),ip,s.GetEEPort(),t.GetClientCertDB(),t.GetClientCertDBPW(),"cn=admin" ,"/tmp/ocsp.out","4");
- ocspclient.setCert(t.findCertByNickname("ocsp-agent"));
-
- ocspclient.SendOCSPRequest();
+ * String ip= "10.169.25.26"; OCSPClient ocspclient= new
+ * OCSPClient(s.GetHostName
+ * (),ip,s.GetEEPort(),t.GetClientCertDB(),t.GetClientCertDBPW
+ * (),"cn=admin" ,"/tmp/ocsp.out","4");
+ * ocspclient.setCert(t.findCertByNickname("ocsp-agent"));
+ *
+ * ocspclient.SendOCSPRequest();
*/
-
/*
- *****************************************************
+ * ****************************************************
* Test CRMFcleint and KRA REcovery and Archival
- *****************************************************
+ * ****************************************************
*/
/*
- *********************************************************
+ * ********************************************************
* OCSP Agent stuff
- *********************************************************
+ * ********************************************************
*/
-
- /* Retrieval rtr = new Retrieval(s.GetHostName(),s.GetEESSLPort());
- rtr.getCACert();
- System.out.println("CA Cert chain" + rtr.getCert());
-
- OcspAgent ocspAgent= new OcspAgent(s.GetHostName(),"8111");
- ocspAgent.setAgentCertName(t.GetOCSPAgentCertName());
-
- String cert = "-----BEGIN CERTIFICATE-----"+"\n"+rtr.getCert()+"\n"+"-----END CERTIFICATE-----\n";
-
- ocspAgent.setCACert(cert);
- ocspAgent.addCA();
+ /*
+ * Retrieval rtr = new Retrieval(s.GetHostName(),s.GetEESSLPort());
+ * rtr.getCACert(); System.out.println("CA Cert chain" + rtr.getCert());
+ *
+ * OcspAgent ocspAgent= new OcspAgent(s.GetHostName(),"8111");
+ * ocspAgent.setAgentCertName(t.GetOCSPAgentCertName());
+ *
+ * String cert = "-----BEGIN CERTIFICATE-----"+"\n"+rtr.getCert()+"\n"+
+ * "-----END CERTIFICATE-----\n";
+ *
+ * ocspAgent.setCACert(cert); ocspAgent.addCA();
*/
-
/*
- ***************************************************************
- Submit Profile based request
- *********************************************************
+ * **************************************************************
+ * Submit Profile based request
+ * ********************************************************
*/
/*
- Profiles pr = new Profiles(s.GetHostName(),s.GetEESSLPort());
- pr.setProfileType("caUserCert");
- // pr.setProfileType("caDirUserCert");
-
- pr.setCertAuthority("ca");
- pr.setUserInfo("UID=test1,Ou=netscape,o=aol","test","test","test","netscape","aol");
- //pr.setDirUserInfo("test","netscape");
- pr.clientCertEnroll();
- System.out.println("Request ID is " + pr.getRequestID());
-
-
- Request re = new Request (s.GetHostName(),s.GetAgentPort(),"ca");
- re.setAgentCertName(t.GetAdminCertName());
- re.ApproveProfileRequests(pr.getRequestID());
+ * Profiles pr = new Profiles(s.GetHostName(),s.GetEESSLPort());
+ * pr.setProfileType("caUserCert"); //
+ * pr.setProfileType("caDirUserCert");
+ *
+ * pr.setCertAuthority("ca");
+ * pr.setUserInfo("UID=test1,Ou=netscape,o=aol"
+ * ,"test","test","test","netscape","aol");
+ * //pr.setDirUserInfo("test","netscape"); pr.clientCertEnroll();
+ * System.out.println("Request ID is " + pr.getRequestID());
+ *
+ *
+ * Request re = new Request (s.GetHostName(),s.GetAgentPort(),"ca");
+ * re.setAgentCertName(t.GetAdminCertName());
+ * re.ApproveProfileRequests(pr.getRequestID());
*/
/*
- String TransportCert="MIICJTCCAY6gAwIBAgIBBTANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVzdDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MjMyMTM3NTFaFw0wNDA0MjIwOTMzMzFaMDkxETAPBgNVBAoTCHRlc3QxMDI0MRcwFQYDVQQLEw5hY2NlcHRhbmNldGVzdDELMAkGA1UEAxMCcmEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANVW81T7GatHIB25kF0jdY4h4hOF1NAlAHE2YdN/UEyXuU22CfwrIltA3x/6sKFHhbbFysn6nGJlgKipPJqJDwyYTIv07hgoXqgcUu8fSYQg4BDHYhpHJxsUt3BSfADTjxAUHize7C2F8TVhBIcWW043FSkwvAiUjJb7uqQRKn7lAgMBAAGjMzAxMA4GA1UdDwEB/wQEAwIFIDAfBgNVHSMEGDAWgBTqvc3UPGDSWq+21DZGSUABNGIUbDANBgkqhkiG9w0BAQQFAAOBgQCNLJivNDHTTmCb2vDefUwLMxXNjuHwrbjVqymHPFqUjredTq2Yp+Ed1zxj+mxRovzegd65Tbnx+MV84j8K3Qc1kWOC+kbohAY9svSPsN3o5Q5BB19+5nUPC5Gk/mxkWJWWJLOnpKJGiAHMZIr58TH7hF8KQWXWMN9ikSFkPj0a/g==";
-
-
- CRMFClient CrmfClient = new CRMFClient(s.GetHostName(),s.GetEEPort());
- CrmfClient.setDBInfo(t.GetClientCertDB(),t.GetClientCertDBPW());
- CrmfClient.setTransportCert(TransportCert);
- CrmfClient.setUserInfo("user","netscape");
- CrmfClient.setLDAPInfo(t.GetLDAPDN(),t.GetLDAPDNPW());
- CrmfClient.setDualKey(true);
-
- if(!CrmfClient.Enroll())
- {System.out.println("CRMFClient : could not submit request");}
-
-
- checkRequest cr = new checkRequest(s.GetHostName(),s.GetEESSLPort(),t.getString(CrmfClient.getRequestId()),"false");
- cr.checkRequestStatus();
- System.out.println("Serial num " + cr.getSerialNumber());
- System.out.println("cert pack " + cr.getCert());
-
- KraAgent kraAgent = new KraAgent(s.GetHostName(),"8111");
- kraAgent.setAgentCertName("cn=admin");
- System.out.println("KRAAgent List archival");
-
- Vector aReq= kraAgent.ListArchivalRequests();
- int i=0;
- while(i < aReq.size() )
- {
- System.out.print(aReq.elementAt(i) + " ");
- i++;
- }
-
- kraAgent.setCertificate(cr.getCert());
- kraAgent.setLocalAgent(false);
- kraAgent.recoverKeys();
+ * String TransportCert=
+ * "MIICJTCCAY6gAwIBAgIBBTANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVzdDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MjMyMTM3NTFaFw0wNDA0MjIwOTMzMzFaMDkxETAPBgNVBAoTCHRlc3QxMDI0MRcwFQYDVQQLEw5hY2NlcHRhbmNldGVzdDELMAkGA1UEAxMCcmEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANVW81T7GatHIB25kF0jdY4h4hOF1NAlAHE2YdN/UEyXuU22CfwrIltA3x/6sKFHhbbFysn6nGJlgKipPJqJDwyYTIv07hgoXqgcUu8fSYQg4BDHYhpHJxsUt3BSfADTjxAUHize7C2F8TVhBIcWW043FSkwvAiUjJb7uqQRKn7lAgMBAAGjMzAxMA4GA1UdDwEB/wQEAwIFIDAfBgNVHSMEGDAWgBTqvc3UPGDSWq+21DZGSUABNGIUbDANBgkqhkiG9w0BAQQFAAOBgQCNLJivNDHTTmCb2vDefUwLMxXNjuHwrbjVqymHPFqUjredTq2Yp+Ed1zxj+mxRovzegd65Tbnx+MV84j8K3Qc1kWOC+kbohAY9svSPsN3o5Q5BB19+5nUPC5Gk/mxkWJWWJLOnpKJGiAHMZIr58TH7hF8KQWXWMN9ikSFkPj0a/g=="
+ * ;
+ *
+ *
+ * CRMFClient CrmfClient = new
+ * CRMFClient(s.GetHostName(),s.GetEEPort());
+ * CrmfClient.setDBInfo(t.GetClientCertDB(),t.GetClientCertDBPW());
+ * CrmfClient.setTransportCert(TransportCert);
+ * CrmfClient.setUserInfo("user","netscape");
+ * CrmfClient.setLDAPInfo(t.GetLDAPDN(),t.GetLDAPDNPW());
+ * CrmfClient.setDualKey(true);
+ *
+ * if(!CrmfClient.Enroll())
+ * {System.out.println("CRMFClient : could not submit request");}
+ *
+ *
+ * checkRequest cr = new
+ * checkRequest(s.GetHostName(),s.GetEESSLPort(),t.
+ * getString(CrmfClient.getRequestId()),"false");
+ * cr.checkRequestStatus(); System.out.println("Serial num " +
+ * cr.getSerialNumber()); System.out.println("cert pack " +
+ * cr.getCert());
+ *
+ * KraAgent kraAgent = new KraAgent(s.GetHostName(),"8111");
+ * kraAgent.setAgentCertName("cn=admin");
+ * System.out.println("KRAAgent List archival");
+ *
+ * Vector aReq= kraAgent.ListArchivalRequests(); int i=0; while(i <
+ * aReq.size() ) { System.out.print(aReq.elementAt(i) + " "); i++; }
+ *
+ * kraAgent.setCertificate(cr.getCert()); kraAgent.setLocalAgent(false);
+ * kraAgent.recoverKeys();
*/
/*
- *************************************************************
- * Example to Connect oto Config Directory port
- *************************************************************
- */
-
- /*
- CMSLDAP cmsldap = new CMSLDAP(s.GetHostName(),s.GetConfigLDAPPort(),t.GetLDAPDN(),t.GetLDAPDNPW());
- if(cmsldap.connect())
- System.out.println("LDAP Connection successful");
- else
- System.out.println("Error Connecting to LDAPSERVER");
-
- // Add user to config directoory
- if (cmsldap.userAdd("ou=people,"+t.GetLDAPBASE(),"t2","t2","t2","netscape"))
- System.out.println("Added user to Config directory");
+ * ************************************************************
+ * Example to Connect oto Config Directory port
+ * ************************************************************
+ */
+ /*
+ * CMSLDAP cmsldap = new
+ * CMSLDAP(s.GetHostName(),s.GetConfigLDAPPort(),t.
+ * GetLDAPDN(),t.GetLDAPDNPW()); if(cmsldap.connect())
+ * System.out.println("LDAP Connection successful"); else
+ * System.out.println("Error Connecting to LDAPSERVER");
+ *
+ * // Add user to config directoory if
+ * (cmsldap.userAdd("ou=people,"+t.GetLDAPBASE
+ * (),"t2","t2","t2","netscape"))
+ * System.out.println("Added user to Config directory");
*/
-
/*
- *************************************************************
- * Example to Submit a CRMFCleint request to CA
- *************************************************************
- */
+ * ************************************************************
+ * Example to Submit a CRMFCleint request to CA
+ * ************************************************************
+ */
String TransportCert = "MIICJTCCAY6gAwIBAgIBBTANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVzdDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTgyMjMwMDhaFw0wNDA0MTcxMDI2MDhaMDkxETAPBgNVBAoTCHRlc3QxMDI0MRcwFQYDVQQLEw5hY2NlcHRhbmNldGVzdDELMAkGA1UEAxMCcmEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAN6sQ3mSU8mL6i6gTZIXDLzOZPhYOkQLpnJjit5hcPZ0JMn0CQVXo4QjKN1xvuZv8qVlZoQw9czmzp/knTa0sCDgFKd0r+u0TnLeZkJMSimgFnma9CnChlaDHnBd8Beu4vyaHmo7rJ0xA4etn7HjhmKbaQZOcv/aP0SW9JXRga7ZAgMBAAGjMzAxMA4GA1UdDwEB/wQEAwIFIDAfBgNVHSMEGDAWgBSC3fsQHb7fddr2vL0UdkM2dAmUWzANBgkqhkiG9w0BAQQFAAOBgQBkAGbgd9HIqwoLKAr+V6bj9oWesDmDH80gPPxj10qyWSQYIs8PofOs/75yGS9nxhydtgSMFoBgCPdroUI31kZQQlFzxtudGoKD+5MWSXho79XzPwpjheOBYgpX6ch+L4tMLFDpqeraB1yZESO5EEeKm20DGVBOKVWxHhddO1BenA==";
/*
- CRMFClient CrmfClient = new CRMFClient(s.GetHostName(),s.GetEEPort());
- CrmfClient.setDBInfo(t.GetClientCertDB(),t.GetClientCertDBPW());
- CrmfClient.setTransportCert(TransportCert);
- CrmfClient.setUserInfo("user","netscape");
- CrmfClient.setLDAPInfo(t.GetLDAPDN(),t.GetLDAPDNPW());
- CrmfClient.setDualKey(true);
-
- if(!CrmfClient.Enroll())
- {System.out.println("CRMFClient : could not submit request");}
+ * CRMFClient CrmfClient = new
+ * CRMFClient(s.GetHostName(),s.GetEEPort());
+ * CrmfClient.setDBInfo(t.GetClientCertDB(),t.GetClientCertDBPW());
+ * CrmfClient.setTransportCert(TransportCert);
+ * CrmfClient.setUserInfo("user","netscape");
+ * CrmfClient.setLDAPInfo(t.GetLDAPDN(),t.GetLDAPDNPW());
+ * CrmfClient.setDualKey(true);
+ *
+ * if(!CrmfClient.Enroll())
+ * {System.out.println("CRMFClient : could not submit request");}
*/
-
+
/* KRA Agent list archived request */
- /* ServerInfo KRAsvrInfo = new ServerInfo(t.GetServerRoot());
- String KRAinstanceRoot=t.GetServerRoot() + "/cert-" + "KRARSA1024" ;
- KRAsvrInfo.setInstanceRoot(KRAinstanceRoot);*/
-
- /* System.out.println("KRAAgent ");
- KraAgent kraAgent = new KraAgent(s.GetHostName(),s.GetAgentPort());
- kraAgent.setAgentCertName(t.GetKRAAgentCertName());
- System.out.println("KRAAgent List archival");
-
- Vector aReq= kraAgent.ListArchivalRequests();
- int i=0;
- while(i < aReq.size() )
- {
- System.out.print(aReq.elementAt(i) + " ");
- i++;
- }
+ /*
+ * ServerInfo KRAsvrInfo = new ServerInfo(t.GetServerRoot()); String
+ * KRAinstanceRoot=t.GetServerRoot() + "/cert-" + "KRARSA1024" ;
+ * KRAsvrInfo.setInstanceRoot(KRAinstanceRoot);
+ */
+ /*
+ * System.out.println("KRAAgent "); KraAgent kraAgent = new
+ * KraAgent(s.GetHostName(),s.GetAgentPort());
+ * kraAgent.setAgentCertName(t.GetKRAAgentCertName());
+ * System.out.println("KRAAgent List archival");
+ *
+ * Vector aReq= kraAgent.ListArchivalRequests(); int i=0; while(i <
+ * aReq.size() ) { System.out.print(aReq.elementAt(i) + " "); i++; }
*/
-
// cmsldap.disconnect();
/*
- *************************************************************
- * Example to submit manual user enrollment request
- *************************************************************
- /*
-
-
- /*
- UserEnroll ue = new UserEnroll(s.GetHostName(),"1029");
- ue.setUserInfo("E=testman,CN=testman,OU=netscape,O=aol,UID=testman1,C=US","testman", "testman", "testman1", "netscape","t");
-
- boolean flag = ue.clientCertEnroll();
- if(flag)
- System.out.println("Success submitted request");
+ * ************************************************************
+ * Example to submit manual user enrollment request
+ * ************************************************************ /*
+ *
+ *
+ * /* UserEnroll ue = new UserEnroll(s.GetHostName(),"1029");
+ * ue.setUserInfo
+ * ("E=testman,CN=testman,OU=netscape,O=aol,UID=testman1,C=US"
+ * ,"testman", "testman", "testman1", "netscape","t");
+ *
+ * boolean flag = ue.clientCertEnroll(); if(flag)
+ * System.out.println("Success submitted request");
*/
/*
- *************************************************************
- * Example to submit Directory based enroolemt request
- *************************************************************
- /*
-
- /*
- // Add user to config directoory
- if (cmsldap.userAdd("dc=netscape,dc=com","t2","t2","t2","netscape"))
- System.out.println("Success ");
-
- if(cmsldap.TurnOnSSL("slapd-jupiter2","Server-Cert cert-jupiter2","7000"))
- System.out.println("Turned on ssl");
- else
- return;
-
- cmsldap.TurnOffSSL();
-
- cmsldap.disconnect();
-
- DirEnroll de = new DirEnroll(s.GetHostName(),s.GetEESSLPort());
- de.setUIDInfo("t2","netscape");
- de.enroll();
-
+ * ************************************************************
+ * Example to submit Directory based enroolemt request
+ * ************************************************************ /*
+ *
+ * /* // Add user to config directoory if
+ * (cmsldap.userAdd("dc=netscape,dc=com","t2","t2","t2","netscape"))
+ * System.out.println("Success ");
+ *
+ * if(cmsldap.TurnOnSSL("slapd-jupiter2","Server-Cert cert-jupiter2","7000"
+ * )) System.out.println("Turned on ssl"); else return;
+ *
+ * cmsldap.TurnOffSSL();
+ *
+ * cmsldap.disconnect();
+ *
+ * DirEnroll de = new DirEnroll(s.GetHostName(),s.GetEESSLPort());
+ * de.setUIDInfo("t2","netscape"); de.enroll();
*/
/*
- *************************************************************
- * Example to submit Admin Enrollment request
- *************************************************************
- /*
-
- /*
-
- AdminEnroll ade = new AdminEnroll("jupiter2","8200","cn=CMS Administrator,UID=admin,C=US","admin", "secret12");
- flag = ade.Enroll();
- if (flag)
- System.out.println("adminEnrolled Successfully");
+ * ************************************************************
+ * Example to submit Admin Enrollment request
+ * ************************************************************ /*
+ *
+ * /*
+ *
+ * AdminEnroll ade = new
+ * AdminEnroll("jupiter2","8200","cn=CMS Administrator,UID=admin,C=US"
+ * ,"admin", "secret12"); flag = ade.Enroll(); if (flag)
+ * System.out.println("adminEnrolled Successfully");
*/
/*
- *************************************************************
- * Example gent List Pending request
- *************************************************************
- /*
-
- /*
-
- // Agent List and Approve Request
- Request re = new Request (s.GetHostName(),s.GetAgentPort(),s.GetCertAuthority());
- re.setAgentCertName(t.GetAdminCertName());
- re.ListPendingRequests("2","70");
- re.ApproveRequests(t.getString(ue.getRequestId()));
+ * ************************************************************
+ * Example gent List Pending request
+ * ************************************************************ /*
+ *
+ * /*
+ *
+ * // Agent List and Approve Request Request re = new Request
+ * (s.GetHostName(),s.GetAgentPort(),s.GetCertAuthority());
+ * re.setAgentCertName(t.GetAdminCertName());
+ * re.ListPendingRequests("2","70");
+ * re.ApproveRequests(t.getString(ue.getRequestId()));
*/
/*
- *************************************************************
- * Example for CheckRequest Status and add the certificate to internal db
- *************************************************************
- /*
-
- /*
- // check request status and Revoke cert
- checkRequest cr = new checkRequest(s.GetHostName(),s.GetEESSLPort(),t.getString(ue.getRequestId()),"false");
- checkRequest cr = new checkRequest(s.GetHostName(),s.GetEESSLPort(),"1","false");
-
- cr.checkRequestStatus();
- System.out.println("Serial num " + cr.getSerialNumber());
- System.out.println("cert pack " + cr.getCert());
-
- String st= "-----BEGIN CERTIFICATE-----"+"\n"+cr.getCert()+"\n"+"-----END CERTIFICATE-----\n";
- System.out.println("cert pack " + st);
-
- cmsldap.getXCertificate(st.getBytes());
-
+ * ************************************************************
+ * Example for CheckRequest Status and add the certificate to internal
+ * db************************************************************ /*
+ *
+ * /* // check request status and Revoke cert checkRequest cr = new
+ * checkRequest
+ * (s.GetHostName(),s.GetEESSLPort(),t.getString(ue.getRequestId
+ * ()),"false"); checkRequest cr = new
+ * checkRequest(s.GetHostName(),s.GetEESSLPort(),"1","false");
+ *
+ * cr.checkRequestStatus(); System.out.println("Serial num " +
+ * cr.getSerialNumber()); System.out.println("cert pack " +
+ * cr.getCert());
+ *
+ * String st= "-----BEGIN CERTIFICATE-----"+"\n"+cr.getCert()+"\n"+
+ * "-----END CERTIFICATE-----\n"; System.out.println("cert pack " + st);
+ *
+ * cmsldap.getXCertificate(st.getBytes());
*/
-
/*
- *************************************************************
- * Example agent ro revoke request
- *************************************************************
- /*
-
- /*
- Revoke rr = new Revoke (s.GetHostName(),s.GetAgentPort(),s.GetCertAuthority(),t.getString(cr.getSerialNumber()));
- rr.revokeCerts();
+ * ************************************************************
+ * Example agent ro revoke request
+ * ************************************************************ /*
+ *
+ * /* Revoke rr = new Revoke
+ * (s.GetHostName(),s.GetAgentPort(),s.GetCertAuthority
+ * (),t.getString(cr.getSerialNumber())); rr.revokeCerts();
*/
/*
- *************************************************************
- * Example Agent update CRL
- *************************************************************
- /*
-
- /*
- // Update CRLand DISPLAY it
-
- System.out.println("Displayin CRL");
- CRL crl = new CRL (s.GetHostName(),s.GetAgentPort(),"/tmp/crlfile");
- crl.setAgentCertName(t.GetAdminCertName());
- crl.updateCRL();
- crl.displayCRL();
- crl.getRevokedCerts();
+ * ************************************************************
+ * Example Agent update CRL
+ * ************************************************************ /*
+ *
+ * /* // Update CRLand DISPLAY it
+ *
+ * System.out.println("Displayin CRL"); CRL crl = new CRL
+ * (s.GetHostName(),s.GetAgentPort(),"/tmp/crlfile");
+ * crl.setAgentCertName(t.GetAdminCertName()); crl.updateCRL();
+ * crl.displayCRL(); crl.getRevokedCerts();
*/
// Update CRL in Directory
- /* UpdateDir dcrl = new UpdateDir(s.GetHostName(),s.GetEESSLPort());
- dcrl.updateDir();*/
-
/*
- *************************************************************
- * Example for stopping and starting servers
- *************************************************************
+ * UpdateDir dcrl = new UpdateDir(s.GetHostName(),s.GetEESSLPort());
+ * dcrl.updateDir();
*/
/*
- DSTask idb = new DSTask(t.GetServerRoot()+"/slapd-jupiter2-db");
- if (idb.ldapStop()) System.out.println("IDB stopped");
- if(idb.ldapStart()) System.out.println("IDB Started");
-
- System.out.println("------------------------------------------");
- System.out.println(" CMS Test:");
- CMSTask task = new CMSTask(t.GetInstanceRoot());
- task.CMSStop();
- task.CMSStart();
+ * ************************************************************
+ * Example for stopping and starting servers
+ * ************************************************************
*/
-
+ /*
+ * DSTask idb = new DSTask(t.GetServerRoot()+"/slapd-jupiter2-db"); if
+ * (idb.ldapStop()) System.out.println("IDB stopped");
+ * if(idb.ldapStart()) System.out.println("IDB Started");
+ *
+ * System.out.println("------------------------------------------");
+ * System.out.println(" CMS Test:"); CMSTask task = new
+ * CMSTask(t.GetInstanceRoot()); task.CMSStop(); 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 fa402cf61..033a4d9d7 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,32 +29,29 @@ 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>
+ * CMS Test framework . Submits Legacy Manual User Enrollment request from EESSL
+ * port. Parses the response from server and return RequestID.
+ * <P>
*/
-
public class UserEnroll extends TestClient {
private int i;
- private String requestorName, requestorEmail, requestorPhone, requestorComments, requestId, certType, ssl_client;
+ private String requestorName, requestorEmail, requestorPhone,
+ requestorComments, requestId, certType, ssl_client;
private int port;
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,23 +60,28 @@ 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;
}
/**
- * 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"
+ * 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,10 +117,12 @@ 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) {
+ public void setUserInfo(String dn, String e, String cn, String uid,
+ String ou, String o) {
DN = dn;
E = e;
CN = cn;
@@ -133,7 +137,8 @@ public class UserEnroll extends TestClient {
}
- public void setUserInfo(String dn, String e, String cn, String uid, String ou, String o, String nickname) {
+ public void setUserInfo(String dn, String e, String cn, String uid,
+ String ou, String o, String nickname) {
DN = dn;
E = e;
CN = cn;
@@ -149,7 +154,8 @@ public class UserEnroll extends TestClient {
}
/**
- * Set Certificat Type for which you want to submit a request . Valid values - "ca"/"ra"/"ocsp"
+ * Set Certificat Type for which you want to submit a request . Valid values
+ * - "ca"/"ra"/"ocsp"
*/
public void setCertType(String ct) {
certType = ct;
@@ -162,20 +168,22 @@ public class UserEnroll extends TestClient {
public boolean enroll_load() {
buildquery();
setStatusString("");
- return(Send());
+ return (Send());
}
private boolean pkcs10() {
- System.out.println(" In pkcs10 Keysize , key type " + keysize + keytype);
- // ComCrypto cCrypt = new ComCrypto(cdir,tokenpwd,certnickname,keysize,keytype);
+ System.out.println(" In pkcs10 Keysize , key type " + keysize
+ + keytype);
+ // ComCrypto cCrypt = new
+ // ComCrypto(cdir,tokenpwd,certnickname,keysize,keytype);
cCrypt.setCertDir(cdir);
cCrypt.setCertnickname(adminCertName);
cCrypt.setKeySize(keysize);
cCrypt.setKeyType(keytype);
cCrypt.setTokenPWD(tokenpwd);
cCrypt.setDebug(true);
- if (pkcs10request != null) {
+ if (pkcs10request != null) {
cCrypt.setGenerateRequest(false);
cCrypt.loginDB();
} else {
@@ -194,12 +202,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);
}
@@ -226,7 +234,7 @@ public class UserEnroll extends TestClient {
try {
- if (debug) {
+ if (debug) {
System.out.println("Step 3 : Socket initialize");
}
@@ -253,8 +261,8 @@ public class UserEnroll extends TestClient {
ps.println("\r");
ps.flush();
os.flush();
- BufferedReader stdin = new BufferedReader(
- new InputStreamReader(socket.getInputStream()));
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(
+ socket.getInputStream()));
if (debug) {
System.out.println("Step 4: Received the page");
@@ -270,9 +278,10 @@ public class UserEnroll extends TestClient {
st = true;
}
if (line.indexOf("fixed.requestId = ") != -1) {
- requestId = line.substring("fixed.requestId = ".length() + 1,
+ requestId = line.substring(
+ "fixed.requestId = ".length() + 1,
line.indexOf(";") - 1);
- }
+ }
if (getError(line)) {
st = false;
@@ -300,7 +309,7 @@ public class UserEnroll extends TestClient {
}
return st;
-
+
}
private void buildquery() {
@@ -335,12 +344,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));
}
@@ -348,7 +357,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);
@@ -366,8 +375,10 @@ public class UserEnroll extends TestClient {
queryStrBuf.append("&OU=");
queryStrBuf.append(OU);
}
- // if(O.length() > 0) { queryStrBuf.append("&O=");queryStrBuf.append(O);}
- // if(C.length() >0) { queryStrBuf.append("&C=");queryStrBuf.append(C);}
+ // if(O.length() > 0) {
+ // queryStrBuf.append("&O=");queryStrBuf.append(O);}
+ // if(C.length() >0) {
+ // queryStrBuf.append("&C=");queryStrBuf.append(C);}
System.out.println("buidlquery client dn ");
queryStrBuf.append("&subject=");
queryStrBuf.append(URLEncoder.encode(DN));
@@ -416,7 +427,7 @@ public class UserEnroll extends TestClient {
query = queryStrBuf.toString();
System.out.println(query);
- queryStrBuf = null;
+ queryStrBuf = null;
}
public int getRequestId() {
@@ -434,16 +445,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() {
@@ -452,8 +463,8 @@ public class UserEnroll extends TestClient {
try {
getProperties(propfileName);
} catch (Exception e) {
- System.out.println(
- "exception reading Properties File " + e.getMessage());
+ System.out.println("exception reading Properties File "
+ + e.getMessage());
return false;
}
@@ -497,12 +508,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[]) {
@@ -510,33 +521,33 @@ public class UserEnroll extends TestClient {
// - requestId Pass
boolean st;
- UserEnroll e = new UserEnroll("jupiter2", "1027",
- "E=test,cn=test,uid=test", "test", "test", "test", "t1", "t",
+ UserEnroll e = new UserEnroll(
+ "jupiter2",
+ "1027",
+ "E=test,cn=test,uid=test",
+ "test",
+ "test",
+ "test",
+ "t1",
+ "t",
"/u/lgopal/work/tetCMS/ns/tetframework/testcases/CMS/6.0/acceptanceJava/data/certdb",
"secret12", "true", "1024", "RSA", "rn", "re", "client");
e.clientCertEnroll();
-
- /* if ( args.length < 1)
- {
- System.out.println("Usage : propertiesfile");
- System.exit(0);
- }
-
-
- UserEnroll t = new UserEnroll(args[0]);
- st=t.enroll();
- if (st){
- System.out.println("User Enrolled successfully . RequestId is "+t.getrequestId());
- System.exit(t.getRequestId());
- }
- else{
-
- System.out.println("Error: " + t.getErrorDetail());
- System.exit(0);
- }
+
+ /*
+ * if ( args.length < 1) { System.out.println("Usage : propertiesfile");
+ * System.exit(0); }
+ *
+ *
+ * UserEnroll t = new UserEnroll(args[0]); st=t.enroll(); if (st){
+ * System
+ * .out.println("User Enrolled successfully . RequestId is "+t.getrequestId
+ * ()); System.exit(t.getRequestId()); } else{
+ *
+ * System.out.println("Error: " + t.getErrorDetail()); System.exit(0); }
*/
}// end of function main
-} // end of class
+} // end of class
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 192ba0564..5a0b3b857 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
@@ -84,7 +85,7 @@ public class Utilities {
StringBuffer buf = new StringBuffer();
int end = token.length();
int begin = 0;
-
+
if (token.endsWith(";")) {
end--;
}
@@ -159,10 +160,8 @@ public class Utilities {
}
/*
- * format of the file should be like this:
- * -----BEGIN CERTIFICATE-----
- * base64 encoded certificate
- * -----END CERTIFICATE-----
+ * format of the file should be like this: -----BEGIN CERTIFICATE-----
+ * base64 encoded certificate -----END CERTIFICATE-----
*/
public String getcertfromfile(String filename) {
StringBuffer tempBuffer = new StringBuffer();
@@ -180,7 +179,7 @@ public class Utilities {
}
tempBuffer.append(temp);
}
-
+
return tempBuffer.toString();
} catch (Exception e) {
System.out.println("ERROR: getcertfromfile" + e.toString());
@@ -203,17 +202,15 @@ public class Utilities {
}
return tempBuffer.toString();
} catch (Exception e) {
- System.out.println(
- "ERROR: getcertfromfile_withheaders" + e.toString());
+ System.out.println("ERROR: getcertfromfile_withheaders"
+ + e.toString());
return null;
}
}
/*
- * format of the file should be like this:
- * -----BEGIN CERTIFICATE REVOCATION LIST-----
- * base64 encoded CRL
- * -----END CERTIFICATE REVOCATION LIST-----
+ * format of the file should be like this: -----BEGIN CERTIFICATE REVOCATION
+ * LIST----- base64 encoded CRL -----END CERTIFICATE REVOCATION LIST-----
*/
public String getcrlfromfile(String filename) {
StringBuffer tempBuffer = new StringBuffer();
@@ -227,7 +224,7 @@ public class Utilities {
tempBuffer.append(temp);
}
-
+
return tempBuffer.toString();
} catch (Exception e) {
System.out.println("ERROR: getcrlfromfile" + e.toString());
@@ -237,10 +234,8 @@ public class Utilities {
}
/*
- * format of the file should be like this:
- * -----BEGIN CERTIFICATE-----
- * base64 encoded certificate
- * -----END CERTIFICATE-----
+ * format of the file should be like this: -----BEGIN CERTIFICATE-----
+ * base64 encoded certificate -----END CERTIFICATE-----
*/
public String getcafromfile(String filename) {
StringBuffer tempBuffer = new StringBuffer();
@@ -254,7 +249,7 @@ public class Utilities {
tempBuffer.append(temp);
}
-
+
return tempBuffer.toString();
} catch (Exception e) {
System.out.println("ERROR: getcafromfile" + e.toString());
@@ -264,12 +259,12 @@ public class Utilities {
}
/*
- * function for RFC 2254. converts a x509 certificate given as
- * a binary array[] to a Ldap filter string
+ * function for RFC 2254. converts a x509 certificate given as a binary
+ * array[] to a Ldap filter string
*/
public static String escapeBinaryData(byte data[]) {
String result = "";
-
+
for (int i = 0; i < data.length; i++) {
String s = Integer.toHexString((int) (0xff & data[i]));
@@ -314,23 +309,25 @@ public class Utilities {
X509CertInfo certinfo = (X509CertInfo) x509_cert.get("x509.INFO");
/* Get Serial Number */
- CertificateSerialNumber csn = (CertificateSerialNumber)
- certinfo.get(X509CertInfo.SERIAL_NUMBER);
+ CertificateSerialNumber csn = (CertificateSerialNumber) certinfo
+ .get(X509CertInfo.SERIAL_NUMBER);
SerialNumber sn = (SerialNumber) csn.get("NUMBER");
- // just adding serialnumber for add.
- // we can add mode here like subject name, extensions,issuer to this record.
+ // just adding serialnumber for add.
+ // we can add mode here like subject name, extensions,issuer to this
+ // record.
cr.serialNumber = sn.getNumber().toString().trim();
/* Get Subject Name */
- CertificateSubjectName csn1 = (CertificateSubjectName)
- certinfo.get(X509CertInfo.SUBJECT);
+ CertificateSubjectName csn1 = (CertificateSubjectName) certinfo
+ .get(X509CertInfo.SUBJECT);
@SuppressWarnings("unchecked")
- Enumeration<String> en = csn1.getElements();
+ Enumeration<String> en = csn1.getElements();
- X500Name dname = (X500Name) csn1.get(CertificateSubjectName.DN_NAME);
+ X500Name dname = (X500Name) csn1
+ .get(CertificateSubjectName.DN_NAME);
String pp = "";
RDN[] rdns = dname.getNames();
@@ -342,7 +339,8 @@ public class Utilities {
cr.subject = pp;
} catch (Exception e) {
- System.out.println("ERROR: Exception when decoding certificate=" + e);
+ System.out.println("ERROR: Exception when decoding certificate="
+ + e);
e.printStackTrace();
return null;
}
@@ -351,7 +349,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 f2a71085e..11eec6d43 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,23 +29,23 @@ 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>
+ * 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>
*/
-
public class checkRequest extends TestClient {
private int i;
- private String certfile, importcert = "false", certnickname, serialNumber, ldapformat;
+ private String certfile, importcert = "false", certnickname, serialNumber,
+ ldapformat;
private String requestId;
private String reqStatus = "false";
- private String pkcsCert, baseCert, ACTION_STRING, issuer, subject, AUTH = "ca";
+ private String pkcsCert, baseCert, ACTION_STRING, issuer, subject,
+ AUTH = "ca";
private int port;
private boolean impStatus = false;
private int type = 1;
@@ -57,32 +57,32 @@ public class checkRequest extends TestClient {
private String tokenpwd;
private String cdir;
- // public methods
+ // public methods
/**
* 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,12 +94,14 @@ 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) {
+ public checkRequest(String hs, String pt, String certdir,
+ String certtokenpwd, String seqnum, String nickname, String impc) {
host = hs;
ports = pt;
cdir = certdir;
@@ -158,11 +160,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;
}
@@ -170,7 +171,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));
@@ -193,9 +194,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;
}
@@ -247,11 +248,11 @@ public class checkRequest extends TestClient {
System.out.println(query);
}
setStatusString("Congratulations, your certificate has been issued");
- return(Send());
+ return (Send());
}
- // Private functions
+ // Private functions
private void setElapsedTime(long dif) {
elapsedTime = dif;
@@ -285,12 +286,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);
@@ -299,21 +300,21 @@ public class checkRequest extends TestClient {
fos.close();
}
-
+
} catch (Exception e) {
- System.out.println(
- "exception in writeCert2File: " + e.getMessage());
+ 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;
}
@@ -329,8 +330,8 @@ public class checkRequest extends TestClient {
+ "-----END CERTIFICATE-----";
if (debug) {
- System.out.println(
- "importing cert" + tmp + "certnick" + certnickname);
+ System.out.println("importing cert" + tmp + "certnick"
+ + certnickname);
}
s = tmp;
}
@@ -343,8 +344,8 @@ public class checkRequest extends TestClient {
return false;
} catch (Exception e) {
- System.out.println(
- "exception importing cert crequest" + e.getMessage());
+ System.out.println("exception importing cert crequest"
+ + e.getMessage());
return false;
}
@@ -366,7 +367,8 @@ public class checkRequest extends TestClient {
}
if (line.indexOf("header.pkcs7ChainBase64 = ") != -1) {
// if status is complete retrieve cert
- pkcsCert = line.substring("header.pkcs7ChainBase64 = ".length() + 1,
+ pkcsCert = line.substring(
+ "header.pkcs7ChainBase64 = ".length() + 1,
line.indexOf(";", 10) - 1);
}
if (line.indexOf("record.serialNumber=") != -1) {
@@ -393,9 +395,9 @@ public class checkRequest extends TestClient {
boolean st = true;
- String retriveStr[] = {
- "record.base64Cert=", "record.certPrettyPrint=",
- "header.certChainBase64 = ", "header.certPrettyPrint = "};
+ String retriveStr[] = { "record.base64Cert=",
+ "record.certPrettyPrint=", "header.certChainBase64 = ",
+ "header.certPrettyPrint = " };
String baseCertStr, certPrettyprintStr;
if (AUTH.equals("ra")) {
@@ -405,19 +407,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) {
@@ -478,8 +480,8 @@ public class checkRequest extends TestClient {
ps.println("\r");
ps.flush();
os.flush();
- BufferedReader stdin = new BufferedReader(
- new InputStreamReader(socket.getInputStream()));
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(
+ socket.getInputStream()));
if (debug) {
System.out.println("Step 4: Received the page");
@@ -489,9 +491,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:
@@ -502,7 +504,7 @@ public class checkRequest extends TestClient {
System.out.println("invalid format");
}
-
+
}
stdin.close();
socket.close();
@@ -531,9 +533,9 @@ public class checkRequest extends TestClient {
if (debug) {
System.out.println(serialNumber);
}
-
+
return st;
-
+
}
private void buildquery() {
@@ -541,7 +543,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");
@@ -574,8 +576,8 @@ public class checkRequest extends TestClient {
try {
getProperties(propfileName);
} catch (Exception e) {
- System.out.println(
- "exception reading Properties File " + e.getMessage());
+ System.out.println("exception reading Properties File "
+ + e.getMessage());
return false;
}
@@ -606,23 +608,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 {
@@ -633,5 +635,5 @@ public class checkRequest extends TestClient {
}
}// end of function main
-} // end of class
+} // end of class