Class LandmarkSequence
java.lang.Object
org.bouncycastle.cert.plants.LandmarkSequence
The published landmark sequence for a single issuance log, as defined by
Section 6.3 of draft-ietf-plants-merkle-tree-certs.
A LandmarkSequence captures the num_active_landmarks + 1
most recent landmarks (numbered last_landmark - num_active_landmarks
through last_landmark), with each landmark's tree size. Landmark 0
always has tree size 0; subsequent landmarks are strictly monotonically
increasing in tree size and consecutive in landmark number.
The published wire format (Section 6.3.3) is plain UTF-8 text:
<last_landmark> <num_active_landmarks> tree_size of landmark last_landmark tree_size of landmark last_landmark - 1 ... tree_size of landmark last_landmark - num_active_landmarks
Each line is terminated with U+000A. Tree sizes within the sequence MUST be strictly monotonically decreasing reading from line 1 to line N.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<long[]> Returns the landmark subtree intervals determined by this sequence per Section 6.3.1: between consecutive landmarks (excluding landmark 0) the interval[prev_tree_size, tree_size)is covered by one or two subtrees fromMerkleTreePrimitives.findCoveringSubtrees(long, long).format()Serializes the landmark sequence in the format defined by Section 6.3.3 (each line terminated with U+000A).longintlonggetTreeSize(long landmarkNumber) static LandmarkSequenceParses a landmark sequence from its published text form (Section 6.3.3).
-
Constructor Details
-
LandmarkSequence
public LandmarkSequence(long lastLandmark, long[] treeSizesNewestFirst) - Parameters:
lastLandmark- the landmark number of the newest landmarktreeSizesNewestFirst- tree sizes for landmarkslastLandmarkdown tolastLandmark - treeSizes.length + 1; must be strictly monotonically decreasing
-
-
Method Details
-
parse
Parses a landmark sequence from its published text form (Section 6.3.3).- Throws:
IOException
-
format
Serializes the landmark sequence in the format defined by Section 6.3.3 (each line terminated with U+000A). -
getLastLandmark
public long getLastLandmark()- Returns:
- the landmark number of the newest landmark.
-
getNumActiveLandmarks
public int getNumActiveLandmarks()- Returns:
num_active_landmarksas published (one less than the tree size count).
-
getTreeSize
public long getTreeSize(long landmarkNumber) - Returns:
- the tree size of the landmark with the given number.
-
activeLandmarkSubtrees
Returns the landmark subtree intervals determined by this sequence per Section 6.3.1: between consecutive landmarks (excluding landmark 0) the interval[prev_tree_size, tree_size)is covered by one or two subtrees fromMerkleTreePrimitives.findCoveringSubtrees(long, long). The returned list is ordered oldest-first.
-