public class DeterministicSeed extends Object implements EncryptableItem
DeterministicKeyChain
. The purpose of this wrapper is to simplify the encryption
code.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SEED_ENTROPY_BITS |
static int |
MAX_SEED_ENTROPY_BITS |
Constructor and Description |
---|
DeterministicSeed(byte[] seed,
List<String> mnemonic,
long creationTimeSeconds) |
DeterministicSeed(byte[] entropy,
String passphrase,
long creationTimeSeconds)
Constructs a seed from a BIP 39 mnemonic code.
|
DeterministicSeed(EncryptedData encryptedMnemonic,
EncryptedData encryptedSeed,
long creationTimeSeconds) |
DeterministicSeed(List<String> mnemonicCode,
byte[] seed,
String passphrase,
long creationTimeSeconds)
Constructs a seed from a BIP 39 mnemonic code.
|
DeterministicSeed(SecureRandom random,
int bits,
String passphrase,
long creationTimeSeconds)
Constructs a seed from a BIP 39 mnemonic code.
|
DeterministicSeed(String mnemonicCode,
byte[] seed,
String passphrase,
long creationTimeSeconds) |
Modifier and Type | Method and Description |
---|---|
void |
check()
Check if our mnemonic is a valid mnemonic phrase for our word list.
|
DeterministicSeed |
decrypt(KeyCrypter crypter,
String passphrase,
org.spongycastle.crypto.params.KeyParameter aesKey) |
DeterministicSeed |
encrypt(KeyCrypter keyCrypter,
org.spongycastle.crypto.params.KeyParameter aesKey) |
boolean |
equals(Object o) |
long |
getCreationTimeSeconds()
Returns the time in seconds since the UNIX epoch at which this encryptable item was first created/derived.
|
EncryptedData |
getEncryptedData()
Returns the initialization vector and encrypted secret bytes, or null if not encrypted.
|
EncryptedData |
getEncryptedSeedData() |
Protos.Wallet.EncryptionType |
getEncryptionType()
Returns an enum constant describing what algorithm was used to encrypt the key or UNENCRYPTED.
|
List<String> |
getMnemonicCode()
Get the mnemonic code, or null if unknown.
|
byte[] |
getSecretBytes()
Returns the raw bytes of the item, if not encrypted, or null if encrypted or the secret is missing.
|
byte[] |
getSeedBytes() |
int |
hashCode() |
boolean |
isEncrypted()
Returns whether the item is encrypted or not.
|
String |
toHexString()
Returns the seed as hex or null if encrypted.
|
String |
toString() |
public static final int DEFAULT_SEED_ENTROPY_BITS
public static final int MAX_SEED_ENTROPY_BITS
public DeterministicSeed(String mnemonicCode, byte[] seed, String passphrase, long creationTimeSeconds) throws UnreadableWalletException
UnreadableWalletException
public DeterministicSeed(byte[] seed, List<String> mnemonic, long creationTimeSeconds)
public DeterministicSeed(EncryptedData encryptedMnemonic, @Nullable EncryptedData encryptedSeed, long creationTimeSeconds)
public DeterministicSeed(List<String> mnemonicCode, @Nullable byte[] seed, String passphrase, long creationTimeSeconds)
MnemonicCode
for more
details on this scheme.mnemonicCode
- A list of words.seed
- The derived seed, or pass null to derive it from mnemonicCode (slow)passphrase
- A user supplied passphrase, or an empty string if there is no passphrasecreationTimeSeconds
- When the seed was originally created, UNIX time.public DeterministicSeed(SecureRandom random, int bits, String passphrase, long creationTimeSeconds)
MnemonicCode
for more
details on this scheme.random
- Entropy sourcebits
- number of bits, must be divisible by 32passphrase
- A user supplied passphrase, or an empty string if there is no passphrasecreationTimeSeconds
- When the seed was originally created, UNIX time.public DeterministicSeed(byte[] entropy, String passphrase, long creationTimeSeconds)
MnemonicCode
for more
details on this scheme.entropy
- entropy bits, length must be divisible by 32passphrase
- A user supplied passphrase, or an empty string if there is no passphrasecreationTimeSeconds
- When the seed was originally created, UNIX time.public boolean isEncrypted()
EncryptableItem
EncryptableItem.getSecretBytes()
will return null.isEncrypted
in interface EncryptableItem
@Nullable public byte[] getSecretBytes()
EncryptableItem
getSecretBytes
in interface EncryptableItem
@Nullable public byte[] getSeedBytes()
@Nullable public EncryptedData getEncryptedData()
EncryptableItem
getEncryptedData
in interface EncryptableItem
public Protos.Wallet.EncryptionType getEncryptionType()
EncryptableItem
getEncryptionType
in interface EncryptableItem
@Nullable public EncryptedData getEncryptedSeedData()
public long getCreationTimeSeconds()
EncryptableItem
getCreationTimeSeconds
in interface EncryptableItem
public DeterministicSeed encrypt(KeyCrypter keyCrypter, org.spongycastle.crypto.params.KeyParameter aesKey)
public DeterministicSeed decrypt(KeyCrypter crypter, String passphrase, org.spongycastle.crypto.params.KeyParameter aesKey)
public void check() throws MnemonicException
MnemonicException
- if check failsCopyright © 2014. All rights reserved.