mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +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
|
@Inject
|
||||||
CryptoComponentImpl(SeedProvider r) {
|
CryptoComponentImpl(SeedProvider r) {
|
||||||
if(!FortunaSecureRandom.selfTest()) throw new RuntimeException();
|
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(
|
ECKeyGenerationParameters params = new ECKeyGenerationParameters(
|
||||||
PARAMETERS, secureRandom);
|
PARAMETERS, secureRandom);
|
||||||
agreementKeyPairGenerator = new ECKeyPairGenerator();
|
agreementKeyPairGenerator = new ECKeyPairGenerator();
|
||||||
|
|||||||
Reference in New Issue
Block a user