org.eclipse.higgins.cardstore.schemas._2005._05.identity.impl
Class EncryptedStore

java.lang.Object
  extended byorg.eclipse.higgins.cardstore.schemas._2005._05.identity.impl.EncryptedStore
All Implemented Interfaces:
IEncryptedStore, XMLSerializer

public class EncryptedStore
extends Object
implements IEncryptedStore


Field Summary
static String copyright
           
 
Constructor Summary
EncryptedStore()
          Construct an empty EncryptedStore
EncryptedStore(byte[] crdsBytes)
           
 
Method Summary
 void fromXml(Object obj)
           
 byte[] getByteOrderMark()
          Returns the the byte order marker for the CRDS file.
 Object getParent()
           
 IRoamingStore getRoamingStore(PasswordCallback passwdCallback)
          Returns a RoamingStore object.
 Document getRootDocument()
           
 byte[] getStoreSalt()
          This method will return the store salt.
static void main(String[] args)
           
 byte[][] makeKeys(char[] password, byte[] salt)
          This method will return an array of byte arrays that contains two sets of key data.
 void setParent(Object parent)
           
 void setRoamingStore(IRoamingStore roamingStore)
          This method is used to replace or add a roaming store that the encrypted store is based on.
 Object toXml()
           
 byte[] toXml(PasswordCallback passwdCallback)
          Returns the bytes that should be written our to a CRDS file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static String copyright
Constructor Detail

EncryptedStore

public EncryptedStore()
Construct an empty EncryptedStore


EncryptedStore

public EncryptedStore(byte[] crdsBytes)
               throws UnsupportedObjectModel,
                      ExpectedObjectNotPresent
Method Detail

getParent

public Object getParent()
Specified by:
getParent in interface XMLSerializer

setParent

public void setParent(Object parent)
Specified by:
setParent in interface XMLSerializer

getByteOrderMark

public byte[] getByteOrderMark()
Description copied from interface: IEncryptedStore
Returns the the byte order marker for the CRDS file.

The typical values are: {0xEF, 0xBB, 0xBF}.

Specified by:
getByteOrderMark in interface IEncryptedStore
Returns:
three bytes; null if no byte order marker is present.

getStoreSalt

public byte[] getStoreSalt()
Description copied from interface: IEncryptedStore
This method will return the store salt.

Specified by:
getStoreSalt in interface IEncryptedStore
Returns:
byte array of store salt. The value will be Base64 decoded.

makeKeys

public byte[][] makeKeys(char[] password,
                         byte[] salt)
                  throws UnsupportedEncodingException,
                         NoSuchAlgorithmException
This method will return an array of byte arrays that contains two sets of key data. The first key should be used for encryption/decryption and the second key should be used for signture creation and validation.

Parameters:
password -
salt -
Returns:
Key array containing two keys.
Throws:
UnsupportedEncodingException
NoSuchAlgorithmException

getRoamingStore

public IRoamingStore getRoamingStore(PasswordCallback passwdCallback)
                              throws StoreDecryptionException
Description copied from interface: IEncryptedStore
Returns a RoamingStore object.

Specified by:
getRoamingStore in interface IEncryptedStore
Parameters:
passwdCallback - the required password to decrypt the store.
Returns:
Throws:
StoreDecryptionException

fromXml

public void fromXml(Object obj)
             throws UnsupportedObjectModel,
                    ExpectedObjectNotPresent
Specified by:
fromXml in interface XMLSerializer
Throws:
UnsupportedObjectModel
ExpectedObjectNotPresent

toXml

public Object toXml()
Specified by:
toXml in interface XMLSerializer

toXml

public byte[] toXml(PasswordCallback passwdCallback)
             throws StoreEncryptionException
Returns the bytes that should be written our to a CRDS file. The first three bytes with be a byte order mark followed by the EncryptedStore XML.

Specified by:
toXml in interface IEncryptedStore
Parameters:
passwdCallback - The password is required to encrypt the store
Returns:
the byte array to be written out to a CRDS file.
Throws:
StoreEncryptionException

getRootDocument

public Document getRootDocument()

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

setRoamingStore

public void setRoamingStore(IRoamingStore roamingStore)
Description copied from interface: IEncryptedStore
This method is used to replace or add a roaming store that the encrypted store is based on.

Specified by:
setRoamingStore in interface IEncryptedStore
Parameters:
roamingStore -