/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: JSSInit.java,v 1.2 2008/06/25 05:52:42 qcheng Exp $
*
*/
/**
* A initialization class for JSS.
* Check configuration and initialize JSS as configured.
**/
public class JSSInit {
/**
* Default directory of security databases (current dir).
*/
private static boolean initialized = false;
public static synchronized boolean
{
if (initialized) {
return true;
}
// JSS, initialize cert db
}
"com.iplanet.am.admin.cli.certdb.prefix");
if (certdbPrefix == null) {
certdbPrefix = "";
}
// Property to determine if JSS needs to installed with highest priority
// at initialization of JSS. If not, it needs to added explicitly
// at the end
boolean donotInstallJSSProviderAt0 =
"com.sun.identity.jss.donotInstallAtHighestPriority",
"false")).booleanValue();
"com.iplanet.am.admin.cli.certdb.passfile");
"com.sun.identity.authentication.ocspCheck");
"com.sun.identity.security.fipsmode", null);
}
boolean ocspCheck =
"com.sun.identity.authentication.ocsp.responder.url");
responderURL = null;
}
"com.sun.identity.authentication.ocsp.responder.nickname");
if (responderNickName != null &&
}
if (debug.messageEnabled()) {
passfile);
}
try {
}
if (debug.messageEnabled()) {
"read JSS password file " +
passfile);
}
}
}
try {
try {
}
else {
}
if (debug.messageEnabled()) {
"output of Initilization values ");
iv.getManufacturerID());
}
}
iv.removeSunProvider = false;
// Since we would like to support other JCE providers
// for XML signature and encryption, need to check
// if other providers are being used
if (donotInstallJSSProviderAt0) {
iv.installJSSProvider = false;
}
// set open mode of the databases
// enable OCSP
// responderURL & responderNickname must both present
if (ocspCheck &&
}
// If JSS provider is not installed by default
// add it to the list of JCE providers at the end
if (donotInstallJSSProviderAt0) {
try {
"org.mozilla.jss.JSSProvider").newInstance();
} catch (ClassNotFoundException e) {
"org.mozilla.jss.provider.Provider").newInstance();
}
}
new JSSPasswordCallback(password));
}
if (cm.FIPSEnabled()) {
}
if (debug.messageEnabled()) {
if (cm.FIPSEnabled() == true ) {
} else {
}
}
initialized = true;
}
catch (KeyDatabaseException kdbe) {
"Couldn't open the key database.", kdbe);
}
catch (CertDatabaseException cdbe) {
"Couldn't open the certificate database.", cdbe);
}
catch (AlreadyInitializedException aie) {
"CryptoManager already initialized.", aie);
}
catch (Exception e) {
"Exception occurred: ", e);
}
}
return initialized;
}
/**
* Returns <code>CryptoManager</code> object after initialize it.
*
* @return <code>CryptoManager</code> object.
*/
initialize();
}
return cm;
}
/**
* Returns <code>CryptoToken</code> object after initialize
* <code>CryptoManager</code>.
*
* @return <code>CryptoToken</code> object.
*/
initialize();
}
return token;
}
}