Use custom SecureRandom instance

- Use NativePRNG algorithm instead of using SHA1PRNG if available
- Register a custom security provider to use the same SecureRandom everywhere
This commit is contained in:
AsamK 2018-11-21 00:07:05 +01:00
parent cf972e5b6c
commit 5f2190713a
4 changed files with 88 additions and 14 deletions

View file

@ -24,6 +24,8 @@ import org.asamk.Signal;
import org.asamk.signal.commands.*;
import org.asamk.signal.manager.BaseConfig;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.util.SecurityProvider;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.freedesktop.dbus.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException;
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
@ -35,8 +37,9 @@ import java.util.Map;
public class Main {
public static void main(String[] args) {
// Workaround for BKS truststore
Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 1);
// Register our own security provider
Security.insertProviderAt(new SecurityProvider(), 1);
Security.addProvider(new BouncyCastleProvider());
Namespace ns = parseArgs(args);
if (ns == null) {