Package org.bouncycastle.tsp.ers
Interface ERSRootNodeCalculator
-
- All Known Implementing Classes:
BinaryTreeRootCalculator
public interface ERSRootNodeCalculator
Base interface for an implementation that calculates the root hash contained in the time-stamp from the Merkle tree based on the partial hash-tree nodes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.bouncycastle.asn1.tsp.PartialHashtree[]
computePathToRoot(org.bouncycastle.operator.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(org.bouncycastle.operator.DigestCalculator digCalc, org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
Calculate the root hash of the Merkle tree from the partial hash-tree nodes.byte[]
recoverRootHash(org.bouncycastle.operator.DigestCalculator digCalc, org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
Recover the root hash from a path made up of PartialHashtrees.
-
-
-
Method Detail
-
computeRootHash
byte[] computeRootHash(org.bouncycastle.operator.DigestCalculator digCalc, org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
Calculate the root hash of the Merkle tree from the partial hash-tree nodes.- 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
org.bouncycastle.asn1.tsp.PartialHashtree[] computePathToRoot(org.bouncycastle.operator.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.- 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
byte[] recoverRootHash(org.bouncycastle.operator.DigestCalculator digCalc, org.bouncycastle.asn1.tsp.PartialHashtree[] nodes)
Recover the root hash from a path made up of PartialHashtrees.- 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.
-
-