org.bouncycastle.tsp.ers
Class BinaryTreeRootCalculator
java.lang.Object
|
+--org.bouncycastle.tsp.ers.BinaryTreeRootCalculator
- All Implemented Interfaces:
- ERSRootNodeCalculator
- public class BinaryTreeRootCalculator
- extends java.lang.Object
- implements ERSRootNodeCalculator
Calculator based on the use of a left weighted binary Merkle tree created
on top of the partial hash tree objects provided.
Method Summary |
org.bouncycastle.asn1.tsp.PartialHashtree[] |
computePathToRoot(DigestCalculator digCalc,
org.bouncycastle.asn1.tsp.PartialHashtree node,
int index)
Calculate a path from the leaf node to the root of the last computed Merkle tree. |
byte[] |
computeRootHash(DigestCalculator digCalc,
org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
Calculate the root hash of the Merkle tree from the partial hash-tree nodes. |
byte[] |
recoverRootHash(DigestCalculator digCalc,
org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
Recover the root hash from a path made up of PartialHashtrees. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BinaryTreeRootCalculator
public BinaryTreeRootCalculator()
computeRootHash
public byte[] computeRootHash(DigestCalculator digCalc,
org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
- Description copied from interface:
ERSRootNodeCalculator
- Calculate the root hash of the Merkle tree from the partial hash-tree nodes.
- Specified by:
computeRootHash
in interface ERSRootNodeCalculator
- Following copied from interface:
org.bouncycastle.tsp.ers.ERSRootNodeCalculator
- Parameters:
digCalc
- the digest calculator to use.nodes
- the partial hash-trees forming the basis of the Merkle tree.- Returns:
- the root hash of the Merkle tree.
computePathToRoot
public org.bouncycastle.asn1.tsp.PartialHashtree[] computePathToRoot(DigestCalculator digCalc,
org.bouncycastle.asn1.tsp.PartialHashtree node,
int index)
- Description copied from interface:
ERSRootNodeCalculator
- Calculate a path from the leaf node to the root of the last computed Merkle tree.
- Specified by:
computePathToRoot
in interface ERSRootNodeCalculator
- Following copied from interface:
org.bouncycastle.tsp.ers.ERSRootNodeCalculator
- Parameters:
digCalc
- the digest calculator to use.node
- the leaf node at the start of the path.index
- the index of the node in the original list of partial hash trees.- Returns:
-
recoverRootHash
public byte[] recoverRootHash(DigestCalculator digCalc,
org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
- Description copied from interface:
ERSRootNodeCalculator
- Recover the root hash from a path made up of PartialHashtrees.
- Specified by:
recoverRootHash
in interface ERSRootNodeCalculator
- Following copied from interface:
org.bouncycastle.tsp.ers.ERSRootNodeCalculator
- Parameters:
digCalc
- the digest calculator to use.nodes
- the partial hash-trees forming a path from a leaf to the root of the Merkle tree.- Returns:
- the root hash of the Merkle tree.