Package nxt.crypto

Class KeyDerivation.Bip32Node

java.lang.Object
nxt.crypto.KeyDerivation.Bip32Node
Enclosing class:
KeyDerivation

public static class KeyDerivation.Bip32Node extends Object
Represents a node in the Bip32 derivation tree. Use this node to: Obtain the Curve25519 private/public key pair for signing and encryption Derive child nodes with both private and public data Derive child nodes with only public data Security considerations: Given a master public key and chain code of a non-hardened parent node and any child private key, anyone can easily reproduce the parent node private key and all child private keys. Therefore maintain the pair master public key + chain code private
  • Constructor Details

    • Bip32Node

      public Bip32Node(byte[] privateKeyLeft, byte[] privateKeyRight, byte[] masterPublicKey, byte[] chainCode, byte[] masterPublicKeyY)
  • Method Details

    • getPrivateKeyLeft

      public byte[] getPrivateKeyLeft()
      Returns:
      the ed25519/curve25519 private key associated with the node as used for signing and encryption
    • getPrivateKeyRight

      public byte[] getPrivateKeyRight()
      Returns:
      the right side of the key is used for hardened derivation of child nodes
    • getMasterPublicKey

      public byte[] getMasterPublicKey()
      Returns:
      the ed25519 public key used only for non-hardened child key derivation
    • getSerializedMasterPublicKey

      public byte[] getSerializedMasterPublicKey()
      Returns:
      the 68 bytes combined master public key + chain code + CRC32 checksum
    • getChainCode

      public byte[] getChainCode()
      Returns:
      the chain code is additional entropy needed to prevent someone just holding the private/public key pair from deriving more child nodes
    • getPublicKey

      public byte[] getPublicKey()
      Returns:
      the real Curve25519 public key used for signing and encryption
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object