String algorithm = getConfiguration().getString(
SecurityService.SECURE_PASSWORDS_ALGORITHM_KEY,
SecurityService.SECURE_PASSWORDS_ALGORITHM_DEFAULT);
CryptoService cs = null;
try {
ServiceManager serviceManager = TurbineServices.getInstance();
cs = (CryptoService)serviceManager.getService(CryptoService.ROLE);
}
catch (Exception e){
throw new RuntimeException("Could not access Crypto Service",e);
}
if (cs != null && (secure.equals("true") || secure.equals("yes")))
{
try
{
CryptoAlgorithm ca = cs.getCryptoAlgorithm(algorithm);
ca.setSeed(salt);
String result = ca.encrypt(password);