From 3dab4543e6e63497f29ff2cbe3eb701346325000 Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Fri, 11 Apr 2014 13:02:03 +0100 Subject: [PATCH] Combine the system's PRNG with Fortuna, in case either one is flawed. --- .../src/org/briarproject/crypto/CryptoComponentImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java b/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java index 22e7be9f75..167fb84f33 100644 --- a/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java +++ b/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java @@ -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(); -- GitLab