Class GMSSRootCalc


  • public class GMSSRootCalc
    extends java.lang.Object
    This class computes a whole Merkle tree and saves the needed values for AuthPath computation. It is used for precomputation of the root of a following tree. After initialization, 2^H updates are required to complete the root. Every update requires one leaf value as parameter. While computing the root all initial values for the authentication path algorithm (treehash, auth, retain) are stored for later use.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[][] getAuthPath()
      returns the authentication path of the first leaf of the tree
      java.util.Vector[] getRetain()
      returns the retain stacks storing all right nodes near to the root
      byte[] getRoot()
      returns the finished root value
      java.util.Vector getStack()
      returns the shared stack
      byte[][] getStatByte()
      Returns the status byte array used by the GMSSPrivateKeyASN.1 class
      int[] getStatInt()
      Returns the status int array used by the GMSSPrivateKeyASN.1 class
      Treehash[] getTreehash()
      returns the initial treehash instances, storing value y_3(i)
      void initialize​(java.util.Vector sharedStack)
      Initializes the calculation of a new root
      void initializeTreehashSeed​(byte[] seed, int index)
      initializes the seeds for the treehashs of the tree precomputed by this class
      java.lang.String toString()  
      void update​(byte[] leaf)
      Updates the root with one leaf and stores the needed values in retain, treehash or authpath
      void update​(byte[] seed, byte[] leaf)
      updates the root with one leaf and stores needed values in retain, treehash or authpath.
      boolean wasFinished()
      Method to check whether the instance has been finished or not
      boolean wasInitialized()
      Method to check whether the instance has been initialized or not
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GMSSRootCalc

        public GMSSRootCalc​(int heightOfTree,
                            int K,
                            GMSSDigestProvider digestProvider)
        Constructor
        Parameters:
        heightOfTree - maximal height of the tree
        digestProvider - an array of strings, containing the name of the used hash function and PRNG and the name of the corresponding provider
    • Method Detail

      • initialize

        public void initialize​(java.util.Vector sharedStack)
        Initializes the calculation of a new root
        Parameters:
        sharedStack - the stack shared by all treehash instances of this tree
      • update

        public void update​(byte[] seed,
                           byte[] leaf)
        updates the root with one leaf and stores needed values in retain, treehash or authpath. Additionally counts the seeds used. This method is used when performing the updates for TREE++.
        Parameters:
        seed - the initial seed for treehash: seedNext
        leaf - the height of the treehash
      • update

        public void update​(byte[] leaf)
        Updates the root with one leaf and stores the needed values in retain, treehash or authpath
      • initializeTreehashSeed

        public void initializeTreehashSeed​(byte[] seed,
                                           int index)
        initializes the seeds for the treehashs of the tree precomputed by this class
        Parameters:
        seed - the initial seed for treehash: seedNext
        index - the height of the treehash
      • wasInitialized

        public boolean wasInitialized()
        Method to check whether the instance has been initialized or not
        Returns:
        true if treehash was already initialized
      • wasFinished

        public boolean wasFinished()
        Method to check whether the instance has been finished or not
        Returns:
        true if tree has reached its maximum height
      • getAuthPath

        public byte[][] getAuthPath()
        returns the authentication path of the first leaf of the tree
        Returns:
        the authentication path of the first leaf of the tree
      • getTreehash

        public Treehash[] getTreehash()
        returns the initial treehash instances, storing value y_3(i)
        Returns:
        the initial treehash instances, storing value y_3(i)
      • getRetain

        public java.util.Vector[] getRetain()
        returns the retain stacks storing all right nodes near to the root
        Returns:
        the retain stacks storing all right nodes near to the root
      • getRoot

        public byte[] getRoot()
        returns the finished root value
        Returns:
        the finished root value
      • getStack

        public java.util.Vector getStack()
        returns the shared stack
        Returns:
        the shared stack
      • getStatByte

        public byte[][] getStatByte()
        Returns the status byte array used by the GMSSPrivateKeyASN.1 class
        Returns:
        The status bytes
      • getStatInt

        public int[] getStatInt()
        Returns the status int array used by the GMSSPrivateKeyASN.1 class
        Returns:
        The status ints
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        a human readable version of the structure