summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/selftests
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/selftests')
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/ASelfTest.java93
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/ca/CAPresence.java198
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/ca/CAValidity.java202
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/common/SystemCertsVerification.java170
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/kra/KRAPresence.java191
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPPresence.java219
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPValidity.java217
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/ra/RAPresence.java192
-rw-r--r--pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java210
9 files changed, 668 insertions, 1024 deletions
diff --git a/pki/base/common/src/com/netscape/cms/selftests/ASelfTest.java b/pki/base/common/src/com/netscape/cms/selftests/ASelfTest.java
index df7f02bca..bc9a5b75c 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/ASelfTest.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/ASelfTest.java
@@ -20,7 +20,6 @@
package com.netscape.cms.selftests;
-
///////////////////////
// import statements //
///////////////////////
@@ -37,7 +36,6 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTest;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
-
//////////////////////
// class definition //
//////////////////////
@@ -50,17 +48,14 @@ import com.netscape.certsrv.selftests.ISelfTestSubsystem;
* @author thomask
* @version $Revision$, $Date$
*/
-public abstract class ASelfTest
- implements ISelfTest {
- ////////////////////////
+public abstract class ASelfTest implements ISelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
-
+ // //////////////////////
- //////////////////////////
+ // ////////////////////////
// ISelfTest parameters //
- //////////////////////////
+ // ////////////////////////
// parameter information
private static final String SELF_TEST_NAME = "ASelfTest";
@@ -71,34 +66,29 @@ public abstract class ASelfTest
protected IConfigStore mConfig = null;
protected String mPrefix = null;
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
+ // ///////////////////
-
-
- ///////////////////////
+ // /////////////////////
// ISelfTest methods //
- ///////////////////////
+ // /////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest(ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters)
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException {
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
// store individual self test class values for this instance
mSelfTestSubsystem = (ISelfTestSubsystem) subsystem;
@@ -107,10 +97,9 @@ public abstract class ASelfTest
if (instanceName != null) {
instanceName = instanceName.trim();
} else {
- mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_PARAMETER_WAS_NULL",
- SELF_TEST_NAME));
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_PARAMETER_WAS_NULL",
+ SELF_TEST_NAME));
throw new EMissingSelfTestException();
}
@@ -123,15 +112,13 @@ public abstract class ASelfTest
mConfig = parameters.getSubStore(pluginPath);
- if ((mConfig != null) &&
- (mConfig.getName() != null) &&
- (mConfig.getName() != "")) {
+ if ((mConfig != null) && (mConfig.getName() != null)
+ && (mConfig.getName() != "")) {
mPrefix = mConfig.getName().trim();
} else {
- mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_PARAMETER_WAS_NULL",
- SELF_TEST_NAME));
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_PARAMETER_WAS_NULL",
+ SELF_TEST_NAME));
throw new EMissingSelfTestException();
}
@@ -142,24 +129,23 @@ public abstract class ASelfTest
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public abstract void startupSelfTest()
- throws ESelfTestException;
+ public abstract void startupSelfTest() throws ESelfTestException;
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
public abstract void shutdownSelfTest();
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
public String getSelfTestName() {
@@ -167,10 +153,10 @@ public abstract class ASelfTest
}
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
public IConfigStore getSelfTestConfigStore() {
@@ -178,10 +164,10 @@ public abstract class ASelfTest
}
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
@@ -190,11 +176,10 @@ public abstract class ASelfTest
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
public abstract void runSelfTest(ILogEventListener logger)
- throws ESelfTestException;
+ throws ESelfTestException;
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/ca/CAPresence.java b/pki/base/common/src/com/netscape/cms/selftests/ca/CAPresence.java
index cf3338ef4..edbac11bb 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/ca/CAPresence.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/ca/CAPresence.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.ca;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -44,8 +42,6 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
-
-
//////////////////////
// class definition //
//////////////////////
@@ -58,84 +54,63 @@ import com.netscape.cms.selftests.ASelfTest;
* @author thomask
* @version $Revision$, $Date$
*/
-public class CAPresence
-extends ASelfTest
-{
- ////////////////////////
+public class CAPresence extends ASelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
+ // //////////////////////
-
- ///////////////////////////
+ // /////////////////////////
// CAPresence parameters //
- ///////////////////////////
+ // /////////////////////////
// parameter information
public static final String PROP_CA_SUB_ID = "CaSubId";
- private String mCaSubId = null;
-
-
+ private String mCaSubId = null;
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
-
+ // ///////////////////
- ////////////////////////
+ // //////////////////////
// CAPresence methods //
- ////////////////////////
+ // //////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest( ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters )
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
- super.initSelfTest( subsystem, instanceName, parameters );
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
+ super.initSelfTest(subsystem, instanceName, parameters);
// retrieve mandatory parameter(s)
try {
- mCaSubId = mConfig.getString( PROP_CA_SUB_ID );
- if( mCaSubId != null ) {
+ mCaSubId = mConfig.getString(PROP_CA_SUB_ID);
+ if (mCaSubId != null) {
mCaSubId = mCaSubId.trim();
} else {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_VALUES",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_CA_SUB_ID ) );
-
- throw new EMissingSelfTestException( PROP_CA_SUB_ID );
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
+ CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "."
+ + PROP_CA_SUB_ID));
+
+ throw new EMissingSelfTestException(PROP_CA_SUB_ID);
}
- } catch( EBaseException e ) {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_NAME",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_CA_SUB_ID ) );
-
- throw new EMissingSelfTestException( mPrefix,
- PROP_CA_SUB_ID,
- null );
+ } catch (EBaseException e) {
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + PROP_CA_SUB_ID));
+
+ throw new EMissingSelfTestException(mPrefix, PROP_CA_SUB_ID, null);
}
// retrieve optional parameter(s)
@@ -143,145 +118,124 @@ extends ASelfTest
return;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage( locale,
- "CMS_SELFTESTS_CA_PRESENCE_DESCRIPTION" );
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_CA_PRESENCE_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest( ILogEventListener logger )
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
ICertificateAuthority ca = null;
X509CertImpl caCert = null;
X509Key caPubKey = null;
- ca = ( ICertificateAuthority ) CMS.getSubsystem( mCaSubId );
+ ca = (ICertificateAuthority) CMS.getSubsystem(mCaSubId);
- if( ca == null ) {
+ if (ca == null) {
// log that the CA is not installed
- logMessage = CMS.getLogMessage( "SELFTESTS_CA_IS_NOT_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_CA_IS_NOT_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
} else {
// Retrieve the CA certificate
caCert = ca.getCACert();
- if( caCert == null ) {
+ if (caCert == null) {
// log that the CA is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_CA_IS_NOT_INITIALIZED",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_CA_IS_NOT_INITIALIZED", getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// Retrieve the CA certificate public key
try {
- caPubKey = ( X509Key ) caCert.get( X509CertImpl.PUBLIC_KEY );
+ caPubKey = (X509Key) caCert.get(X509CertImpl.PUBLIC_KEY);
- if( caPubKey == null ) {
+ if (caPubKey == null) {
// log that something is seriously wrong with the CA
- logMessage = CMS.getLogMessage( "SELFTESTS_CA_IS_CORRUPT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_CA_IS_CORRUPT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
- } catch( CertificateParsingException e ) {
+ } catch (CertificateParsingException e) {
// log that something is seriously wrong with the CA
- mSelfTestSubsystem.log( logger,
- e.toString() );
+ mSelfTestSubsystem.log(logger, e.toString());
- throw new ESelfTestException( e.toString() );
+ throw new ESelfTestException(e.toString());
}
// log that the CA is present
- logMessage = CMS.getLogMessage( "SELFTESTS_CA_IS_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_CA_IS_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
}
return;
}
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/ca/CAValidity.java b/pki/base/common/src/com/netscape/cms/selftests/ca/CAValidity.java
index cff35ce57..c2072dbbb 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/ca/CAValidity.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/ca/CAValidity.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.ca;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -44,98 +42,75 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
-
-
//////////////////////
// class definition //
//////////////////////
/**
- * This class implements a self test to check the validity of the CA.
+ * This class implements a self test to check the validity of the CA.
* <P>
*
* @author mharmsen
* @author thomask
* @version $Revision$, $Date$
*/
-public class CAValidity
-extends ASelfTest
-{
- ////////////////////////
+public class CAValidity extends ASelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
+ // //////////////////////
-
- ///////////////////////////
+ // /////////////////////////
// CAValidity parameters //
- ///////////////////////////
+ // /////////////////////////
// parameter information
public static final String PROP_CA_SUB_ID = "CaSubId";
- private String mCaSubId = null;
-
-
+ private String mCaSubId = null;
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
-
+ // ///////////////////
- ////////////////////////
+ // //////////////////////
// CAValidity methods //
- ////////////////////////
+ // //////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest( ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters )
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
- super.initSelfTest( subsystem, instanceName, parameters );
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
+ super.initSelfTest(subsystem, instanceName, parameters);
// retrieve mandatory parameter(s)
try {
- mCaSubId = mConfig.getString( PROP_CA_SUB_ID );
- if( mCaSubId != null ) {
+ mCaSubId = mConfig.getString(PROP_CA_SUB_ID);
+ if (mCaSubId != null) {
mCaSubId = mCaSubId.trim();
} else {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_VALUES",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_CA_SUB_ID ) );
-
- throw new EMissingSelfTestException( PROP_CA_SUB_ID );
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
+ CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "."
+ + PROP_CA_SUB_ID));
+
+ throw new EMissingSelfTestException(PROP_CA_SUB_ID);
}
- } catch( EBaseException e ) {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_NAME",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_CA_SUB_ID ) );
-
- throw new EMissingSelfTestException( mPrefix,
- PROP_CA_SUB_ID,
- null );
+ } catch (EBaseException e) {
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + PROP_CA_SUB_ID));
+
+ throw new EMissingSelfTestException(mPrefix, PROP_CA_SUB_ID, null);
}
// retrieve optional parameter(s)
@@ -143,145 +118,124 @@ extends ASelfTest
return;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage( locale,
- "CMS_SELFTESTS_CA_VALIDITY_DESCRIPTION" );
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_CA_VALIDITY_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest( ILogEventListener logger )
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
ICertificateAuthority ca = null;
X509CertImpl caCert = null;
- ca = ( ICertificateAuthority ) CMS.getSubsystem( mCaSubId );
+ ca = (ICertificateAuthority) CMS.getSubsystem(mCaSubId);
- if( ca == null ) {
+ if (ca == null) {
// log that the CA is not installed
- logMessage = CMS.getLogMessage( "SELFTESTS_CA_IS_NOT_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_CA_IS_NOT_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
} else {
// Retrieve the CA certificate
caCert = ca.getCACert();
- if( caCert == null ) {
+ if (caCert == null) {
// log that the CA is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_CA_IS_NOT_INITIALIZED",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_CA_IS_NOT_INITIALIZED", getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// Retrieve the CA validity period
try {
caCert.checkValidity();
- } catch( CertificateNotYetValidException e ) {
+ } catch (CertificateNotYetValidException e) {
// log that the CA is not yet valid
- logMessage = CMS.getLogMessage( "SELFTESTS_CA_IS_NOT_YET_VALID",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_CA_IS_NOT_YET_VALID",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
- } catch( CertificateExpiredException e ) {
+ throw new ESelfTestException(logMessage);
+ } catch (CertificateExpiredException e) {
// log that the CA is expired
- logMessage = CMS.getLogMessage( "SELFTESTS_CA_IS_EXPIRED",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_CA_IS_EXPIRED",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// log that the CA is valid
- logMessage = CMS.getLogMessage( "SELFTESTS_CA_IS_VALID",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_CA_IS_VALID",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
}
return;
}
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/common/SystemCertsVerification.java b/pki/base/common/src/com/netscape/cms/selftests/common/SystemCertsVerification.java
index b3388d9e1..b0e943c16 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/common/SystemCertsVerification.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/common/SystemCertsVerification.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.common;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -39,97 +37,74 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
-
-
//////////////////////
// class definition //
//////////////////////
/**
- * This class implements a self test to check the system certs
- * of the subsystem
+ * This class implements a self test to check the system certs of the subsystem
* <P>
*
- * @version $Revision: $, $Date: $
+ * @version $Revision: $, $Date: $
*/
-public class SystemCertsVerification
-extends ASelfTest
-{
- ////////////////////////
+public class SystemCertsVerification extends ASelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
+ // //////////////////////
-
- ///////////////////////////
+ // /////////////////////////
// SystemCertsVerification parameters //
- ///////////////////////////
+ // /////////////////////////
// parameter information
public static final String PROP_SUB_ID = "SubId";
- private String mSubId = null;
-
-
+ private String mSubId = null;
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
-
+ // ///////////////////
- ////////////////////////
+ // //////////////////////
// SystemCertsVerification methods //
- ////////////////////////
+ // //////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest( ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters )
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
- super.initSelfTest( subsystem, instanceName, parameters );
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
+ super.initSelfTest(subsystem, instanceName, parameters);
// retrieve mandatory parameter(s)
try {
- mSubId = mConfig.getString( PROP_SUB_ID );
- if( mSubId != null ) {
+ mSubId = mConfig.getString(PROP_SUB_ID);
+ if (mSubId != null) {
mSubId = mSubId.trim();
} else {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_VALUES",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_SUB_ID ) );
-
- throw new EMissingSelfTestException( PROP_SUB_ID );
+ mSelfTestSubsystem
+ .log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "."
+ + PROP_SUB_ID));
+
+ throw new EMissingSelfTestException(PROP_SUB_ID);
}
- } catch( EBaseException e ) {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_NAME",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_SUB_ID ) );
-
- throw new EMissingSelfTestException( mPrefix,
- PROP_SUB_ID,
- null );
+ } catch (EBaseException e) {
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + PROP_SUB_ID));
+
+ throw new EMissingSelfTestException(mPrefix, PROP_SUB_ID, null);
}
// retrieve optional parameter(s)
@@ -137,102 +112,87 @@ extends ASelfTest
return;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage( locale,
- "CMS_SELFTESTS_SYSTEM_CERTS_VERIFICATION_DESCRIPTION" );
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_SYSTEM_CERTS_VERIFICATION_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest( ILogEventListener logger )
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
boolean rc = false;
rc = CMS.verifySystemCerts();
if (rc == true) {
- logMessage = CMS.getLogMessage( "SELFTESTS_COMMON_SYSTEM_CERTS_VERIFICATION_SUCCESS",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_COMMON_SYSTEM_CERTS_VERIFICATION_SUCCESS",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
} else {
- logMessage = CMS.getLogMessage( "SELFTESTS_COMMON_SYSTEM_CERTS_VERIFICATION_FAILURE",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_COMMON_SYSTEM_CERTS_VERIFICATION_FAILURE",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
- throw new ESelfTestException( logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
+ throw new ESelfTestException(logMessage);
}
return;
}
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/kra/KRAPresence.java b/pki/base/common/src/com/netscape/cms/selftests/kra/KRAPresence.java
index 52255e24c..e90072c0d 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/kra/KRAPresence.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/kra/KRAPresence.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.kra;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -41,8 +39,6 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
-
-
//////////////////////
// class definition //
//////////////////////
@@ -55,84 +51,63 @@ import com.netscape.cms.selftests.ASelfTest;
* @author thomask
* @version $Revision$, $Date$
*/
-public class KRAPresence
-extends ASelfTest
-{
- ////////////////////////
+public class KRAPresence extends ASelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
+ // //////////////////////
-
- ///////////////////////////
+ // /////////////////////////
// KRAPresence parameters //
- ///////////////////////////
+ // /////////////////////////
// parameter information
public static final String PROP_KRA_SUB_ID = "SubId";
- private String mSubId = null;
-
-
+ private String mSubId = null;
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
-
+ // ///////////////////
- ////////////////////////
+ // //////////////////////
// KRAPresence methods //
- ////////////////////////
+ // //////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest( ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters )
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
- super.initSelfTest( subsystem, instanceName, parameters );
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
+ super.initSelfTest(subsystem, instanceName, parameters);
// retrieve mandatory parameter(s)
try {
- mSubId = mConfig.getString( PROP_KRA_SUB_ID );
- if( mSubId != null ) {
+ mSubId = mConfig.getString(PROP_KRA_SUB_ID);
+ if (mSubId != null) {
mSubId = mSubId.trim();
} else {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_VALUES",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_KRA_SUB_ID ) );
-
- throw new EMissingSelfTestException( PROP_KRA_SUB_ID );
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
+ CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "."
+ + PROP_KRA_SUB_ID));
+
+ throw new EMissingSelfTestException(PROP_KRA_SUB_ID);
}
- } catch( EBaseException e ) {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_NAME",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_KRA_SUB_ID ) );
-
- throw new EMissingSelfTestException( mPrefix,
- PROP_KRA_SUB_ID,
- null );
+ } catch (EBaseException e) {
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + PROP_KRA_SUB_ID));
+
+ throw new EMissingSelfTestException(mPrefix, PROP_KRA_SUB_ID, null);
}
// retrieve optional parameter(s)
@@ -140,137 +115,117 @@ extends ASelfTest
return;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage( locale,
- "CMS_SELFTESTS_KRA_PRESENCE_DESCRIPTION" );
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_KRA_PRESENCE_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest( ILogEventListener logger )
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
IKeyRecoveryAuthority kra = null;
org.mozilla.jss.crypto.X509Certificate kraCert = null;
PublicKey kraPubKey = null;
- kra = ( IKeyRecoveryAuthority ) CMS.getSubsystem( mSubId );
+ kra = (IKeyRecoveryAuthority) CMS.getSubsystem(mSubId);
- if( kra == null ) {
+ if (kra == null) {
// log that the KRA is not installed
- logMessage = CMS.getLogMessage( "SELFTESTS_KRA_IS_NOT_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_KRA_IS_NOT_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
} else {
// Retrieve the KRA certificate
kraCert = kra.getTransportCert();
- if( kraCert == null ) {
+ if (kraCert == null) {
// log that the RA is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_KRA_IS_NOT_INITIALIZED",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_KRA_IS_NOT_INITIALIZED", getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// Retrieve the KRA certificate public key
- kraPubKey = ( PublicKey ) kraCert.getPublicKey();
+ kraPubKey = (PublicKey) kraCert.getPublicKey();
- if( kraPubKey == null ) {
+ if (kraPubKey == null) {
// log that something is seriously wrong with the KRA
- logMessage = CMS.getLogMessage( "SELFTESTS_KRA_IS_CORRUPT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_KRA_IS_CORRUPT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// log that the KRA is present
- logMessage = CMS.getLogMessage( "SELFTESTS_KRA_IS_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_KRA_IS_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
}
return;
}
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPPresence.java b/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPPresence.java
index 507148bd5..b8f48b4a2 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPPresence.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPPresence.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.ocsp;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -45,8 +43,6 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
-
-
//////////////////////
// class definition //
//////////////////////
@@ -59,84 +55,63 @@ import com.netscape.cms.selftests.ASelfTest;
* @author thomask
* @version $Revision$, $Date$
*/
-public class OCSPPresence
-extends ASelfTest
-{
- ////////////////////////
+public class OCSPPresence extends ASelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
-
+ // //////////////////////
- /////////////////////////////
+ // ///////////////////////////
// OCSPPresence parameters //
- /////////////////////////////
+ // ///////////////////////////
// parameter information
public static final String PROP_OCSP_SUB_ID = "OcspSubId";
- private String mOcspSubId = null;
+ private String mOcspSubId = null;
-
-
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
+ // ///////////////////
-
- //////////////////////////
+ // ////////////////////////
// OCSPPresence methods //
- //////////////////////////
+ // ////////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest( ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters )
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
- super.initSelfTest( subsystem, instanceName, parameters );
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
+ super.initSelfTest(subsystem, instanceName, parameters);
// retrieve mandatory parameter(s)
try {
- mOcspSubId = mConfig.getString( PROP_OCSP_SUB_ID );
- if( mOcspSubId != null ) {
+ mOcspSubId = mConfig.getString(PROP_OCSP_SUB_ID);
+ if (mOcspSubId != null) {
mOcspSubId = mOcspSubId.trim();
} else {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_VALUES",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_OCSP_SUB_ID ) );
-
- throw new EMissingSelfTestException( PROP_OCSP_SUB_ID );
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
+ CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "."
+ + PROP_OCSP_SUB_ID));
+
+ throw new EMissingSelfTestException(PROP_OCSP_SUB_ID);
}
- } catch( EBaseException e ) {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_NAME",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_OCSP_SUB_ID ) );
-
- throw new EMissingSelfTestException( mPrefix,
- PROP_OCSP_SUB_ID,
- null );
+ } catch (EBaseException e) {
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + PROP_OCSP_SUB_ID));
+
+ throw new EMissingSelfTestException(mPrefix, PROP_OCSP_SUB_ID, null);
}
// retrieve optional parameter(s)
@@ -144,162 +119,138 @@ extends ASelfTest
return;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage( locale,
- "CMS_SELFTESTS_OCSP_PRESENCE_DESCRIPTION" );
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_OCSP_PRESENCE_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest( ILogEventListener logger )
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
IOCSPAuthority ocsp = null;
ISigningUnit ocspSigningUnit = null;
X509CertImpl ocspCert = null;
X509Key ocspPubKey = null;
- ocsp = ( IOCSPAuthority ) CMS.getSubsystem( mOcspSubId );
+ ocsp = (IOCSPAuthority) CMS.getSubsystem(mOcspSubId);
- if( ocsp == null ) {
+ if (ocsp == null) {
// log that the OCSP is not installed
- logMessage = CMS.getLogMessage( "SELFTESTS_OCSP_IS_NOT_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_OCSP_IS_NOT_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
} else {
// Retrieve the OCSP signing unit
ocspSigningUnit = ocsp.getSigningUnit();
- if( ocspSigningUnit == null ) {
+ if (ocspSigningUnit == null) {
// log that the OCSP is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_OCSP_IS_NOT_INITIALIZED",
- getSelfTestName() );
-
- mSelfTestSubsystem.log( logger,
- logMessage );
-
- throw new ESelfTestException( logMessage );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_OCSP_IS_NOT_INITIALIZED", getSelfTestName());
+
+ mSelfTestSubsystem.log(logger, logMessage);
+
+ throw new ESelfTestException(logMessage);
}
// Retrieve the OCSP certificate
ocspCert = ocspSigningUnit.getCertImpl();
- if( ocspCert == null ) {
+ if (ocspCert == null) {
// log that the OCSP is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_OCSP_IS_NOT_INITIALIZED",
- getSelfTestName() );
-
- mSelfTestSubsystem.log( logger,
- logMessage );
-
- throw new ESelfTestException( logMessage );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_OCSP_IS_NOT_INITIALIZED", getSelfTestName());
+
+ mSelfTestSubsystem.log(logger, logMessage);
+
+ throw new ESelfTestException(logMessage);
}
// Retrieve the OCSP certificate public key
try {
- ocspPubKey = ( X509Key )
- ocspCert.get( X509CertImpl.PUBLIC_KEY );
+ ocspPubKey = (X509Key) ocspCert.get(X509CertImpl.PUBLIC_KEY);
- if( ocspPubKey == null ) {
+ if (ocspPubKey == null) {
// log that something is seriously wrong with the OCSP
- logMessage = CMS.getLogMessage( "SELFTESTS_OCSP_IS_CORRUPT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_OCSP_IS_CORRUPT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
- } catch( CertificateParsingException e ) {
+ } catch (CertificateParsingException e) {
// log that something is seriously wrong with the OCSP
- mSelfTestSubsystem.log( logger,
- e.toString() );
+ mSelfTestSubsystem.log(logger, e.toString());
- throw new ESelfTestException( e.toString() );
+ throw new ESelfTestException(e.toString());
}
// log that the OCSP is present
- logMessage = CMS.getLogMessage( "SELFTESTS_OCSP_IS_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_OCSP_IS_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
}
return;
}
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPValidity.java b/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPValidity.java
index e6516b2a6..089f2ba32 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPValidity.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/ocsp/OCSPValidity.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.ocsp;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -45,98 +43,75 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
-
-
//////////////////////
// class definition //
//////////////////////
/**
- * This class implements a self test to check the validity of the OCSP.
+ * This class implements a self test to check the validity of the OCSP.
* <P>
*
* @author mharmsen
* @author thomask
* @version $Revision$, $Date$
*/
-public class OCSPValidity
-extends ASelfTest
-{
- ////////////////////////
+public class OCSPValidity extends ASelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
-
+ // //////////////////////
- /////////////////////////////
+ // ///////////////////////////
// OCSPValidity parameters //
- /////////////////////////////
+ // ///////////////////////////
// parameter information
public static final String PROP_OCSP_SUB_ID = "OcspSubId";
- private String mOcspSubId = null;
+ private String mOcspSubId = null;
-
-
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
+ // ///////////////////
-
- //////////////////////////
+ // ////////////////////////
// OCSPValidity methods //
- //////////////////////////
+ // ////////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest( ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters )
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
- super.initSelfTest( subsystem, instanceName, parameters );
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
+ super.initSelfTest(subsystem, instanceName, parameters);
// retrieve mandatory parameter(s)
try {
- mOcspSubId = mConfig.getString( PROP_OCSP_SUB_ID );
- if( mOcspSubId != null ) {
+ mOcspSubId = mConfig.getString(PROP_OCSP_SUB_ID);
+ if (mOcspSubId != null) {
mOcspSubId = mOcspSubId.trim();
} else {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_VALUES",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_OCSP_SUB_ID ) );
-
- throw new EMissingSelfTestException( PROP_OCSP_SUB_ID );
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
+ CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "."
+ + PROP_OCSP_SUB_ID));
+
+ throw new EMissingSelfTestException(PROP_OCSP_SUB_ID);
}
- } catch( EBaseException e ) {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_NAME",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_OCSP_SUB_ID ) );
-
- throw new EMissingSelfTestException( mPrefix,
- PROP_OCSP_SUB_ID,
- null );
+ } catch (EBaseException e) {
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + PROP_OCSP_SUB_ID));
+
+ throw new EMissingSelfTestException(mPrefix, PROP_OCSP_SUB_ID, null);
}
// retrieve optional parameter(s)
@@ -144,162 +119,138 @@ extends ASelfTest
return;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage( locale,
- "CMS_SELFTESTS_OCSP_VALIDITY_DESCRIPTION" );
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_OCSP_VALIDITY_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest( ILogEventListener logger )
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
IOCSPAuthority ocsp = null;
ISigningUnit ocspSigningUnit = null;
X509CertImpl ocspCert = null;
- ocsp = ( IOCSPAuthority ) CMS.getSubsystem( mOcspSubId );
+ ocsp = (IOCSPAuthority) CMS.getSubsystem(mOcspSubId);
- if( ocsp == null ) {
+ if (ocsp == null) {
// log that the OCSP is not installed
- logMessage = CMS.getLogMessage( "SELFTESTS_OCSP_IS_NOT_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_OCSP_IS_NOT_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
} else {
// Retrieve the OCSP signing unit
ocspSigningUnit = ocsp.getSigningUnit();
- if( ocspSigningUnit == null ) {
+ if (ocspSigningUnit == null) {
// log that the OCSP is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_OCSP_IS_NOT_INITIALIZED",
- getSelfTestName() );
-
- mSelfTestSubsystem.log( logger,
- logMessage );
-
- throw new ESelfTestException( logMessage );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_OCSP_IS_NOT_INITIALIZED", getSelfTestName());
+
+ mSelfTestSubsystem.log(logger, logMessage);
+
+ throw new ESelfTestException(logMessage);
}
// Retrieve the OCSP certificate
ocspCert = ocspSigningUnit.getCertImpl();
- if( ocspCert == null ) {
+ if (ocspCert == null) {
// log that the OCSP is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_OCSP_IS_NOT_INITIALIZED",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_OCSP_IS_NOT_INITIALIZED", getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// Retrieve the OCSP validity period
try {
ocspCert.checkValidity();
- } catch( CertificateNotYetValidException e ) {
+ } catch (CertificateNotYetValidException e) {
// log that the OCSP is not yet valid
logMessage = CMS.getLogMessage(
- "SELFTESTS_OCSP_IS_NOT_YET_VALID",
- getSelfTestName() );
+ "SELFTESTS_OCSP_IS_NOT_YET_VALID", getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
- } catch( CertificateExpiredException e ) {
+ throw new ESelfTestException(logMessage);
+ } catch (CertificateExpiredException e) {
// log that the OCSP is expired
- logMessage = CMS.getLogMessage( "SELFTESTS_OCSP_IS_EXPIRED",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_OCSP_IS_EXPIRED",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// log that the OCSP is valid
- logMessage = CMS.getLogMessage( "SELFTESTS_OCSP_IS_VALID",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_OCSP_IS_VALID",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
}
return;
}
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/ra/RAPresence.java b/pki/base/common/src/com/netscape/cms/selftests/ra/RAPresence.java
index 1a8b4c3e7..55f921d2d 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/ra/RAPresence.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/ra/RAPresence.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.ra;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -41,8 +39,6 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
-
-
//////////////////////
// class definition //
//////////////////////
@@ -50,6 +46,7 @@ import com.netscape.cms.selftests.ASelfTest;
/**
* This class implements a self test to check for RA presence.
* <P>
+ *
* <PRE>
* NOTE: This self-test is for Registration Authorities prior to
* Netscape Certificate Management System 7.0. It does NOT
@@ -64,84 +61,63 @@ import com.netscape.cms.selftests.ASelfTest;
* @author thomask
* @version $Revision$, $Date$
*/
-public class RAPresence
-extends ASelfTest
-{
- ////////////////////////
+public class RAPresence extends ASelfTest {
+ // //////////////////////
// default parameters //
- ////////////////////////
+ // //////////////////////
-
-
- ///////////////////////////
+ // /////////////////////////
// RAPresence parameters //
- ///////////////////////////
+ // /////////////////////////
// parameter information
public static final String PROP_RA_SUB_ID = "RaSubId";
- private String mRaSubId = null;
-
+ private String mRaSubId = null;
-
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
+ // ///////////////////
-
- ////////////////////////
+ // //////////////////////
// RAPresence methods //
- ////////////////////////
+ // //////////////////////
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest( ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters )
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
- super.initSelfTest( subsystem, instanceName, parameters );
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
+ super.initSelfTest(subsystem, instanceName, parameters);
// retrieve mandatory parameter(s)
try {
- mRaSubId = mConfig.getString( PROP_RA_SUB_ID );
- if( mRaSubId != null ) {
+ mRaSubId = mConfig.getString(PROP_RA_SUB_ID);
+ if (mRaSubId != null) {
mRaSubId = mRaSubId.trim();
} else {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_VALUES",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_RA_SUB_ID ) );
-
- throw new EMissingSelfTestException( PROP_RA_SUB_ID );
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
+ CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "."
+ + PROP_RA_SUB_ID));
+
+ throw new EMissingSelfTestException(PROP_RA_SUB_ID);
}
- } catch( EBaseException e ) {
- mSelfTestSubsystem.log( mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage(
- "SELFTESTS_MISSING_NAME",
- getSelfTestName(),
- mPrefix
- + "."
- + PROP_RA_SUB_ID ) );
-
- throw new EMissingSelfTestException( mPrefix,
- PROP_RA_SUB_ID,
- null );
+ } catch (EBaseException e) {
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + PROP_RA_SUB_ID));
+
+ throw new EMissingSelfTestException(mPrefix, PROP_RA_SUB_ID, null);
}
// retrieve optional parameter(s)
@@ -149,137 +125,117 @@ extends ASelfTest
return;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage( locale,
- "CMS_SELFTESTS_RA_PRESENCE_DESCRIPTION" );
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_RA_PRESENCE_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest( ILogEventListener logger )
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
IRegistrationAuthority ra = null;
org.mozilla.jss.crypto.X509Certificate raCert = null;
PublicKey raPubKey = null;
- ra = ( IRegistrationAuthority ) CMS.getSubsystem( mRaSubId );
+ ra = (IRegistrationAuthority) CMS.getSubsystem(mRaSubId);
- if( ra == null ) {
+ if (ra == null) {
// log that the RA is not installed
- logMessage = CMS.getLogMessage( "SELFTESTS_RA_IS_NOT_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_RA_IS_NOT_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
} else {
// Retrieve the RA certificate
raCert = ra.getRACert();
- if( raCert == null ) {
+ if (raCert == null) {
// log that the RA is not yet initialized
- logMessage = CMS.getLogMessage(
- "SELFTESTS_RA_IS_NOT_INITIALIZED",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage(
+ "SELFTESTS_RA_IS_NOT_INITIALIZED", getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// Retrieve the RA certificate public key
- raPubKey = ( PublicKey ) raCert.getPublicKey();
+ raPubKey = (PublicKey) raCert.getPublicKey();
- if( raPubKey == null ) {
+ if (raPubKey == null) {
// log that something is seriously wrong with the RA
- logMessage = CMS.getLogMessage( "SELFTESTS_RA_IS_CORRUPT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_RA_IS_CORRUPT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
- throw new ESelfTestException( logMessage );
+ throw new ESelfTestException(logMessage);
}
// log that the RA is present
- logMessage = CMS.getLogMessage( "SELFTESTS_RA_IS_PRESENT",
- getSelfTestName() );
+ logMessage = CMS.getLogMessage("SELFTESTS_RA_IS_PRESENT",
+ getSelfTestName());
- mSelfTestSubsystem.log( logger,
- logMessage );
+ mSelfTestSubsystem.log(logger, logMessage);
}
return;
}
}
-
diff --git a/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java b/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java
index ba0ae3cb7..ce088045a 100644
--- a/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java
+++ b/pki/base/common/src/com/netscape/cms/selftests/tks/TKSKnownSessionKey.java
@@ -20,8 +20,6 @@
package com.netscape.cms.selftests.tks;
-
-
///////////////////////
// import statements //
///////////////////////
@@ -42,8 +40,6 @@ import com.netscape.certsrv.selftests.ISelfTestSubsystem;
import com.netscape.cms.selftests.ASelfTest;
import com.netscape.symkey.SessionKey;
-
-
//////////////////////
// class definition //
//////////////////////
@@ -57,47 +53,40 @@ import com.netscape.symkey.SessionKey;
* @author awnuk
* @version $Revision$, $Date$
*/
-public class TKSKnownSessionKey
-extends ASelfTest
-{
+public class TKSKnownSessionKey extends ASelfTest {
// parameter information
public static final String PROP_TKS_SUB_ID = "TksSubId";
- private String mTksSubId = null;
- private String mToken = null;
- private String mUseSoftToken = null;
- private String mKeyName = null;
- private byte[] mKeyInfo = null;
+ private String mTksSubId = null;
+ private String mToken = null;
+ private String mUseSoftToken = null;
+ private String mKeyName = null;
+ private byte[] mKeyInfo = null;
private byte[] mCardChallenge = null;
private byte[] mHostChallenge = null;
- private byte[] mCUID = null;
- private byte[] mMacKey = null;
- private byte[] mSessionKey = null;
-
+ private byte[] mCUID = null;
+ private byte[] mMacKey = null;
+ private byte[] mSessionKey = null;
/**
- * Initializes this subsystem with the configuration store
- * associated with this instance name.
+ * Initializes this subsystem with the configuration store associated with
+ * this instance name.
* <P>
- *
+ *
* @param subsystem the associated subsystem
- * @param instanceName the name of this self test instance
+ * @param instanceName the name of this self test instance
* @param parameters configuration store (self test parameters)
* @exception EDuplicateSelfTestException subsystem has duplicate name/value
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void initSelfTest (ISelfTestSubsystem subsystem,
- String instanceName,
- IConfigStore parameters)
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
- EMissingSelfTestException
- {
+ public void initSelfTest(ISelfTestSubsystem subsystem, String instanceName,
+ IConfigStore parameters) throws EDuplicateSelfTestException,
+ EInvalidSelfTestException, EMissingSelfTestException {
ISubsystem tks = null;
IConfigStore tksConfig = null;
String logMessage = null;
- super.initSelfTest( subsystem, instanceName, parameters );
+ super.initSelfTest(subsystem, instanceName, parameters);
mTksSubId = getConfigString(PROP_TKS_SUB_ID);
mToken = getConfigString("token");
@@ -116,7 +105,8 @@ extends ASelfTest
if (tksConfig != null) {
try {
defKeySetMacKey = tksConfig.getString("defKeySet.mac_key");
- byte defMacKey[] = com.netscape.cmsutil.util.Utils.SpecialDecode(defKeySetMacKey);
+ byte defMacKey[] = com.netscape.cmsutil.util.Utils
+ .SpecialDecode(defKeySetMacKey);
if (!Arrays.equals(mMacKey, defMacKey)) {
defKeySetMacKey = null;
}
@@ -128,34 +118,36 @@ extends ASelfTest
if (defKeySetMacKey == null) {
CMS.debug("TKSKnownSessionKey: invalid mac key");
CMS.debug("TKSKnownSessionKey self test FAILED");
- mSelfTestSubsystem.log (mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage("SELFTESTS_INVALID_VALUES",
- getSelfTestName(), mPrefix + "." + "macKey"));
- throw new EInvalidSelfTestException (mPrefix, "macKey", null);
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_INVALID_VALUES",
+ getSelfTestName(), mPrefix + "." + "macKey"));
+ throw new EInvalidSelfTestException(mPrefix, "macKey", null);
}
-
+
try {
mSessionKey = getConfigByteArray("sessionKey", 16);
} catch (EMissingSelfTestException e) {
if (mSessionKey == null) {
- mSessionKey = SessionKey.ComputeSessionKey (mToken, mKeyName,
- mCardChallenge, mHostChallenge,
- mKeyInfo, mCUID, mMacKey, mUseSoftToken, null, null);
+ mSessionKey = SessionKey.ComputeSessionKey(mToken, mKeyName,
+ mCardChallenge, mHostChallenge, mKeyInfo, mCUID,
+ mMacKey, mUseSoftToken, null, null);
if (mSessionKey == null || mSessionKey.length != 16) {
- mSelfTestSubsystem.log (mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
- getSelfTestName(), mPrefix + ".sessionKey"));
- throw new EMissingSelfTestException ("sessionKey");
+ mSelfTestSubsystem.log(mSelfTestSubsystem
+ .getSelfTestLogger(), CMS.getLogMessage(
+ "SELFTESTS_MISSING_VALUES", getSelfTestName(),
+ mPrefix + ".sessionKey"));
+ throw new EMissingSelfTestException("sessionKey");
}
String sessionKey = SpecialEncode(mSessionKey);
mConfig.putString("sessionKey", sessionKey);
try {
CMS.getConfigStore().commit(true);
} catch (EBaseException be) {
- mSelfTestSubsystem.log (mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
- getSelfTestName(), mPrefix + ".sessionKey"));
- throw new EMissingSelfTestException ("sessionKey");
+ mSelfTestSubsystem.log(mSelfTestSubsystem
+ .getSelfTestLogger(), CMS.getLogMessage(
+ "SELFTESTS_MISSING_VALUES", getSelfTestName(),
+ mPrefix + ".sessionKey"));
+ throw new EMissingSelfTestException("sessionKey");
}
}
}
@@ -163,9 +155,7 @@ extends ASelfTest
return;
}
-
- private String SpecialEncode (byte data[])
- {
+ private String SpecialEncode(byte data[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < data.length; i++) {
@@ -179,9 +169,8 @@ extends ASelfTest
return sb.toString();
}
-
- private String getConfigString (String name) throws EMissingSelfTestException
- {
+ private String getConfigString(String name)
+ throws EMissingSelfTestException {
String value = null;
try {
@@ -189,137 +178,126 @@ extends ASelfTest
if (value != null) {
value = value.trim();
} else {
- mSelfTestSubsystem.log (mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
- getSelfTestName(), mPrefix + "." + name));
- throw new EMissingSelfTestException (name);
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(),
+ CMS.getLogMessage("SELFTESTS_MISSING_VALUES",
+ getSelfTestName(), mPrefix + "." + name));
+ throw new EMissingSelfTestException(name);
}
} catch (EBaseException e) {
- mSelfTestSubsystem.log (mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage("SELFTESTS_MISSING_NAME",
- getSelfTestName(), mPrefix + "." + name));
- throw new EMissingSelfTestException (mPrefix, name, null);
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + name));
+ throw new EMissingSelfTestException(mPrefix, name, null);
}
return value;
}
-
- private byte[] getConfigByteArray (String name, int size) throws EMissingSelfTestException,
- EInvalidSelfTestException
- {
+ private byte[] getConfigByteArray(String name, int size)
+ throws EMissingSelfTestException, EInvalidSelfTestException {
String stringValue = getConfigString(name);
- byte byteValue[] = com.netscape.cmsutil.util.Utils.SpecialDecode(stringValue);
+ byte byteValue[] = com.netscape.cmsutil.util.Utils
+ .SpecialDecode(stringValue);
if (byteValue == null) {
- mSelfTestSubsystem.log (mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage("SELFTESTS_MISSING_NAME",
- getSelfTestName(), mPrefix + "." + name));
- throw new EMissingSelfTestException (name);
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_MISSING_NAME", getSelfTestName(),
+ mPrefix + "." + name));
+ throw new EMissingSelfTestException(name);
}
if (byteValue.length != size) {
- mSelfTestSubsystem.log (mSelfTestSubsystem.getSelfTestLogger(),
- CMS.getLogMessage("SELFTESTS_INVALID_VALUES",
- getSelfTestName(), mPrefix + "." + name));
- throw new EInvalidSelfTestException (mPrefix, name, stringValue);
+ mSelfTestSubsystem.log(mSelfTestSubsystem.getSelfTestLogger(), CMS
+ .getLogMessage("SELFTESTS_INVALID_VALUES",
+ getSelfTestName(), mPrefix + "." + name));
+ throw new EInvalidSelfTestException(mPrefix, name, stringValue);
}
return byteValue;
}
-
/**
* Notifies this subsystem if it is in execution mode.
* <P>
- *
+ *
* @exception ESelfTestException failed to start
*/
- public void startupSelfTest()
- throws ESelfTestException
- {
+ public void startupSelfTest() throws ESelfTestException {
return;
}
-
/**
- * Stops this subsystem. The subsystem may call shutdownSelfTest
- * anytime after initialization.
+ * Stops this subsystem. The subsystem may call shutdownSelfTest anytime
+ * after initialization.
* <P>
*/
- public void shutdownSelfTest()
- {
+ public void shutdownSelfTest() {
return;
}
-
/**
- * Returns the name associated with this self test. This method may
- * return null if the self test has not been intialized.
+ * Returns the name associated with this self test. This method may return
+ * null if the self test has not been intialized.
* <P>
- *
+ *
* @return instanceName of this self test
*/
- public String getSelfTestName()
- {
+ public String getSelfTestName() {
return super.getSelfTestName();
}
-
/**
- * Returns the root configuration storage (self test parameters)
- * associated with this subsystem.
+ * Returns the root configuration storage (self test parameters) associated
+ * with this subsystem.
* <P>
- *
+ *
* @return configuration store (self test parameters) of this subsystem
*/
- public IConfigStore getSelfTestConfigStore()
- {
+ public IConfigStore getSelfTestConfigStore() {
return super.getSelfTestConfigStore();
}
-
/**
- * Retrieves description associated with an individual self test.
- * This method may return null.
+ * Retrieves description associated with an individual self test. This
+ * method may return null.
* <P>
- *
+ *
* @param locale locale of the client that requests the description
* @return description of self test
*/
- public String getSelfTestDescription( Locale locale )
- {
- return CMS.getUserMessage (locale, "CMS_SELFTESTS_TKS_PRESENCE_DESCRIPTION");
+ public String getSelfTestDescription(Locale locale) {
+ return CMS.getUserMessage(locale,
+ "CMS_SELFTESTS_TKS_PRESENCE_DESCRIPTION");
}
-
/**
* Execute an individual self test.
* <P>
- *
+ *
* @param logger specifies logging subsystem
* @exception ESelfTestException self test exception
*/
- public void runSelfTest (ILogEventListener logger)
- throws ESelfTestException
- {
+ public void runSelfTest(ILogEventListener logger) throws ESelfTestException {
String logMessage = null;
String keySet = "defKeySet";
- byte[] sessionKey = SessionKey.ComputeSessionKey (mToken, mKeyName,
- mCardChallenge, mHostChallenge,
- mKeyInfo, mCUID, mMacKey, mUseSoftToken, keySet, null);
+ byte[] sessionKey = SessionKey.ComputeSessionKey(mToken, mKeyName,
+ mCardChallenge, mHostChallenge, mKeyInfo, mCUID, mMacKey,
+ mUseSoftToken, keySet, null);
// Now we just see if we can successfully generate a session key.
- // For FIPS compliance, the routine now returns a wrapped key, which can't be extracted and compared.
+ // For FIPS compliance, the routine now returns a wrapped key, which
+ // can't be extracted and compared.
if (sessionKey == null) {
CMS.debug("TKSKnownSessionKey: generated no session key");
CMS.debug("TKSKnownSessionKey self test FAILED");
- logMessage = CMS.getLogMessage ("SELFTESTS_TKS_FAILED", getSelfTestName(), getSelfTestName());
- mSelfTestSubsystem.log (logger, logMessage);
- throw new ESelfTestException( logMessage );
- } else {
- logMessage = CMS.getLogMessage ("SELFTESTS_TKS_SUCCEEDED", getSelfTestName(), getSelfTestName());
- mSelfTestSubsystem.log (logger, logMessage);
+ logMessage = CMS.getLogMessage("SELFTESTS_TKS_FAILED",
+ getSelfTestName(), getSelfTestName());
+ mSelfTestSubsystem.log(logger, logMessage);
+ throw new ESelfTestException(logMessage);
+ } else {
+ logMessage = CMS.getLogMessage("SELFTESTS_TKS_SUCCEEDED",
+ getSelfTestName(), getSelfTestName());
+ mSelfTestSubsystem.log(logger, logMessage);
CMS.debug("TKSKnownSessionKey self test SUCCEEDED");
}