use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CRLRevocationManager method initCRLCacheLocation.
/**
* Initializes the CRL cache location option
*/
protected static void initCRLCacheLocation() {
// get the location from the OptionsManager.... if it doesn't exist, then set a default location
// of CrlCache off the working directory
final OptionsParameter param = OptionsManager.getInstance().getParameter(OptionsParameter.CRL_CACHE_LOCATION);
final String cacheLoc = (param == null || param.getParamValue() == null || param.getParamValue().isEmpty()) ? DEFAULT_CRL_CACHE_LOCATION : param.getParamValue();
// initialize the CRL cache location
try {
crlCacheLocation = new File(cacheLoc);
if (crlCacheLocation.exists()) {
// then log a warning and disable caching
if (!crlCacheLocation.isDirectory()) {
LOGGER.warn("Configured CRL cache location " + cacheLoc + " already exists and is not a directory. " + "CRL file caching will be disable");
crlCacheLocation = null;
}
} else {
// force the directory to be created
FileUtils.forceMkdir(crlCacheLocation);
}
} catch (Throwable t) {
LOGGER.warn("Failed to initialize CRL cache location " + cacheLoc + " CRL file caching will be disable", t);
crlCacheLocation = null;
}
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CryptoExtensions_getJCEProviderNameForTypeAndAlgorithmTest method testGetJCEProviderNameForTypeAndAlgorithm_configuredJCENames_algAndTypeNotFound_assertEmptyProviderName.
public void testGetJCEProviderNameForTypeAndAlgorithm_configuredJCENames_algAndTypeNotFound_assertEmptyProviderName() {
CryptoExtensions.registerJCEProviders();
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.JCE_PROVIDER, "BC"));
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER));
assertEquals("BC", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER).getParamValue());
assertEquals("", CryptoExtensions.getJCEProviderNameForTypeAndAlgorithm("doesnt matter", "doesnt matter"));
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CryptoExtensions_getJCEProviderNameForTypeAndAlgorithmTest method testGetJCEProviderNameForTypeAndAlgorithm_nullConfiguredJCENames_assertEmptyBCProvider.
public void testGetJCEProviderNameForTypeAndAlgorithm_nullConfiguredJCENames_assertEmptyBCProvider() {
CryptoExtensions.registerJCEProviders();
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.JCE_PROVIDER, null));
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER));
assertNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER).getParamValue());
assertEquals("", CryptoExtensions.getJCEProviderNameForTypeAndAlgorithm("doesnt matter", "doesnt matter"));
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CryptoExtensions_getJCEProviderNameForTypeAndAlgorithmTest method testGetJCEProviderNameForTypeAndAlgorithm_multipConfiguredJCENames_foundProvider_assertProviderName.
public void testGetJCEProviderNameForTypeAndAlgorithm_multipConfiguredJCENames_foundProvider_assertProviderName() {
CryptoExtensions.registerJCEProviders();
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.JCE_PROVIDER, "MOCK,BC"));
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER));
assertEquals("MOCK,BC", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER).getParamValue());
assertEquals("BC", CryptoExtensions.getJCEProviderNameForTypeAndAlgorithm("CertPathValidator", "PKIX"));
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CryptoExtensions_getJCEProviderNameForTypeAndAlgorithmTest method testGetJCEProviderNameForTypeAndAlgorithm_configuredJCENames_unknownProvider_assertEmptyProviderName.
public void testGetJCEProviderNameForTypeAndAlgorithm_configuredJCENames_unknownProvider_assertEmptyProviderName() {
CryptoExtensions.registerJCEProviders();
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.JCE_PROVIDER, "dummy"));
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER));
assertEquals("dummy", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER).getParamValue());
assertEquals("", CryptoExtensions.getJCEProviderNameForTypeAndAlgorithm("doesnt matter", "doesnt matter"));
}
Aggregations