mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-02 00:31:24 +00:00
DeterministicSeed, DeterministicKeyChain: Remove seedCreationTimeSecs parameter from constructors that create the seed itself.
This commit is contained in:
@@ -258,7 +258,8 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
DeterministicKeyChain chain;
|
DeterministicKeyChain chain;
|
||||||
if (random != null) {
|
if (random != null) {
|
||||||
// Default passphrase to "" if not specified
|
// 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) {
|
} else if (entropy != null) {
|
||||||
chain = new DeterministicKeyChain(new DeterministicSeed(entropy, getPassphrase(), seedCreationTimeSecs), null, accountPath);
|
chain = new DeterministicKeyChain(new DeterministicSeed(entropy, getPassphrase(), seedCreationTimeSecs), null, accountPath);
|
||||||
} else if (seed != null) {
|
} else if (seed != null) {
|
||||||
@@ -286,7 +287,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
* object and the default entropy size.
|
* object and the default entropy size.
|
||||||
*/
|
*/
|
||||||
public DeterministicKeyChain(SecureRandom random) {
|
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.
|
* object and of the requested size in bits.
|
||||||
*/
|
*/
|
||||||
public DeterministicKeyChain(SecureRandom random, int 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
|
* object and of the requested size in bits. The derived seed is further protected with a user selected passphrase
|
||||||
* (see BIP 39).
|
* (see BIP 39).
|
||||||
*/
|
*/
|
||||||
public DeterministicKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs) {
|
public DeterministicKeyChain(SecureRandom random, int bits, String passphrase) {
|
||||||
this(new DeterministicSeed(random, bits, passphrase, seedCreationTimeSecs));
|
this(new DeterministicSeed(random, bits, passphrase));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -88,10 +88,9 @@ public class DeterministicSeed implements EncryptableItem {
|
|||||||
* @param random Entropy source
|
* @param random Entropy source
|
||||||
* @param bits number of bits, must be divisible by 32
|
* @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 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) {
|
public DeterministicSeed(SecureRandom random, int bits, String passphrase) {
|
||||||
this(getEntropy(random, bits), checkNotNull(passphrase), creationTimeSeconds);
|
this(getEntropy(random, bits), checkNotNull(passphrase), Utils.currentTimeSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -104,7 +104,8 @@ public class MarriedKeyChain extends DeterministicKeyChain {
|
|||||||
|
|
||||||
MarriedKeyChain chain;
|
MarriedKeyChain chain;
|
||||||
if (random != null) {
|
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) {
|
} else if (entropy != null) {
|
||||||
chain = new MarriedKeyChain(new DeterministicSeed(entropy, getPassphrase(), seedCreationTimeSecs), null, accountPath);
|
chain = new MarriedKeyChain(new DeterministicSeed(entropy, getPassphrase(), seedCreationTimeSecs), null, accountPath);
|
||||||
} else if (seed != null) {
|
} else if (seed != null) {
|
||||||
@@ -133,8 +134,8 @@ public class MarriedKeyChain extends DeterministicKeyChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Builder constructors
|
// Builder constructors
|
||||||
private MarriedKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs) {
|
private MarriedKeyChain(SecureRandom random, int bits, String passphrase) {
|
||||||
super(random, bits, passphrase, seedCreationTimeSecs);
|
super(random, bits, passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MarriedKeyChain(byte[] entropy, String passphrase, long seedCreationTimeSecs) {
|
private MarriedKeyChain(byte[] entropy, String passphrase, long seedCreationTimeSecs) {
|
||||||
|
Reference in New Issue
Block a user