use of org.bedework.util.security.keys.GenKeysMBean in project bw-calendar-engine by Bedework.
the class CalSvc method getEncrypter.
PwEncryptionIntf getEncrypter() throws CalFacadeException {
if (pwEncrypt != null) {
return pwEncrypt;
}
try {
String pwEncryptClass = "org.bedework.util.security.PwEncryptionDefault";
// String pwEncryptClass = getSysparsHandler().get().getPwEncryptClass();
pwEncrypt = (PwEncryptionIntf) CalFacadeUtil.getObject(pwEncryptClass, PwEncryptionIntf.class);
String privKeys = null;
String pubKeys = null;
GenKeysMBean gk = (GenKeysMBean) MBeanUtil.getMBean(GenKeysMBean.class, GenKeysMBean.serviceName);
if (gk != null) {
privKeys = gk.getPrivKeyFileName();
pubKeys = gk.getPublicKeyFileName();
}
if (privKeys == null) {
throw new CalFacadeException("Unable to get keyfile locations. Is genkeys service installed?");
}
pwEncrypt.init(privKeys, pubKeys);
return pwEncrypt;
} catch (CalFacadeException cfe) {
cfe.printStackTrace();
throw cfe;
} catch (Throwable t) {
t.printStackTrace();
throw new CalFacadeException(t);
}
}
Aggregations