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.


Field Summary
 
Fields inherited from class com.google.bitcoin.core.VersionedChecksummedBytes
bytes, version
 
Constructor Summary
DumpedPrivateKey(NetworkParameters params, byte[] keyBytes)
          Allows the output of a private key in versioned, checksummed form.
DumpedPrivateKey(NetworkParameters params, String encoded)
          Parses the given private key as created by the "dumpprivkey" Bitcoin C++ RPC.
 
Method Summary
 ECKey getKey()
          Returns an ECKey created from this encoded private key.
 
Methods inherited from class com.google.bitcoin.core.VersionedChecksummedBytes
equals, getVersion, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DumpedPrivateKey

public DumpedPrivateKey(NetworkParameters params,
                        byte[] keyBytes)
Allows the output of a private key in versioned, checksummed form.

Parameters:
params - The network parameters of this key, needed for the version byte.
keyBytes - The 256-bit private key.

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.



Copyright © 2011. All Rights Reserved.