Class GMSSRootCalc

java.lang.Object
org.bouncycastle.pqc.legacy.crypto.gmss.GMSSRootCalc

public class GMSSRootCalc extends 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.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GMSSRootCalc(int heightOfTree, int K, GMSSDigestProvider digestProvider)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[][]
    returns the authentication path of the first leaf of the tree
    returns the retain stacks storing all right nodes near to the root
    byte[]
    returns the finished root value
    returns the shared stack
    byte[][]
    Returns the status byte array used by the GMSSPrivateKeyASN.1 class
    int[]
    Returns the status int array used by the GMSSPrivateKeyASN.1 class
    returns the initial treehash instances, storing value y_3(i)
    void
    initialize(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
     
    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
    Method to check whether the instance has been finished or not
    boolean
    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 Details

    • 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 Details

    • initialize

      public void initialize(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 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 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 String toString()
      Overrides:
      toString in class Object
      Returns:
      a human readable version of the structure