Package org.bouncycastle.cert.plants
Class LandmarkSequence
- java.lang.Object
-
- org.bouncycastle.cert.plants.LandmarkSequence
-
public final class LandmarkSequence extends java.lang.ObjectThe published landmark sequence for a single issuance log, as defined by Section 6.3 of draft-ietf-plants-merkle-tree-certs.A
LandmarkSequencecaptures thenum_active_landmarks + 1most recent landmarks (numberedlast_landmark - num_active_landmarksthroughlast_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 Constructor Description LandmarkSequence(long lastLandmark, long[] treeSizesNewestFirst)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<long[]>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).java.lang.Stringformat()Serializes the landmark sequence in the format defined by Section 6.3.3 (each line terminated with U+000A).longgetLastLandmark()intgetNumActiveLandmarks()longgetTreeSize(long landmarkNumber)static LandmarkSequenceparse(java.lang.String text)Parses a landmark sequence from its published text form (Section 6.3.3).
-
-
-
Constructor Detail
-
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 Detail
-
parse
public static LandmarkSequence parse(java.lang.String text) throws java.io.IOException
Parses a landmark sequence from its published text form (Section 6.3.3).- Throws:
java.io.IOException
-
format
public java.lang.String 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
public java.util.List<long[]> 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.
-
-