mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Use a single SecureRandom instance to avoid blocking on creation.
This commit is contained in:
@@ -50,6 +50,7 @@ class CryptoComponentImpl implements CryptoComponent {
|
|||||||
|
|
||||||
private final KeyParser keyParser;
|
private final KeyParser keyParser;
|
||||||
private final KeyPairGenerator keyPairGenerator;
|
private final KeyPairGenerator keyPairGenerator;
|
||||||
|
private final SecureRandom secureRandom;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
CryptoComponentImpl() {
|
CryptoComponentImpl() {
|
||||||
@@ -62,6 +63,7 @@ class CryptoComponentImpl implements CryptoComponent {
|
|||||||
} catch(GeneralSecurityException e) {
|
} catch(GeneralSecurityException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
secureRandom = new SecureRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ErasableKey deriveFrameKey(byte[] secret, boolean initiator) {
|
public ErasableKey deriveFrameKey(byte[] secret, boolean initiator) {
|
||||||
@@ -171,8 +173,7 @@ class CryptoComponentImpl implements CryptoComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SecureRandom getSecureRandom() {
|
public SecureRandom getSecureRandom() {
|
||||||
// FIXME: Implement a PRNG (pony/rainbow/nyancat generator)
|
return secureRandom;
|
||||||
return new SecureRandom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Signature getSignature() {
|
public Signature getSignature() {
|
||||||
|
|||||||
Reference in New Issue
Block a user