if (result !=null) return result;
GeoServerSecurityManager manager = GeoServerApplication.get().getSecurityManager();
char[] key = manager.getRandomPassworddProvider().getRandomPasswordWithDefaultLength();
StandardPBEByteEncryptor enc = new StandardPBEByteEncryptor();
enc.setPasswordCharArray(key);
// since the password is copied, we can scramble it
manager.disposePassword(key);
if (manager.isStrongEncryptionAvailable()) {
enc.setProvider(new BouncyCastleProvider());
enc.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC");
}
else // US export restrictions
enc.setAlgorithm("PBEWITHMD5ANDDES");
result= new CryptImpl(enc);
s.setAttribute(ICRYPT_ATTR_NAME, result);
return result;
}