com.google.bitcoin.crypto
Class EncryptedPrivateKey

java.lang.Object
  extended by com.google.bitcoin.crypto.EncryptedPrivateKey

public class EncryptedPrivateKey
extends Object

An EncryptedPrivateKey contains the information produced after encrypting the private key bytes of an ECKey.

It contains two member variables - initialisationVector and encryptedPrivateBytes. The initialisationVector is a randomly chosen list of bytes that were used to initialise the AES block cipher when the private key bytes were encrypted. You need these for decryption. The encryptedPrivateBytes are the result of AES encrypting the private keys using an AES key that is derived from a user entered password. You need the password to recreate the AES key in order to decrypt these bytes.


Constructor Summary
EncryptedPrivateKey(byte[] initialisationVector, byte[] encryptedPrivateKeys)
           
EncryptedPrivateKey(EncryptedPrivateKey encryptedPrivateKey)
          Cloning constructor.
 
Method Summary
 void clear()
          Clears all the EncryptedPrivateKey contents from memory (overwriting all data including PRIVATE KEYS).
 EncryptedPrivateKey clone()
           
 boolean equals(Object obj)
           
 byte[] getEncryptedBytes()
           
 byte[] getInitialisationVector()
           
 int hashCode()
           
 void setEncryptedPrivateBytes(byte[] encryptedPrivateBytes)
          Set the encrypted private key bytes, cloning them.
 void setInitialisationVector(byte[] initialisationVector)
          Set the initialisationVector, cloning the bytes.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EncryptedPrivateKey

public EncryptedPrivateKey(EncryptedPrivateKey encryptedPrivateKey)
Cloning constructor.

Parameters:
encryptedPrivateKey - EncryptedPrivateKey to clone.

EncryptedPrivateKey

public EncryptedPrivateKey(byte[] initialisationVector,
                           byte[] encryptedPrivateKeys)
Parameters:
iv -
encryptedPrivateKeys -
Method Detail

getInitialisationVector

public byte[] getInitialisationVector()

setInitialisationVector

public void setInitialisationVector(byte[] initialisationVector)
Set the initialisationVector, cloning the bytes.

Parameters:
initialisationVector -

getEncryptedBytes

public byte[] getEncryptedBytes()

setEncryptedPrivateBytes

public void setEncryptedPrivateBytes(byte[] encryptedPrivateBytes)
Set the encrypted private key bytes, cloning them.

Parameters:
encryptedPrivateBytes -

clone

public EncryptedPrivateKey clone()
Overrides:
clone in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

clear

public void clear()
Clears all the EncryptedPrivateKey contents from memory (overwriting all data including PRIVATE KEYS). WARNING - this method irreversibly deletes the private key information.



Copyright © 2014. All rights reserved.