mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
request strongest instance of securerandom when generating a seed
This commit is contained in:
parent
942db9df48
commit
cb884d97cb
1 changed files with 9 additions and 1 deletions
|
@ -30,6 +30,7 @@ import org.controlsfx.validation.ValidationSupport;
|
||||||
import org.controlsfx.validation.Validator;
|
import org.controlsfx.validation.Validator;
|
||||||
import org.controlsfx.validation.decoration.StyleClassValidationDecoration;
|
import org.controlsfx.validation.decoration.StyleClassValidationDecoration;
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -275,7 +276,14 @@ public class MnemonicKeystoreImportPane extends TitledDescriptionPane {
|
||||||
int mnemonicSeedLength = wordEntriesProperty.get().size() * 11;
|
int mnemonicSeedLength = wordEntriesProperty.get().size() * 11;
|
||||||
int entropyLength = mnemonicSeedLength - (mnemonicSeedLength/33);
|
int entropyLength = mnemonicSeedLength - (mnemonicSeedLength/33);
|
||||||
|
|
||||||
DeterministicSeed deterministicSeed = new DeterministicSeed(new SecureRandom(), entropyLength, "");
|
SecureRandom secureRandom;
|
||||||
|
try {
|
||||||
|
secureRandom = SecureRandom.getInstanceStrong();
|
||||||
|
} catch(NoSuchAlgorithmException e) {
|
||||||
|
secureRandom = new SecureRandom();
|
||||||
|
}
|
||||||
|
|
||||||
|
DeterministicSeed deterministicSeed = new DeterministicSeed(secureRandom, entropyLength, "");
|
||||||
generatedMnemonicCode = deterministicSeed.getMnemonicCode();
|
generatedMnemonicCode = deterministicSeed.getMnemonicCode();
|
||||||
|
|
||||||
displayMnemonicCode();
|
displayMnemonicCode();
|
||||||
|
|
Loading…
Reference in a new issue