Modifier and Type | Class and Description |
---|---|
static class |
HDKeyDerivation.PublicDeriveMode |
static class |
HDKeyDerivation.RawKeyBytes |
Modifier and Type | Field and Description |
---|---|
static int |
MAX_CHILD_DERIVATION_ATTEMPTS
Child derivation may fail (although with extremely low probability); in such case it is re-attempted.
|
Modifier and Type | Method and Description |
---|---|
static DeterministicKey |
createMasterPrivateKey(byte[] seed)
Generates a new deterministic key from the given seed, which can be any arbitrary byte array.
|
static DeterministicKey |
createMasterPrivKeyFromBytes(byte[] privKeyBytes,
byte[] chainCode) |
static DeterministicKey |
createMasterPubKeyFromBytes(byte[] pubKeyBytes,
byte[] chainCode) |
static DeterministicKey |
deriveChildKey(DeterministicKey parent,
ChildNumber childNumber) |
static DeterministicKey |
deriveChildKey(DeterministicKey parent,
int childNumber)
Derives a key given the "extended" child number, ie.
|
static HDKeyDerivation.RawKeyBytes |
deriveChildKeyBytesFromPrivate(DeterministicKey parent,
ChildNumber childNumber) |
static HDKeyDerivation.RawKeyBytes |
deriveChildKeyBytesFromPublic(DeterministicKey parent,
ChildNumber childNumber,
HDKeyDerivation.PublicDeriveMode mode) |
static DeterministicKey |
deriveThisOrNextChildKey(DeterministicKey parent,
int childNumber)
Derives a key of the "extended" child number, ie.
|
public static final int MAX_CHILD_DERIVATION_ATTEMPTS
public static DeterministicKey createMasterPrivateKey(byte[] seed) throws HDDerivationException
HDDerivationException
- if generated master key is invalid (private key 0 or >= n).IllegalArgumentException
- if the seed is less than 8 bytes and could be brute forced.public static DeterministicKey createMasterPrivKeyFromBytes(byte[] privKeyBytes, byte[] chainCode) throws HDDerivationException
HDDerivationException
- if privKeyBytes is invalid (0 or >= n).public static DeterministicKey createMasterPubKeyFromBytes(byte[] pubKeyBytes, byte[] chainCode)
public static DeterministicKey deriveChildKey(DeterministicKey parent, int childNumber)
childNumber
will determine whether to use hardened derivation or not.
Consider whether your code would benefit from the clarity of the equivalent, but explicit, form
of this method that takes a ChildNumber
rather than an int
, for example:
deriveChildKey(parent, new ChildNumber(childNumber, true))
where the value of the hardened bit of childNumber
is zero.public static DeterministicKey deriveThisOrNextChildKey(DeterministicKey parent, int childNumber)
public static DeterministicKey deriveChildKey(DeterministicKey parent, ChildNumber childNumber) throws HDDerivationException
HDDerivationException
- if private derivation is attempted for a public-only parent key, or
if the resulting derived key is invalid (eg. private key == 0).public static HDKeyDerivation.RawKeyBytes deriveChildKeyBytesFromPrivate(DeterministicKey parent, ChildNumber childNumber) throws HDDerivationException
HDDerivationException
public static HDKeyDerivation.RawKeyBytes deriveChildKeyBytesFromPublic(DeterministicKey parent, ChildNumber childNumber, HDKeyDerivation.PublicDeriveMode mode) throws HDDerivationException
HDDerivationException
Copyright © 2016. All rights reserved.