public final class HDKeyDerivation
extends java.lang.Object
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.
|
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 not between 0 and n inclusive)java.lang.IllegalArgumentException
- if the seed is less than 8 bytes and could be brute forcedpublic static DeterministicKey createMasterPrivKeyFromBytes(byte[] privKeyBytes, byte[] chainCode) throws HDDerivationException
HDDerivationException
- if privKeyBytes is invalid (not between 0 and n inclusive).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 DeterministicKey deriveChildKeyFromPrivate(DeterministicKey parent, ChildNumber childNumber) throws HDDerivationException
HDDerivationException
public static HDKeyDerivation.RawKeyBytes deriveChildKeyBytesFromPrivate(DeterministicKey parent, ChildNumber childNumber) throws HDDerivationException
HDDerivationException
public static DeterministicKey deriveChildKeyFromPublic(DeterministicKey parent, ChildNumber childNumber, HDKeyDerivation.PublicDeriveMode mode) throws HDDerivationException
HDDerivationException
public static HDKeyDerivation.RawKeyBytes deriveChildKeyBytesFromPublic(DeterministicKey parent, ChildNumber childNumber, HDKeyDerivation.PublicDeriveMode mode) throws HDDerivationException
HDDerivationException