This commit is contained in:
Sebastian Stenzel
2015-11-05 20:39:05 +01:00
parent ebb421bd4c
commit 4d5cc7a5a0
2 changed files with 3 additions and 7 deletions

View File

@@ -98,8 +98,9 @@ public class Aes256Cryptor implements Cryptor, AesCryptographicConfiguration {
public Aes256Cryptor() {
byte[] bytes = new byte[AES_KEY_LENGTH_IN_BITS / Byte.SIZE];
try {
securePrng = SecureRandom.getInstance(PRNG_ALGORITHM);
securePrng.setSeed(securePrng.generateSeed(PRNG_SEED_LENGTH));
securePrng = SecureRandom.getInstanceStrong();
// No setSeed needed. See SecureRandom.getInstance(String):
// The first call to nextBytes will force the SecureRandom object to seed itself
securePrng.nextBytes(bytes);
this.primaryMasterKey = new SecretKeySpec(bytes, AES_KEY_ALGORITHM);
securePrng.nextBytes(bytes);

View File

@@ -38,11 +38,6 @@ interface AesCryptographicConfiguration {
*/
int PRNG_SEED_LENGTH = 16;
/**
* Algorithm used for random number generation.
*/
String PRNG_ALGORITHM = "SHA1PRNG";
/**
* Algorithm used for en/decryption.
*