Bouncy Castle Cryptography Library 1.77.00

org.bouncycastle.tsp.ers
Class ERSDataGroup

java.lang.Object
  extended byorg.bouncycastle.tsp.ers.ERSCachingData
      extended byorg.bouncycastle.tsp.ers.ERSDataGroup
All Implemented Interfaces:
ERSData
Direct Known Subclasses:
ERSDirectoryDataGroup

public class ERSDataGroup
extends ERSCachingData

Representation of data groups with more than 1 members according to the description provided in RFC4998.

Such data groups represent a set of one or more data objects (e.g. electronic documents) for which an Evidence Record should be generated. Data groups will be encapsulated in a single PartialHashtree so that the presence of the group can be checked for, as well as the individual items that make it up.


Field Summary
protected  java.util.List dataObjects
           
 
Constructor Summary
ERSDataGroup(ERSData dataObject)
          Constructor for a group with a single object.
ERSDataGroup(ERSData[] dataObjects)
          Base constructor for an "array" of data objects.
ERSDataGroup(java.util.List dataObjects)
          Base constructor using a list of data objects.
 
Method Summary
protected  byte[] calculateHash(DigestCalculator digestCalculator, byte[] previousChainHash)
          Generates a hash for the whole DataGroup.
 byte[] getHash(DigestCalculator digestCalculator, byte[] previousChainHash)
          Return the calculated hash for the Data
 java.util.List getHashes(DigestCalculator digestCalculator, byte[] previousChainHash)
          Generates hashes for all the data objects included in the data group with a previous chain hash.
 int size()
          Return the number of data objects present in the group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataObjects

protected java.util.List dataObjects
Constructor Detail

ERSDataGroup

public ERSDataGroup(ERSData[] dataObjects)
Base constructor for an "array" of data objects.

Parameters:
dataObjects - an array of data objects.

ERSDataGroup

public ERSDataGroup(java.util.List dataObjects)
Base constructor using a list of data objects.

Parameters:
dataObjects - a list of data objects.

ERSDataGroup

public ERSDataGroup(ERSData dataObject)
Constructor for a group with a single object.

Parameters:
dataObject - the data object to go in the group.
Method Detail

getHashes

public java.util.List getHashes(DigestCalculator digestCalculator,
                                byte[] previousChainHash)
Generates hashes for all the data objects included in the data group with a previous chain hash.

Parameters:
digestCalculator - the DigestCalculator to use for computing the hashes
Returns:
the set of hashes, in ascending order

getHash

public byte[] getHash(DigestCalculator digestCalculator,
                      byte[] previousChainHash)
Return the calculated hash for the Data

Specified by:
getHash in interface ERSData
Overrides:
getHash in class ERSCachingData
Parameters:
digestCalculator - digest calculator to use.
previousChainHash - hash from an earlier chain if it needs to be included.
Returns:
calculated hash.

calculateHash

protected byte[] calculateHash(DigestCalculator digestCalculator,
                               byte[] previousChainHash)
Generates a hash for the whole DataGroup.

Specified by:
calculateHash in class ERSCachingData
Parameters:
digestCalculator - the DigestCalculator to use for computing the hash
Returns:
a hash that is representative of the whole DataGroup

size

public int size()
Return the number of data objects present in the group.

Returns:
membership count of the group.

Bouncy Castle Cryptography Library 1.77.00