List of usage examples for org.springframework.security.crypto.keygen KeyGenerators secureRandom
public static BytesKeyGenerator secureRandom()
From source file:com.springsource.greenhouse.database.GreenhouseDatabaseInstallerTest.java
@Test public void runUpgrader() { EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory(); factory.setDatabaseType(EmbeddedDatabaseType.H2); EmbeddedDatabase db = factory.getDatabase(); System.setProperty("security.encryptPassword", "foo"); System.setProperty("security.encryptSalt", new String(Hex.encode(KeyGenerators.secureRandom().generateKey()))); DatabaseUpgrader installer = new DatabaseUpgrader(db, new StandardEnvironment(), Encryptors.noOpText()); installer.run();// w w w. j a v a2 s .c o m installer.run(); DatabaseUpgrader installer2 = new DatabaseUpgrader(db, new StandardEnvironment(), Encryptors.noOpText()); installer2.run(); }
From source file:com.springsource.greenhouse.account.GreenhousePasswordEncoder.java
/** * Creates a fully customized standard password encoder. *//* w w w . j av a 2 s . c o m*/ public GreenhousePasswordEncoder(String algorithm, String provider, String secret) { this.digester = new Digester(algorithm, provider); this.secret = Utf8.encode(secret); this.saltGenerator = KeyGenerators.secureRandom(); }
From source file:org.matrix.security.crypto.password.StandardPasswordEncoder.java
private StandardPasswordEncoder(String algorithm, CharSequence secret) { this.digester = new Digester(algorithm, DEFAULT_ITERATIONS); this.secret = Utf8.encode(secret); this.saltGenerator = KeyGenerators.secureRandom(); }