summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java16
-rw-r--r--pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java35
2 files changed, 30 insertions, 21 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
index 10c2fca5c..1debdb8db 100644
--- a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
+++ b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
@@ -213,7 +213,7 @@ public class CMSEngine implements ICMSEngine {
return instanceDir;
}
- public IPasswordStore getPasswordStore() {
+ public synchronized IPasswordStore getPasswordStore() {
// initialize the PasswordReader and PasswordWriter
try {
String pwdPath = mConfig.getString("passwordFile");
@@ -275,20 +275,6 @@ public class CMSEngine implements ICMSEngine {
mSDTimer.schedule(timertask, 5, (new Long(secdomain_check_interval)).longValue());
}
- // initialize the PasswordReader and PasswordWriter
- String pwdPath = config.getString("passwordFile");
- String pwdClass = config.getString("passwordClass");
-
- if (pwdClass != null) {
- try {
- mPasswordStore = (IPasswordStore)Class.forName(pwdClass).newInstance();
- mPasswordStore.init(pwdPath);
- CMS.debug("CMSEngine: init(): password store initialized for "+
- pwdClass);
- } catch (Exception e) {
- }
- }
-
String tsClass = config.getString("timeSourceClass", null);
if (tsClass != null) {
diff --git a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java
index 8ee34ca4a..0d3f03199 100644
--- a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java
+++ b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java
@@ -63,6 +63,7 @@ import netscape.ldap.util.*;
public final class JssSubsystem implements ICryptoSubsystem {
public static final String ID = "jss";
+ private static final String CONFIG_DIR = "configDir";
private static final String CERTPREFIX_ALIAS = "certPrefix";
private static final String KEYPREFIX_ALIAS = "keyPrefix";
private static final String CONFIGDIR_ALIAS = "configDir";
@@ -233,11 +234,11 @@ public final class JssSubsystem implements ICryptoSubsystem {
if (!enabled)
return;
- try {
- devRandomInputStream = new FileInputStream("/dev/urandom");
- } catch (IOException ioe) {
- // XXX - add new exception
- }
+ try {
+ devRandomInputStream = new FileInputStream("/dev/urandom");
+ } catch (IOException ioe) {
+ // XXX - add new exception
+ }
// get hardcoded password (for debugging.
String pw;
@@ -248,9 +249,31 @@ public final class JssSubsystem implements ICryptoSubsystem {
CMS.debug("JssSubsystem init() got password from hardcoded in config");
}
+ String certDir;
+
+ certDir = config.getString(CONFIG_DIR, null);
+
+ CryptoManager.InitializationValues vals =
+ new CryptoManager.InitializationValues(certDir,
+ "", "", "secmod.db");
+
+ vals.removeSunProvider = false;
+ vals.installJSSProvider = true;
try {
- mCryptoManager = CryptoManager.getInstance();
+ CryptoManager.initialize(vals);
+ } catch (AlreadyInitializedException e) {
+ // do nothing
+ } catch (Exception e) {
+ String[] params = {mId, e.toString()};
+ EBaseException ex = new EBaseException(
+ CMS.getUserMessage("CMS_BASE_CREATE_SERVICE_FAILED", params));
+
+ log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_SECURITY_GENERAL_ERROR", ex.toString()));
+ throw ex;
+ }
+ try {
+ mCryptoManager = CryptoManager.getInstance();
initSSL();
} catch (CryptoManager.NotInitializedException e) {
String[] params = {mId, e.toString()};