3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-14 19:25:51 +00:00

DeterministicSeed, DeterministicKeyChain: Remove seedCreationTimeSecs parameter from constructors that create the seed itself.

This commit is contained in:
Andreas Schildbach 2019-01-26 19:07:46 +01:00
parent 0e2b7cf979
commit f40e16aac4
3 changed files with 12 additions and 11 deletions

View File

@ -258,7 +258,8 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
DeterministicKeyChain chain;
if (random != null) {
// Default passphrase to "" if not specified
chain = new DeterministicKeyChain(new DeterministicSeed(random, bits, getPassphrase(), seedCreationTimeSecs), null, accountPath);
checkState(seedCreationTimeSecs == 0);
chain = new DeterministicKeyChain(new DeterministicSeed(random, bits, getPassphrase()), null, accountPath);
} else if (entropy != null) {
chain = new DeterministicKeyChain(new DeterministicSeed(entropy, getPassphrase(), seedCreationTimeSecs), null, accountPath);
} else if (seed != null) {
@ -286,7 +287,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
* object and the default entropy size.
*/
public DeterministicKeyChain(SecureRandom random) {
this(random, DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds());
this(random, DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS, DEFAULT_PASSPHRASE_FOR_MNEMONIC);
}
/**
@ -294,7 +295,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
* object and of the requested size in bits.
*/
public DeterministicKeyChain(SecureRandom random, int bits) {
this(random, bits, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds());
this(random, bits, DEFAULT_PASSPHRASE_FOR_MNEMONIC);
}
/**
@ -302,8 +303,8 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
* object and of the requested size in bits. The derived seed is further protected with a user selected passphrase
* (see BIP 39).
*/
public DeterministicKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs) {
this(new DeterministicSeed(random, bits, passphrase, seedCreationTimeSecs));
public DeterministicKeyChain(SecureRandom random, int bits, String passphrase) {
this(new DeterministicSeed(random, bits, passphrase));
}
/**

View File

@ -88,10 +88,9 @@ public class DeterministicSeed implements EncryptableItem {
* @param random Entropy source
* @param bits number of bits, must be divisible by 32
* @param passphrase A user supplied passphrase, or an empty string if there is no passphrase
* @param creationTimeSeconds When the seed was originally created, UNIX time.
*/
public DeterministicSeed(SecureRandom random, int bits, String passphrase, long creationTimeSeconds) {
this(getEntropy(random, bits), checkNotNull(passphrase), creationTimeSeconds);
public DeterministicSeed(SecureRandom random, int bits, String passphrase) {
this(getEntropy(random, bits), checkNotNull(passphrase), Utils.currentTimeSeconds());
}
/**

View File

@ -104,7 +104,8 @@ public class MarriedKeyChain extends DeterministicKeyChain {
MarriedKeyChain chain;
if (random != null) {
chain = new MarriedKeyChain(new DeterministicSeed(random, bits, getPassphrase(), seedCreationTimeSecs), null, accountPath);
checkState(seedCreationTimeSecs == 0);
chain = new MarriedKeyChain(new DeterministicSeed(random, bits, getPassphrase()), null, accountPath);
} else if (entropy != null) {
chain = new MarriedKeyChain(new DeterministicSeed(entropy, getPassphrase(), seedCreationTimeSecs), null, accountPath);
} else if (seed != null) {
@ -133,8 +134,8 @@ public class MarriedKeyChain extends DeterministicKeyChain {
}
// Builder constructors
private MarriedKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs) {
super(random, bits, passphrase, seedCreationTimeSecs);
private MarriedKeyChain(SecureRandom random, int bits, String passphrase) {
super(random, bits, passphrase);
}
private MarriedKeyChain(byte[] entropy, String passphrase, long seedCreationTimeSecs) {