Class XMSSUtil

java.lang.Object
org.bouncycastle.pqc.crypto.xmss.XMSSUtil

@Deprecated public class XMSSUtil extends Object
Deprecated.
this class is implementation detail of the XMSS / XMSS^MT engine, which has moved to org.bouncycastle.crypto.signers.xmss and is package-private there. Drive XMSS through XMSSSigner / XMSSKeyPairGenerator and the org.bouncycastle.crypto.params key classes instead; the engine operations those are built on are on org.bouncycastle.crypto.signers.xmss.XMSSEngine.
Utils for XMSS implementation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    areEqual(byte[][] a, byte[][] b)
    Deprecated.
    Compares two 2d-byte arrays.
    static long
    bytesToXBigEndian(byte[] in, int offset, int size)
    Deprecated.
     
    static int
    calculateTau(int index, int height)
    Deprecated.
     
    static byte[]
    cloneArray(byte[] in)
    Deprecated.
    Clone a byte array.
    static byte[][]
    cloneArray(byte[][] in)
    Deprecated.
    Clone a 2d byte array.
    static void
    copyBytesAtOffset(byte[] dst, byte[] src, int offset)
    Deprecated.
    Copy src byte array to dst byte array at offset.
    static Object
    deserialize(byte[] data, Class clazz)
    Deprecated.
    Decode a BDS state whose checksum was bound to nothing.
    static Object
    deserialize(byte[] data, Class clazz, byte[] publicSeed)
    Deprecated.
    Decode a BDS state, checking its checksum against the public seed of the key it belongs to.
    static void
    dumpByteArray(byte[][] x)
    Deprecated.
    Dump content of 2d byte array.
    static byte[]
    extractBytesAtOffset(byte[] src, int offset, int length)
    Deprecated.
    Copy length bytes at position offset from src.
    static int
    Deprecated.
    Determine digest size of digest.
    static int
    getLeafIndex(long index, int xmssTreeHeight)
    Deprecated.
     
    static long
    getTreeIndex(long index, int xmssTreeHeight)
    Deprecated.
     
    static boolean
    hasNullPointer(byte[][] in)
    Deprecated.
    Checks whether 2d byte array has null pointers.
    static boolean
    isIndexValid(int height, long index)
    Deprecated.
    Check whether an index is valid or not.
    static boolean
    isNewAuthenticationPathNeeded(long globalIndex, int xmssHeight, int layer)
    Deprecated.
     
    static boolean
    isNewBDSInitNeeded(long globalIndex, int xmssHeight, int layer)
    Deprecated.
     
    static int
    log2(int n)
    Deprecated.
    Calculates the logarithm base 2 for a given Integer.
    static void
    longToBigEndian(long value, byte[] in, int offset)
    Deprecated.
     
    static byte[]
    Deprecated.
    Encode a BDS state, binding it to nothing.
    static byte[]
    serialize(Object obj, byte[] publicSeed)
    Deprecated.
    Encode a BDS state, binding its checksum to the public seed of the key it belongs to.
    static byte[]
    toBytesBigEndian(long value, int sizeInByte)
    Deprecated.
    Convert int/long to n-byte array.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XMSSUtil

      public XMSSUtil()
      Deprecated.
  • Method Details

    • log2

      public static int log2(int n)
      Deprecated.
      Calculates the logarithm base 2 for a given Integer.
      Parameters:
      n - Number.
      Returns:
      Logarithm to base 2 of n.
    • toBytesBigEndian

      public static byte[] toBytesBigEndian(long value, int sizeInByte)
      Deprecated.
      Convert int/long to n-byte array.
      Parameters:
      value - int/long value.
      sizeInByte - Size of byte array in byte.
      Returns:
      int/long as big-endian byte array of size sizeInByte.
    • longToBigEndian

      public static void longToBigEndian(long value, byte[] in, int offset)
      Deprecated.
    • bytesToXBigEndian

      public static long bytesToXBigEndian(byte[] in, int offset, int size)
      Deprecated.
    • cloneArray

      public static byte[] cloneArray(byte[] in)
      Deprecated.
      Clone a byte array.
      Parameters:
      in - byte array.
      Returns:
      Copy of byte array.
    • cloneArray

      public static byte[][] cloneArray(byte[][] in)
      Deprecated.
      Clone a 2d byte array.
      Parameters:
      in - 2d byte array.
      Returns:
      Copy of 2d byte array.
    • areEqual

      public static boolean areEqual(byte[][] a, byte[][] b)
      Deprecated.
      Compares two 2d-byte arrays.
      Parameters:
      a - 2d-byte array 1.
      b - 2d-byte array 2.
      Returns:
      true if all values in 2d-byte array are equal false else.
    • dumpByteArray

      public static void dumpByteArray(byte[][] x)
      Deprecated.
      Dump content of 2d byte array.
      Parameters:
      x - byte array.
    • hasNullPointer

      public static boolean hasNullPointer(byte[][] in)
      Deprecated.
      Checks whether 2d byte array has null pointers.
      Parameters:
      in - 2d byte array.
      Returns:
      true if at least one null pointer is found false else.
    • copyBytesAtOffset

      public static void copyBytesAtOffset(byte[] dst, byte[] src, int offset)
      Deprecated.
      Copy src byte array to dst byte array at offset.
      Parameters:
      dst - Destination.
      src - Source.
      offset - Destination offset.
    • extractBytesAtOffset

      public static byte[] extractBytesAtOffset(byte[] src, int offset, int length)
      Deprecated.
      Copy length bytes at position offset from src.
      Parameters:
      src - Source byte array.
      offset - Offset in source byte array.
      length - Length of bytes to copy.
      Returns:
      New byte array.
    • isIndexValid

      public static boolean isIndexValid(int height, long index)
      Deprecated.
      Check whether an index is valid or not.
      Parameters:
      height - Height of binary tree.
      index - Index to validate.
      Returns:
      true if index is valid false else.
    • getDigestSize

      public static int getDigestSize(Digest digest)
      Deprecated.
      Determine digest size of digest.
      Parameters:
      digest - Digest.
      Returns:
      Digest size.
    • getTreeIndex

      public static long getTreeIndex(long index, int xmssTreeHeight)
      Deprecated.
    • getLeafIndex

      public static int getLeafIndex(long index, int xmssTreeHeight)
      Deprecated.
    • serialize

      public static byte[] serialize(Object obj) throws IOException
      Deprecated.
      Encode a BDS state, binding it to nothing. Prefer serialize(Object, byte[]): the encoded state carries a checksum, and passing the owning key's public seed ties the state to that key, so a state transplanted between two keys of the same parameters is detected (github #2414).
      Throws:
      IOException
    • serialize

      public static byte[] serialize(Object obj, byte[] publicSeed) throws IOException
      Deprecated.
      Encode a BDS state, binding its checksum to the public seed of the key it belongs to.
      Parameters:
      obj - the BDS or BDSStateMap to encode.
      publicSeed - the owning key's public seed, or null to bind nothing.
      Throws:
      IOException
    • deserialize

      public static Object deserialize(byte[] data, Class clazz) throws IOException, ClassNotFoundException
      Deprecated.
      Decode a BDS state whose checksum was bound to nothing. Prefer deserialize(byte[], Class, byte[]) - see serialize(Object, byte[]).
      Throws:
      IOException
      ClassNotFoundException
    • deserialize

      public static Object deserialize(byte[] data, Class clazz, byte[] publicSeed) throws IOException, ClassNotFoundException
      Deprecated.
      Decode a BDS state, checking its checksum against the public seed of the key it belongs to.
      Parameters:
      data - the encoded state.
      clazz - BDS or BDSStateMap.
      publicSeed - the owning key's public seed, or null if nothing was bound.
      Throws:
      IOException
      ClassNotFoundException
    • calculateTau

      public static int calculateTau(int index, int height)
      Deprecated.
    • isNewBDSInitNeeded

      public static boolean isNewBDSInitNeeded(long globalIndex, int xmssHeight, int layer)
      Deprecated.
    • isNewAuthenticationPathNeeded

      public static boolean isNewAuthenticationPathNeeded(long globalIndex, int xmssHeight, int layer)
      Deprecated.