mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Combine the system's PRNG with Fortuna, in case either one is flawed.
This commit is contained in:
@@ -95,7 +95,14 @@ class CryptoComponentImpl implements CryptoComponent {
|
||||
@Inject
|
||||
CryptoComponentImpl(SeedProvider r) {
|
||||
if(!FortunaSecureRandom.selfTest()) throw new RuntimeException();
|
||||
secureRandom = new FortunaSecureRandom(r.getSeed());
|
||||
SecureRandom secureRandom1 = new SecureRandom();
|
||||
if(LOG.isLoggable(INFO)) {
|
||||
String provider = secureRandom1.getProvider().getName();
|
||||
String algorithm = secureRandom1.getAlgorithm();
|
||||
LOG.info("Default SecureRandom: " + provider + " " + algorithm);
|
||||
}
|
||||
SecureRandom secureRandom2 = new FortunaSecureRandom(r.getSeed());
|
||||
secureRandom = new CombinedSecureRandom(secureRandom1, secureRandom2);
|
||||
ECKeyGenerationParameters params = new ECKeyGenerationParameters(
|
||||
PARAMETERS, secureRandom);
|
||||
agreementKeyPairGenerator = new ECKeyPairGenerator();
|
||||
|
||||
Reference in New Issue
Block a user