com.google.bitcoin.core
Class DumpedPrivateKey

java.lang.Object
  extended by com.google.bitcoin.core.VersionedChecksummedBytes
      extended by com.google.bitcoin.core.DumpedPrivateKey

public class DumpedPrivateKey
extends VersionedChecksummedBytes

Parses and generates private keys in the form used by the Bitcoin "dumpprivkey" command. This is the private key bytes with a header byte and 4 checksum bytes at the end. If there are 33 private key bytes instead of 32, then the last byte is a discriminator value for the compressed pubkey.


Field Summary
 
Fields inherited from class com.google.bitcoin.core.VersionedChecksummedBytes
bytes, version
 
Constructor Summary
DumpedPrivateKey(NetworkParameters params, String encoded)
          Parses the given private key as created by the "dumpprivkey" Bitcoin C++ RPC.
 
Method Summary
 boolean equals(Object other)
           
 ECKey getKey()
          Returns an ECKey created from this encoded private key.
 int hashCode()
           
 
Methods inherited from class com.google.bitcoin.core.VersionedChecksummedBytes
getVersion, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DumpedPrivateKey

public DumpedPrivateKey(NetworkParameters params,
                        String encoded)
                 throws AddressFormatException
Parses the given private key as created by the "dumpprivkey" Bitcoin C++ RPC.

Parameters:
params - The expected network parameters of the key. If you don't care, provide null.
encoded - The base58 encoded string.
Throws:
AddressFormatException - If the string is invalid or the header byte doesn't match the network params.
Method Detail

getKey

public ECKey getKey()
Returns an ECKey created from this encoded private key.


equals

public boolean equals(Object other)
Overrides:
equals in class VersionedChecksummedBytes

hashCode

public int hashCode()
Overrides:
hashCode in class VersionedChecksummedBytes


Copyright © 2014. All rights reserved.